build.gradle (7633B)
1 /* 2 * This file is part of GNU Taler 3 * (C) 2020 Taler Systems S.A. 4 * 5 * GNU Taler is free software; you can redistribute it and/or modify it under the 6 * terms of the GNU General Public License as published by the Free Software 7 * Foundation; either version 3, or (at your option) any later version. 8 * 9 * GNU Taler is distributed in the hope that it will be useful, but WITHOUT ANY 10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 11 * A PARTICULAR PURPOSE. See the GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License along with 14 * GNU Taler; see the file COPYING. If not, see <http://www.gnu.org/licenses/> 15 */ 16 17 import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 18 19 plugins { 20 id "com.android.application" 21 id "kotlin-android" 22 id "kotlinx-serialization" 23 id "com.google.protobuf" version "$protobuf_version" 24 id "org.jetbrains.kotlin.plugin.compose" version "$kotlin_version" 25 } 26 27 def qtart_version = "1.5.12" 28 29 static def versionCodeEpoch() { 30 return (new Date().getTime() / 1000).toInteger() 31 } 32 33 def gitCommit = { -> 34 return 'git rev-parse --short=7 HEAD'.execute().text.trim() 35 } 36 37 android { 38 namespace 'net.taler.wallet' 39 compileSdkVersion 37 40 41 defaultConfig { 42 applicationId "net.taler.wallet" 43 minSdkVersion 24 44 targetSdkVersion 37 45 versionCode 81 46 versionName "1.5.0" 47 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 48 } 49 buildTypes { 50 release { 51 minifyEnabled true 52 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 53 } 54 debug { 55 minifyEnabled minify_debug 56 proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' 57 applicationIdSuffix ".debug" 58 } 59 } 60 flavorDimensions = ["distributionChannel"] 61 productFlavors { 62 fdroid { 63 dimension "distributionChannel" 64 applicationIdSuffix ".fdroid" 65 // version codes get multiplied by 10 and an ABI suffix gets added to the code 66 // if 'splitApk' property is set 67 } 68 google { 69 dimension "distributionChannel" 70 } 71 nightly { 72 dimension "distributionChannel" 73 applicationIdSuffix ".nightly" 74 versionCode versionCodeEpoch() 75 versionNameSuffix " ($gitCommit)" 76 } 77 } 78 79 compileOptions { 80 sourceCompatibility = JavaVersion.VERSION_17 81 targetCompatibility = JavaVersion.VERSION_17 82 83 // Flag to enable support for the new language APIs for zxing 84 coreLibraryDesugaringEnabled true 85 } 86 87 kotlinOptions { 88 jvmTarget = "17" 89 } 90 91 buildFeatures { 92 buildConfig true 93 viewBinding true 94 } 95 packagingOptions { 96 jniLibs { 97 keepDebugSymbols += ['**/*.so'] 98 useLegacyPackaging true 99 } 100 resources { 101 excludes += ['META-INF/*.kotlin_module'] 102 } 103 } 104 splits { 105 abi { 106 // can not be defined per flavor, so we use a property to turn this on for F-Droid 107 enable project.hasProperty('splitApk') 108 reset() // Resets the list of ABIs to remove all included by default 109 include "armeabi-v7a", "arm64-v8a", "x86", "x86_64" 110 universalApk false 111 } 112 } 113 114 lint { 115 abortOnError true 116 ignoreWarnings false 117 } 118 } 119 120 dependencies { 121 implementation project(":taler-kotlin-android") 122 123 implementation "net.taler:qtart:$qtart_version@aar" 124 125 implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" 126 127 implementation 'androidx.preference:preference-ktx:1.2.1' 128 implementation "com.google.android.material:material:$material_version" 129 implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" 130 implementation "androidx.browser:browser:1.10.0" 131 implementation "androidx.biometric:biometric-ktx:1.4.0-alpha02" 132 133 // Compose 134 implementation platform('androidx.compose:compose-bom:2026.04.01') 135 implementation 'androidx.compose.material3:material3' 136 implementation 'androidx.compose.material:material-icons-extended' 137 implementation "androidx.compose.runtime:runtime-livedata" 138 implementation "androidx.lifecycle:lifecycle-viewmodel-compose" 139 implementation "com.google.accompanist:accompanist-themeadapter-material3:0.36.0" 140 implementation 'androidx.activity:activity-compose:1.13.0' 141 implementation 'androidx.compose.ui:ui-tooling-preview' 142 implementation 'androidx.compose.ui:ui-viewbinding' 143 implementation "androidx.fragment:fragment-compose:1.8.9" 144 debugImplementation 'androidx.compose.ui:ui-tooling' 145 146 // Lists and Selection 147 implementation "androidx.recyclerview:recyclerview:1.4.0" 148 implementation "androidx.recyclerview:recyclerview-selection:1.2.0" 149 150 // Navigation Library 151 implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" 152 implementation "androidx.navigation:navigation-ui-ktx:$nav_version" 153 implementation "androidx.navigation:navigation-compose:$nav_version" 154 155 // ViewModel and LiveData 156 implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" 157 158 // QR codes 159 implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar' 160 // needed to support zxing library in taler-kotlin-android on API < 24 161 coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' 162 163 // Nicer ProgressBar 164 implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1' 165 166 // Markdown rendering 167 final def markdown_version = "0.39.2" 168 implementation("com.mikepenz:multiplatform-markdown-renderer:$markdown_version") 169 implementation("com.mikepenz:multiplatform-markdown-renderer-m3:$markdown_version") 170 171 // Java Native Access (must always match JNA in qtart) 172 implementation "net.java.dev.jna:jna:5.18.1@aar" 173 174 // Shared preferences 175 implementation "androidx.datastore:datastore:$datastore_version" 176 implementation "com.google.protobuf:protobuf-javalite:4.34.1" 177 178 testImplementation "junit:junit:$junit_version" 179 testImplementation 'org.json:json:20251224' 180 } 181 182 tasks.withType(KotlinCompile).configureEach { 183 compilerOptions { 184 freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") 185 } 186 } 187 188 // Map for the version code that gives each ABI a value. 189 ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3, x86_64: 4] 190 // For each APK output variant, override versionCode with a combination of ext.abiCodes + variant.versionCode. 191 android.applicationVariants.configureEach { variant -> 192 // Assigns a different version code for each output APK 193 variant.outputs.each { output -> 194 // Stores the value of ext.abiCodes that is associated with the ABI for this variant. 195 def baseAbiVersionCode = 196 // Determines the ABI for this variant and returns the mapped value. 197 project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI)) 198 if (baseAbiVersionCode != null) { 199 output.versionCodeOverride = 10 * variant.versionCode + baseAbiVersionCode 200 } 201 // leaves version code alone of there's no baseAbiVersionCode 202 } 203 } 204 205 protobuf { 206 protoc { 207 artifact = "com.google.protobuf:protoc:4.28.3" 208 } 209 210 generateProtoTasks { 211 all().each { task -> 212 task.builtins { 213 java { 214 option 'lite' 215 } 216 } 217 } 218 } 219 }