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