Michael Bestas | dd2506a | 2023-07-20 20:53:02 +0300 | [diff] [blame] | 1 | /* |
| 2 | * SPDX-FileCopyrightText: 2022-2023 The LineageOS Project |
| 3 | * SPDX-License-Identifier: Apache-2.0 |
| 4 | */ |
| 5 | |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 6 | import org.lineageos.generatebp.GenerateBpPlugin |
| 7 | import org.lineageos.generatebp.GenerateBpPluginExtension |
| 8 | import org.lineageos.generatebp.models.Module |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 9 | |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 10 | plugins { |
| 11 | id("com.android.application") |
| 12 | id("kotlin-android") |
| 13 | } |
| 14 | |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 15 | apply { |
| 16 | plugin<GenerateBpPlugin>() |
| 17 | } |
| 18 | |
| 19 | buildscript { |
| 20 | repositories { |
LuK1337 | 48ecbae | 2023-10-10 16:22:54 +0200 | [diff] [blame] | 21 | maven("https://raw.githubusercontent.com/lineage-next/gradle-generatebp/v1.3/.m2") |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | dependencies { |
| 25 | classpath("org.lineageos:gradle-generatebp:+") |
| 26 | } |
| 27 | } |
| 28 | |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 29 | android { |
| 30 | compileSdk = 33 |
Sebastiano Barezzi | 4bf39d5 | 2023-10-04 19:27:56 +0200 | [diff] [blame] | 31 | namespace = "org.lineageos.aperture" |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 32 | |
| 33 | defaultConfig { |
Sebastiano Barezzi | f5a9a78 | 2022-11-07 01:06:37 +0100 | [diff] [blame] | 34 | applicationId = "org.lineageos.aperture" |
Sebastiano Barezzi | d11139c | 2022-10-30 16:37:13 +0100 | [diff] [blame] | 35 | minSdk = 26 |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 36 | targetSdk = 33 |
| 37 | versionCode = 1 |
| 38 | versionName = "1.0" |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | buildTypes { |
Sebastiano Barezzi | f0b4640 | 2022-11-07 01:05:51 +0100 | [diff] [blame] | 42 | getByName("release") { |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 43 | // Enables code shrinking, obfuscation, and optimization. |
| 44 | isMinifyEnabled = true |
| 45 | |
| 46 | // Enables resource shrinking. |
| 47 | isShrinkResources = true |
| 48 | |
| 49 | // Includes the default ProGuard rules files. |
| 50 | setProguardFiles( |
| 51 | listOf( |
| 52 | getDefaultProguardFile("proguard-android-optimize.txt"), |
| 53 | "proguard-rules.pro" |
| 54 | ) |
| 55 | ) |
| 56 | } |
Sebastiano Barezzi | f5a9a78 | 2022-11-07 01:06:37 +0100 | [diff] [blame] | 57 | getByName("debug") { |
| 58 | // Append .dev to package name so we won't conflict with AOSP build. |
| 59 | applicationIdSuffix = ".dev" |
| 60 | } |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 61 | } |
| 62 | |
| 63 | compileOptions { |
| 64 | sourceCompatibility = JavaVersion.VERSION_1_8 |
| 65 | targetCompatibility = JavaVersion.VERSION_1_8 |
| 66 | } |
| 67 | |
| 68 | kotlinOptions { |
| 69 | jvmTarget = "1.8" |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | dependencies { |
LuK1337 | 00ac9b1 | 2023-01-25 20:14:54 +0100 | [diff] [blame] | 74 | // Align versions of all Kotlin components |
| 75 | implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0")) |
| 76 | |
LuK1337 | 4ca4060 | 2023-05-24 20:34:45 +0200 | [diff] [blame] | 77 | implementation("androidx.core:core-ktx:1.10.1") |
Sebastiano Barezzi | 1a512eb | 2023-06-22 23:20:38 +0200 | [diff] [blame] | 78 | implementation("androidx.activity:activity-ktx:1.7.2") |
LuK1337 | 6d39d8a | 2023-02-22 20:30:20 +0100 | [diff] [blame] | 79 | implementation("androidx.appcompat:appcompat:1.6.1") |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 80 | implementation("androidx.constraintlayout:constraintlayout:2.1.4") |
Tommy Webb | 636f225 | 2023-01-27 13:33:42 -0500 | [diff] [blame] | 81 | implementation("androidx.exifinterface:exifinterface:1.3.6") |
LuK1337 | 4ca4060 | 2023-05-24 20:34:45 +0200 | [diff] [blame] | 82 | implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1") |
LuK1337 | afc94a3 | 2022-09-05 23:30:33 +0200 | [diff] [blame] | 83 | implementation("androidx.preference:preference:1.2.0") |
LuK1337 | bc3d67a | 2023-06-04 19:54:31 +0200 | [diff] [blame] | 84 | implementation("com.google.android.material:material:1.9.0") |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 85 | |
| 86 | // CameraX core library using the camera2 implementation |
LuK1337 | 3006e8c | 2023-10-18 20:32:10 +0200 | [diff] [blame^] | 87 | val cameraxVersion = "1.4.0-alpha02" |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 88 | // The following line is optional, as the core library is included indirectly by camera-camera2 |
| 89 | implementation("androidx.camera:camera-core:${cameraxVersion}") |
| 90 | implementation("androidx.camera:camera-camera2:${cameraxVersion}") |
| 91 | // If you want to additionally use the CameraX Lifecycle library |
| 92 | implementation("androidx.camera:camera-lifecycle:${cameraxVersion}") |
| 93 | // If you want to additionally use the CameraX VideoCapture library |
| 94 | implementation("androidx.camera:camera-video:${cameraxVersion}") |
| 95 | // If you want to additionally use the CameraX View class |
| 96 | implementation("androidx.camera:camera-view:${cameraxVersion}") |
| 97 | // If you want to additionally use the CameraX Extensions library |
| 98 | implementation("androidx.camera:camera-extensions:${cameraxVersion}") |
| 99 | |
Sebastiano Barezzi | 6b71eb5 | 2022-11-10 00:05:27 +0100 | [diff] [blame] | 100 | // Media3 |
Sebastiano Barezzi | deb8766 | 2023-08-24 14:40:48 +0200 | [diff] [blame] | 101 | val media3Version = "1.1.1" |
Sebastiano Barezzi | 6b71eb5 | 2022-11-10 00:05:27 +0100 | [diff] [blame] | 102 | // For media playback using ExoPlayer |
| 103 | implementation("androidx.media3:media3-exoplayer:$media3Version") |
| 104 | // For building media playback UIs |
| 105 | implementation("androidx.media3:media3-ui:$media3Version") |
| 106 | |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 107 | // ZXing |
LuK1337 | 45a6690 | 2023-09-17 12:50:34 +0200 | [diff] [blame] | 108 | implementation("com.google.zxing:core:3.5.2") |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 109 | |
| 110 | // Coil |
LuK1337 | 5c420fa | 2022-10-10 13:22:45 +0200 | [diff] [blame] | 111 | implementation("io.coil-kt:coil:2.2.2") |
| 112 | implementation("io.coil-kt:coil-video:2.2.2") |
LuK1337 | 9c4638c | 2022-09-05 13:37:03 +0200 | [diff] [blame] | 113 | } |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 114 | |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 115 | configure<GenerateBpPluginExtension> { |
| 116 | targetSdk.set(android.defaultConfig.targetSdk!!) |
| 117 | availableInAOSP.set { module: Module -> |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 118 | when { |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 119 | module.group.startsWith("androidx") -> { |
Sebastiano Barezzi | 6b71eb5 | 2022-11-10 00:05:27 +0100 | [diff] [blame] | 120 | // We provide our own androidx.{camera,media3} & lifecycle-common |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 121 | !module.group.startsWith("androidx.camera") && |
| 122 | !module.group.startsWith("androidx.media3") && |
| 123 | module.name != "lifecycle-common" |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 124 | } |
Sebastiano Barezzi | 7fccb00 | 2023-09-11 03:36:50 +0200 | [diff] [blame] | 125 | module.group.startsWith("org.jetbrains") -> true |
| 126 | module.group == "com.google.auto.value" -> true |
| 127 | module.group == "com.google.guava" -> true |
| 128 | module.group == "junit" -> true |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 129 | else -> false |
| 130 | } |
| 131 | } |
LuK1337 | 26b7902 | 2022-09-05 23:32:37 +0200 | [diff] [blame] | 132 | } |