11@file:Suppress(" UnstableApiUsage" )
22
3- import com.android.build.gradle.internal.tasks.factory.dependsOn
4- import java.util.Properties
53import org.gradle.configurationcache.extensions.capitalized
64
75plugins {
6+ id(" com.osfans.trime.native-app-convention" )
87 id(" com.osfans.trime.data-checksums" )
9- alias(libs.plugins.android.application)
108 alias(libs.plugins.aboutlibraries)
119 alias(libs.plugins.kotlin.android)
1210 alias(libs.plugins.kotlin.serialization)
@@ -17,7 +15,6 @@ android {
1715 namespace = " com.osfans.trime"
1816 compileSdk = 34
1917 buildToolsVersion = " 34.0.0"
20- ndkVersion = " 25.2.9519653"
2118
2219 defaultConfig {
2320 applicationId = " com.osfans.trime"
@@ -35,26 +32,20 @@ android {
3532 buildConfigField(" String" , " BUILD_VERSION_NAME" , " \" ${project.buildVersionName} \" " )
3633 }
3734
38- signingConfigs {
39- create(" release" ) {
40- val keyPropFile = rootProject.file(" keystore.properties" )
41- if (keyPropFile.exists()) {
42- val props = Properties ()
43- props.load(keyPropFile.inputStream())
44-
45- storeFile = rootProject.file(props[" storeFile" ]!! )
46- storePassword = props[" storePassword" ] as ? String
47- keyAlias = props[" keyAlias" ] as ? String
48- keyPassword = props[" keyPassword" ] as ? String
49- }
50- }
51- }
52-
5335 buildTypes {
5436 release {
5537 isMinifyEnabled = false
5638 // proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-android.txt"
57- signingConfig = signingConfigs.getByName(" release" )
39+ signingConfig = with (ApkRelease ) {
40+ if (project.buildApkRelease) {
41+ signingConfigs.create(" release" ) {
42+ storeFile = file(project.storeFile!! )
43+ storePassword = project.storePassword
44+ keyAlias = project.keyAlias
45+ keyPassword = project.keyPassword
46+ }
47+ } else null
48+ }
5849
5950 resValue(" string" , " trime_app_name" , " @string/app_name_release" )
6051 }
@@ -65,17 +56,6 @@ android {
6556 }
6657 }
6758
68- // Use prebuilt JNI library if the "app/prebuilt" exists
69- //
70- // Steps to generate the prebuilt directory:
71- // $ ./gradlew app:assembleRelease
72- // $ cp --recursive app/build/intermediates/stripped_native_libs/universalRelease/out/lib app/prebuilt
73- if (file(" prebuilt" ).exists()) {
74- sourceSets.getByName(" main" ).jniLibs.srcDirs(setOf (" prebuilt" ))
75- } else {
76- externalNativeBuild.cmake.path(" src/main/jni/CMakeLists.txt" )
77- }
78-
7959 buildFeatures {
8060 buildConfig = true
8161 viewBinding = true
@@ -95,32 +75,6 @@ android {
9575 checkReleaseBuilds = false
9676 }
9777
98- externalNativeBuild {
99- cmake {
100- version = " 3.22.1"
101- }
102- }
103-
104- splits {
105- // Configures multiple APKs based on ABI.
106- abi {
107- // Enables building multiple APKs per ABI.
108- isEnable = true
109-
110- // By default all ABIs are included, so use reset() and include to specify that we only
111- // want APKs for x86 and x86_64.
112-
113- // Resets the list of ABIs that Gradle should create APKs for to none.
114- reset()
115-
116- // Specifies a list of ABIs that Gradle should create APKs for.
117- include(" x86" , " x86_64" , " armeabi-v7a" , " arm64-v8a" )
118-
119- // Specifies that we do not want to also generate a universal APK that includes all ABIs.
120- isUniversalApk = false
121- }
122- }
123-
12478 testOptions {
12579 unitTests.all {
12680 it.useJUnitPlatform()
@@ -153,10 +107,6 @@ android.applicationVariants.all {
153107 }
154108}
155109
156- tasks.register<Delete >(" cleanCxxIntermediates" ) {
157- delete(file(" .cxx" ))
158- }.also { tasks.clean.dependsOn(it) }
159-
160110dependencies {
161111 ksp(project(" :codegen" ))
162112 implementation(libs.kotlinx.coroutines)
0 commit comments