blob: 95e7e6074fcf7f1278c479a12ea8e422934304de [file] [log] [blame]
Michael Bestasdd2506a2023-07-20 20:53:02 +03001/*
2 * SPDX-FileCopyrightText: 2022-2023 The LineageOS Project
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +02006import org.lineageos.generatebp.GenerateBpPlugin
7import org.lineageos.generatebp.GenerateBpPluginExtension
8import org.lineageos.generatebp.models.Module
LuK133726b79022022-09-05 23:32:37 +02009
LuK13379c4638c2022-09-05 13:37:03 +020010plugins {
11 id("com.android.application")
12 id("kotlin-android")
13}
14
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +020015apply {
16 plugin<GenerateBpPlugin>()
17}
18
19buildscript {
20 repositories {
LuK133748ecbae2023-10-10 16:22:54 +020021 maven("https://raw.githubusercontent.com/lineage-next/gradle-generatebp/v1.3/.m2")
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +020022 }
23
24 dependencies {
25 classpath("org.lineageos:gradle-generatebp:+")
26 }
27}
28
LuK13379c4638c2022-09-05 13:37:03 +020029android {
30 compileSdk = 33
Sebastiano Barezzi4bf39d52023-10-04 19:27:56 +020031 namespace = "org.lineageos.aperture"
LuK13379c4638c2022-09-05 13:37:03 +020032
33 defaultConfig {
Sebastiano Barezzif5a9a782022-11-07 01:06:37 +010034 applicationId = "org.lineageos.aperture"
Sebastiano Barezzid11139c2022-10-30 16:37:13 +010035 minSdk = 26
LuK13379c4638c2022-09-05 13:37:03 +020036 targetSdk = 33
37 versionCode = 1
38 versionName = "1.0"
LuK13379c4638c2022-09-05 13:37:03 +020039 }
40
41 buildTypes {
Sebastiano Barezzif0b46402022-11-07 01:05:51 +010042 getByName("release") {
LuK13379c4638c2022-09-05 13:37:03 +020043 // 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 Barezzif5a9a782022-11-07 01:06:37 +010057 getByName("debug") {
58 // Append .dev to package name so we won't conflict with AOSP build.
59 applicationIdSuffix = ".dev"
60 }
LuK13379c4638c2022-09-05 13:37:03 +020061 }
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
73dependencies {
LuK133700ac9b12023-01-25 20:14:54 +010074 // Align versions of all Kotlin components
75 implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
76
LuK13374ca40602023-05-24 20:34:45 +020077 implementation("androidx.core:core-ktx:1.10.1")
Sebastiano Barezzi1a512eb2023-06-22 23:20:38 +020078 implementation("androidx.activity:activity-ktx:1.7.2")
LuK13376d39d8a2023-02-22 20:30:20 +010079 implementation("androidx.appcompat:appcompat:1.6.1")
LuK13379c4638c2022-09-05 13:37:03 +020080 implementation("androidx.constraintlayout:constraintlayout:2.1.4")
Tommy Webb636f2252023-01-27 13:33:42 -050081 implementation("androidx.exifinterface:exifinterface:1.3.6")
LuK13374ca40602023-05-24 20:34:45 +020082 implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
LuK1337afc94a32022-09-05 23:30:33 +020083 implementation("androidx.preference:preference:1.2.0")
LuK1337bc3d67a2023-06-04 19:54:31 +020084 implementation("com.google.android.material:material:1.9.0")
LuK13379c4638c2022-09-05 13:37:03 +020085
86 // CameraX core library using the camera2 implementation
LuK13373006e8c2023-10-18 20:32:10 +020087 val cameraxVersion = "1.4.0-alpha02"
LuK13379c4638c2022-09-05 13:37:03 +020088 // 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 Barezzi6b71eb52022-11-10 00:05:27 +0100100 // Media3
Sebastiano Barezzideb87662023-08-24 14:40:48 +0200101 val media3Version = "1.1.1"
Sebastiano Barezzi6b71eb52022-11-10 00:05:27 +0100102 // 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
LuK13379c4638c2022-09-05 13:37:03 +0200107 // ZXing
LuK133745a66902023-09-17 12:50:34 +0200108 implementation("com.google.zxing:core:3.5.2")
LuK13379c4638c2022-09-05 13:37:03 +0200109
110 // Coil
LuK13375c420fa2022-10-10 13:22:45 +0200111 implementation("io.coil-kt:coil:2.2.2")
112 implementation("io.coil-kt:coil-video:2.2.2")
LuK13379c4638c2022-09-05 13:37:03 +0200113}
LuK133726b79022022-09-05 23:32:37 +0200114
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200115configure<GenerateBpPluginExtension> {
116 targetSdk.set(android.defaultConfig.targetSdk!!)
117 availableInAOSP.set { module: Module ->
LuK133726b79022022-09-05 23:32:37 +0200118 when {
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200119 module.group.startsWith("androidx") -> {
Sebastiano Barezzi6b71eb52022-11-10 00:05:27 +0100120 // We provide our own androidx.{camera,media3} & lifecycle-common
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200121 !module.group.startsWith("androidx.camera") &&
122 !module.group.startsWith("androidx.media3") &&
123 module.name != "lifecycle-common"
LuK133726b79022022-09-05 23:32:37 +0200124 }
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200125 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
LuK133726b79022022-09-05 23:32:37 +0200129 else -> false
130 }
131 }
LuK133726b79022022-09-05 23:32:37 +0200132}