Abrarul8541 commited on
Commit
784ce55
·
verified ·
1 Parent(s): a04c495

Build: release signing, test options, instrumented tests, fragment dep

Browse files
Files changed (1) hide show
  1. app/build.gradle.kts +20 -0
app/build.gradle.kts CHANGED
@@ -5,6 +5,8 @@ plugins {
5
  id("com.google.devtools.ksp")
6
  }
7
 
 
 
8
  android {
9
  namespace = "io.github.abrarul.modularai"
10
  compileSdk = 34
@@ -16,6 +18,7 @@ android {
16
  targetSdk = 34
17
  versionCode = 1
18
  versionName = "0.1.0"
 
19
  ndk { abiFilters += listOf("arm64-v8a") }
20
  externalNativeBuild {
21
  cmake {
@@ -29,11 +32,24 @@ android {
29
  cmake { path = file("src/main/cpp/CMakeLists.txt") }
30
  }
31
 
 
 
 
 
 
 
 
 
 
 
 
32
  buildTypes {
33
  release {
34
  isMinifyEnabled = true
35
  isShrinkResources = true
36
  proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
 
 
37
  }
38
  }
39
  compileOptions {
@@ -50,12 +66,14 @@ android {
50
  // proot must exist as real files in nativeLibraryDir to be executable on Android 10+
51
  jniLibs.useLegacyPackaging = true
52
  }
 
53
  }
54
 
55
  dependencies {
56
  val composeBom = platform("androidx.compose:compose-bom:2024.09.00")
57
  implementation(composeBom)
58
  implementation("androidx.activity:activity-compose:1.9.2")
 
59
  implementation("androidx.compose.material3:material3")
60
  implementation("androidx.compose.ui:ui")
61
  implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6")
@@ -66,4 +84,6 @@ dependencies {
66
  ksp("androidx.room:room-compiler:2.6.1")
67
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
68
  testImplementation("junit:junit:4.13.2")
 
 
69
  }
 
5
  id("com.google.devtools.ksp")
6
  }
7
 
8
+ val ciKeystore: String? = System.getenv("KEYSTORE_PATH")
9
+
10
  android {
11
  namespace = "io.github.abrarul.modularai"
12
  compileSdk = 34
 
18
  targetSdk = 34
19
  versionCode = 1
20
  versionName = "0.1.0"
21
+ testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
22
  ndk { abiFilters += listOf("arm64-v8a") }
23
  externalNativeBuild {
24
  cmake {
 
32
  cmake { path = file("src/main/cpp/CMakeLists.txt") }
33
  }
34
 
35
+ signingConfigs {
36
+ create("release") {
37
+ if (ciKeystore != null) {
38
+ storeFile = file(ciKeystore)
39
+ storePassword = System.getenv("KEYSTORE_PASSWORD")
40
+ keyAlias = System.getenv("KEY_ALIAS")
41
+ keyPassword = System.getenv("KEY_PASSWORD")
42
+ }
43
+ }
44
+ }
45
+
46
  buildTypes {
47
  release {
48
  isMinifyEnabled = true
49
  isShrinkResources = true
50
  proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
51
+ // Real key when provided by CI secrets; otherwise the debug key so the APK is still installable.
52
+ signingConfig = if (ciKeystore != null) signingConfigs.getByName("release") else signingConfigs.getByName("debug")
53
  }
54
  }
55
  compileOptions {
 
66
  // proot must exist as real files in nativeLibraryDir to be executable on Android 10+
67
  jniLibs.useLegacyPackaging = true
68
  }
69
+ testOptions { unitTests.isReturnDefaultValues = true }
70
  }
71
 
72
  dependencies {
73
  val composeBom = platform("androidx.compose:compose-bom:2024.09.00")
74
  implementation(composeBom)
75
  implementation("androidx.activity:activity-compose:1.9.2")
76
+ implementation("androidx.fragment:fragment-ktx:1.8.3")
77
  implementation("androidx.compose.material3:material3")
78
  implementation("androidx.compose.ui:ui")
79
  implementation("androidx.lifecycle:lifecycle-viewmodel-compose:2.8.6")
 
84
  ksp("androidx.room:room-compiler:2.6.1")
85
  implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1")
86
  testImplementation("junit:junit:4.13.2")
87
+ androidTestImplementation("androidx.test.ext:junit:1.2.1")
88
+ androidTestImplementation("androidx.test:runner:1.6.2")
89
  }