blob: de036791ae6d4a473f25899458aa8381e4c00514 [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 {
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
LuK13379c4638c2022-09-05 13:37:03 +020029android {
30 compileSdk = 33
31
32 defaultConfig {
Sebastiano Barezzif5a9a782022-11-07 01:06:37 +010033 applicationId = "org.lineageos.aperture"
Sebastiano Barezzid11139c2022-10-30 16:37:13 +010034 minSdk = 26
LuK13379c4638c2022-09-05 13:37:03 +020035 targetSdk = 33
36 versionCode = 1
37 versionName = "1.0"
LuK13379c4638c2022-09-05 13:37:03 +020038 }
39
40 buildTypes {
Sebastiano Barezzif0b46402022-11-07 01:05:51 +010041 getByName("release") {
LuK13379c4638c2022-09-05 13:37:03 +020042 // 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 Barezzif5a9a782022-11-07 01:06:37 +010056 getByName("debug") {
57 // Append .dev to package name so we won't conflict with AOSP build.
58 applicationIdSuffix = ".dev"
59 }
LuK13379c4638c2022-09-05 13:37:03 +020060 }
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
72dependencies {
LuK133700ac9b12023-01-25 20:14:54 +010073 // Align versions of all Kotlin components
74 implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))
75
LuK13374ca40602023-05-24 20:34:45 +020076 implementation("androidx.core:core-ktx:1.10.1")
Sebastiano Barezzi1a512eb2023-06-22 23:20:38 +020077 implementation("androidx.activity:activity-ktx:1.7.2")
LuK13376d39d8a2023-02-22 20:30:20 +010078 implementation("androidx.appcompat:appcompat:1.6.1")
LuK13379c4638c2022-09-05 13:37:03 +020079 implementation("androidx.constraintlayout:constraintlayout:2.1.4")
Tommy Webb636f2252023-01-27 13:33:42 -050080 implementation("androidx.exifinterface:exifinterface:1.3.6")
LuK13374ca40602023-05-24 20:34:45 +020081 implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1")
LuK1337afc94a32022-09-05 23:30:33 +020082 implementation("androidx.preference:preference:1.2.0")
LuK1337bc3d67a2023-06-04 19:54:31 +020083 implementation("com.google.android.material:material:1.9.0")
LuK13379c4638c2022-09-05 13:37:03 +020084
85 // CameraX core library using the camera2 implementation
LuK1337a75c7d42023-08-24 16:23:52 +020086 val cameraxVersion = "1.3.0-rc01"
LuK13379c4638c2022-09-05 13:37:03 +020087 // 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 Barezzi6b71eb52022-11-10 00:05:27 +010099 // Media3
Sebastiano Barezzideb87662023-08-24 14:40:48 +0200100 val media3Version = "1.1.1"
Sebastiano Barezzi6b71eb52022-11-10 00:05:27 +0100101 // 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
LuK13379c4638c2022-09-05 13:37:03 +0200106 // ZXing
LuK133745a66902023-09-17 12:50:34 +0200107 implementation("com.google.zxing:core:3.5.2")
LuK13379c4638c2022-09-05 13:37:03 +0200108
109 // Coil
LuK13375c420fa2022-10-10 13:22:45 +0200110 implementation("io.coil-kt:coil:2.2.2")
111 implementation("io.coil-kt:coil-video:2.2.2")
LuK13379c4638c2022-09-05 13:37:03 +0200112}
LuK133726b79022022-09-05 23:32:37 +0200113
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200114configure<GenerateBpPluginExtension> {
115 targetSdk.set(android.defaultConfig.targetSdk!!)
116 availableInAOSP.set { module: Module ->
LuK133726b79022022-09-05 23:32:37 +0200117 when {
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200118 module.group.startsWith("androidx") -> {
Sebastiano Barezzi6b71eb52022-11-10 00:05:27 +0100119 // We provide our own androidx.{camera,media3} & lifecycle-common
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200120 !module.group.startsWith("androidx.camera") &&
121 !module.group.startsWith("androidx.media3") &&
122 module.name != "lifecycle-common"
LuK133726b79022022-09-05 23:32:37 +0200123 }
Sebastiano Barezzi7fccb002023-09-11 03:36:50 +0200124 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
LuK133726b79022022-09-05 23:32:37 +0200128 else -> false
129 }
130 }
LuK133726b79022022-09-05 23:32:37 +0200131}