| 1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget |
1 | import org.jetbrains.kotlin.gradle.dsl.JvmTarget |
| 2 | 2 | ||
| 3 | plugins { |
3 | plugins { |
| 4 | alias(libs.plugins.android.application) |
4 | alias(libs.plugins.android.application) |
| 5 | – alias(libs.plugins.kotlin.android) |
||
| 6 | – alias(libs.plugins.kotlin.compose) |
||
| 7 | } |
5 | } |
| 8 | 6 | ||
| 9 | android { |
7 | android { |
| 10 | dependenciesInfo { |
8 | dependenciesInfo { |
| 11 | includeInApk = false |
9 | includeInApk = false |
| 12 | includeInBundle = false |
10 | includeInBundle = false |
| 13 | } |
11 | } |
| 14 | 12 | ||
| 15 | namespace = "com.boxlabs.hexdroid" |
13 | namespace = "com.boxlabs.hexdroid" |
| 16 | compileSdk = 36 |
14 | compileSdk = 36 |
| 17 | 15 | ||
| 18 | defaultConfig { |
16 | defaultConfig { |
| 19 | applicationId = "com.boxlabs.hexdroid" |
17 | applicationId = "com.boxlabs.hexdroid" |
| 20 | minSdk = 26 |
18 | minSdk = 26 |
| 21 | targetSdk = 36 |
19 | targetSdk = 36 |
| 22 | versionCode = 10 |
20 | versionCode = 10 |
| 23 | versionName = "1.5.5" |
21 | versionName = "1.5.5" |
| 24 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
22 | testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" |
| 25 | } |
23 | } |
| 26 | 24 | ||
| 27 | signingConfigs { |
25 | signingConfigs { |
| 28 | create("release") { |
26 | create("release") { |
| 29 | val ksFile = System.getenv("KEYSTORE_FILE") |
27 | val ksFile = System.getenv("KEYSTORE_FILE") |
| 30 | if (ksFile != null && file(ksFile).exists()) { |
28 | if (ksFile != null && file(ksFile).exists()) { |
| 31 | storeFile = file(ksFile) |
29 | storeFile = file(ksFile) |
| 32 | storePassword = System.getenv("KEYSTORE_PASSWORD") |
30 | storePassword = System.getenv("KEYSTORE_PASSWORD") |
| 33 | keyAlias = System.getenv("KEY_ALIAS") |
31 | keyAlias = System.getenv("KEY_ALIAS") |
| 34 | keyPassword = System.getenv("KEY_PASSWORD") |
32 | keyPassword = System.getenv("KEY_PASSWORD") |
| 35 | } |
33 | } |
| 36 | } |
34 | } |
| 37 | } |
35 | } |
| 38 | 36 | ||
| 39 | buildTypes { |
37 | buildTypes { |
| 40 | getByName("release") { |
38 | getByName("release") { |
| 41 | isMinifyEnabled = true |
39 | isMinifyEnabled = true |
| 42 | isShrinkResources = true |
40 | isShrinkResources = true |
| 43 | proguardFiles( |
41 | proguardFiles( |
| 44 | getDefaultProguardFile("proguard-android-optimize.txt"), |
42 | getDefaultProguardFile("proguard-android-optimize.txt"), |
| 45 | "proguard-rules.pro" |
43 | "proguard-rules.pro" |
| 46 | ) |
44 | ) |
| 47 | val ksFile = System.getenv("KEYSTORE_FILE") |
45 | val ksFile = System.getenv("KEYSTORE_FILE") |
| 48 | signingConfig = if (ksFile != null && file(ksFile).exists()) { |
46 | signingConfig = if (ksFile != null && file(ksFile).exists()) { |
| 49 | signingConfigs.getByName("release") |
47 | signingConfigs.getByName("release") |
| 50 | } else { |
48 | } else { |
| 51 | signingConfigs.getByName("debug") |
49 | signingConfigs.getByName("debug") |
| 52 | } |
50 | } |
| 53 | } |
51 | } |
| 54 | } |
52 | } |
| 55 | 53 | ||
| 56 | compileOptions { |
54 | compileOptions { |
| 57 | sourceCompatibility = JavaVersion.VERSION_11 |
55 | sourceCompatibility = JavaVersion.VERSION_11 |
| 58 | targetCompatibility = JavaVersion.VERSION_11 |
56 | targetCompatibility = JavaVersion.VERSION_11 |
| 59 | } |
57 | } |
| 60 | 58 | ||
| 61 | buildFeatures { |
59 | buildFeatures { |
| 62 | buildConfig = true |
60 | buildConfig = true |
| 63 | compose = true |
61 | compose = true |
| 64 | } |
62 | } |
| 65 | 63 | ||
| 66 | // Reproducible builds: disable non-deterministic PNG crunching |
64 | // Reproducible builds: disable non-deterministic PNG crunching |
| 67 | androidResources { |
65 | androidResources { |
| 68 | noCompress += "png" |
66 | noCompress += "png" |
| 69 | } |
67 | } |
| 70 | 68 | ||
| 71 | packaging { |
69 | packaging { |
| 72 | resources { |
70 | resources { |
| 73 | // Exclude non-deterministic VCS info (AGP 8.3+) |
71 | // Exclude non-deterministic VCS info (AGP 8.3+) |
| 74 | excludes += "META-INF/version-control-info.textproto" |
72 | excludes += "META-INF/version-control-info.textproto" |
| 75 | } |
73 | } |
| 76 | } |
74 | } |
| 77 | 75 | ||
| 78 | } |
76 | } |
| 79 | 77 | ||
| 80 | –// Kotlin 2.0+ |
78 | +// AGP 9.0+ built in kotlin conf |
| 81 | kotlin { |
79 | kotlin { |
| 82 | compilerOptions { |
80 | compilerOptions { |
| 83 | jvmTarget.set(JvmTarget.JVM_11) |
81 | jvmTarget.set(JvmTarget.JVM_11) |
| 84 | } |
82 | } |
| 85 | } |
83 | } |
| 86 | 84 | ||
| 87 | dependencies { |
85 | dependencies { |
| 88 | implementation(libs.androidx.core.ktx) |
86 | implementation(libs.androidx.core.ktx) |
| 89 | implementation(libs.androidx.lifecycle.runtime.ktx) |
87 | implementation(libs.androidx.lifecycle.runtime.ktx) |
| 90 | implementation(libs.androidx.lifecycle.runtime.compose) |
88 | implementation(libs.androidx.lifecycle.runtime.compose) |
| 91 | implementation(libs.androidx.lifecycle.viewmodel.compose) |
89 | implementation(libs.androidx.lifecycle.viewmodel.compose) |
| 92 | implementation(libs.androidx.activity.compose) |
90 | implementation(libs.androidx.activity.compose) |
| 93 | implementation(platform(libs.androidx.compose.bom)) |
91 | implementation(platform(libs.androidx.compose.bom)) |
| 94 | implementation(libs.androidx.compose.ui) |
92 | implementation(libs.androidx.compose.ui) |
| 95 | implementation(libs.androidx.compose.ui.graphics) |
93 | implementation(libs.androidx.compose.ui.graphics) |
| 96 | implementation(libs.androidx.compose.ui.tooling.preview) |
94 | implementation(libs.androidx.compose.ui.tooling.preview) |
| 97 | implementation(libs.androidx.compose.material3) |
95 | implementation(libs.androidx.compose.material3) |
| 98 | implementation(libs.androidx.compose.foundation) |
96 | implementation(libs.androidx.compose.foundation) |
| 99 | implementation(libs.androidx.compose.material.icons.extended) |
97 | implementation(libs.androidx.compose.material.icons.extended) |
| 100 | implementation(libs.kotlinx.coroutines.android) |
98 | implementation(libs.kotlinx.coroutines.android) |
| 101 | implementation(libs.androidx.datastore.preferences) |
99 | implementation(libs.androidx.datastore.preferences) |
| 102 | testImplementation(libs.junit) |
100 | testImplementation(libs.junit) |
| 103 | androidTestImplementation(libs.androidx.junit) |
101 | androidTestImplementation(libs.androidx.junit) |
| 104 | androidTestImplementation(libs.androidx.espresso.core) |
102 | androidTestImplementation(libs.androidx.espresso.core) |
| 105 | androidTestImplementation(platform(libs.androidx.compose.bom)) |
103 | androidTestImplementation(platform(libs.androidx.compose.bom)) |
| 106 | androidTestImplementation(libs.androidx.compose.ui.test.junit4) |
104 | androidTestImplementation(libs.androidx.compose.ui.test.junit4) |
| 107 | debugImplementation(libs.androidx.compose.ui.tooling) |
105 | debugImplementation(libs.androidx.compose.ui.tooling) |
| 108 | debugImplementation(libs.androidx.compose.ui.test.manifest) |
106 | debugImplementation(libs.androidx.compose.ui.test.manifest) |
| 109 | } |
107 | } |