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