build.gradle (7523B)
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.3.13" 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 36 40 41 defaultConfig { 42 applicationId "net.taler.wallet" 43 minSdkVersion 24 44 targetSdkVersion 36 45 versionCode 77 46 versionName "1.4.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 } 99 resources { 100 excludes += ['META-INF/*.kotlin_module'] 101 } 102 } 103 splits { 104 abi { 105 // can not be defined per flavor, so we use a property to turn this on for F-Droid 106 enable project.hasProperty('splitApk') 107 reset() // Resets the list of ABIs to remove all included by default 108 include "armeabi-v7a", "arm64-v8a", "x86", "x86_64" 109 universalApk false 110 } 111 } 112 113 lint { 114 abortOnError true 115 ignoreWarnings false 116 } 117 } 118 119 dependencies { 120 implementation project(":taler-kotlin-android") 121 122 implementation "net.taler:qtart:$qtart_version@aar" 123 124 implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" 125 126 implementation 'androidx.preference:preference-ktx:1.2.1' 127 implementation "com.google.android.material:material:$material_version" 128 implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version" 129 implementation "androidx.browser:browser:1.9.0" 130 implementation "androidx.biometric:biometric-ktx:1.4.0-alpha02" 131 132 // Compose 133 implementation platform('androidx.compose:compose-bom:2026.02.00') 134 implementation 'androidx.compose.material3:material3' 135 implementation 'androidx.compose.material:material-icons-extended' 136 implementation "androidx.compose.runtime:runtime-livedata" 137 implementation "androidx.lifecycle:lifecycle-viewmodel-compose" 138 implementation "com.google.accompanist:accompanist-themeadapter-material3:0.36.0" 139 implementation 'androidx.activity:activity-compose:1.12.4' 140 implementation 'androidx.compose.ui:ui-tooling-preview' 141 implementation 'androidx.compose.ui:ui-viewbinding' 142 implementation "androidx.fragment:fragment-compose:1.8.9" 143 debugImplementation 'androidx.compose.ui:ui-tooling' 144 145 // Lists and Selection 146 implementation "androidx.recyclerview:recyclerview:1.4.0" 147 implementation "androidx.recyclerview:recyclerview-selection:1.2.0" 148 149 // Navigation Library 150 implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" 151 implementation "androidx.navigation:navigation-ui-ktx:$nav_version" 152 153 // ViewModel and LiveData 154 implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" 155 156 // QR codes 157 implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar' 158 // needed to support zxing library in taler-kotlin-android on API < 24 159 coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5' 160 161 // Nicer ProgressBar 162 implementation 'me.zhanghai.android.materialprogressbar:library:1.6.1' 163 164 // Markdown rendering 165 final def markdown_version = "0.39.2" 166 implementation("com.mikepenz:multiplatform-markdown-renderer:$markdown_version") 167 implementation("com.mikepenz:multiplatform-markdown-renderer-m3:$markdown_version") 168 169 // Java Native Access (must always match JNA in qtart) 170 implementation "net.java.dev.jna:jna:5.17.0@aar" 171 172 // Shared preferences 173 implementation "androidx.datastore:datastore:$datastore_version" 174 implementation "com.google.protobuf:protobuf-javalite:4.33.5" 175 176 testImplementation "junit:junit:$junit_version" 177 testImplementation 'org.json:json:20251224' 178 } 179 180 tasks.withType(KotlinCompile).configureEach { 181 compilerOptions { 182 freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn") 183 } 184 } 185 186 // Map for the version code that gives each ABI a value. 187 ext.abiCodes = ['armeabi-v7a': 1, 'arm64-v8a': 2, x86: 3, x86_64: 4] 188 // For each APK output variant, override versionCode with a combination of ext.abiCodes + variant.versionCode. 189 android.applicationVariants.configureEach { variant -> 190 // Assigns a different version code for each output APK 191 variant.outputs.each { output -> 192 // Stores the value of ext.abiCodes that is associated with the ABI for this variant. 193 def baseAbiVersionCode = 194 // Determines the ABI for this variant and returns the mapped value. 195 project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI)) 196 if (baseAbiVersionCode != null) { 197 output.versionCodeOverride = 10 * variant.versionCode + baseAbiVersionCode 198 } 199 // leaves version code alone of there's no baseAbiVersionCode 200 } 201 } 202 203 protobuf { 204 protoc { 205 artifact = "com.google.protobuf:protoc:4.28.3" 206 } 207 208 generateProtoTasks { 209 all().each { task -> 210 task.builtins { 211 java { 212 option 'lite' 213 } 214 } 215 } 216 } 217 }