taler-android

Android apps for GNU Taler (wallet, PoS, cashier)
Log | Files | Refs | README | LICENSE

build.gradle (5160B)


      1 import groovy.json.JsonOutput
      2 
      3 plugins {
      4     id 'com.android.application'
      5     id 'kotlin-android'
      6     id 'kotlinx-serialization'
      7     id 'org.jlleitschuh.gradle.ktlint' version '14.2.0'
      8     id "org.jetbrains.kotlin.plugin.compose" version "$kotlin_version"
      9 }
     10 
     11 ktlint {
     12     version = '1.8.0'
     13     filter {
     14         exclude '**/build/**'
     15     }
     16 }
     17 
     18 apply from: 'formatting.gradle'
     19 
     20 tasks.withType(org.jlleitschuh.gradle.ktlint.tasks.KtLintFormatTask).configureEach {
     21     dependsOn 'formatKotlinLayout'
     22 }
     23 
     24 repositories {
     25     maven {
     26         url 'https://maven.sumup.com/releases'
     27         content {
     28             includeGroupByRegex 'com\\.sumup(\\..*)?'
     29             includeGroup 'net.sf.smc'
     30         }
     31     }
     32 }
     33 
     34 def localAffiliateKey = providers.fileContents(rootProject.layout.projectDirectory.file('.env'))
     35     .asText.orElse('').map { content ->
     36         def entry = content.readLines().find { it ==~ /\s*(?:export\s+)?SUMUP_AFFILIATE_KEY\s*=.*/ }
     37         if (entry == null) return ''
     38         def match = entry =~ /\s*(?:export\s+)?SUMUP_AFFILIATE_KEY\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s#]*))\s*(?:#.*)?/
     39         if (!match.matches()) throw new GradleException('Invalid SUMUP_AFFILIATE_KEY entry in .env')
     40         return match[0][1] ?: match[0][2] ?: match[0][3] ?: ''
     41     }
     42 def sumupAffiliateKey = providers.environmentVariable('SUMUP_AFFILIATE_KEY')
     43     .orElse(localAffiliateKey).get()
     44 
     45 android {
     46     namespace 'net.taler.merchantpos'
     47     compileSdkVersion 37
     48 
     49     defaultConfig {
     50         applicationId "net.taler.merchantpos"
     51         minSdkVersion 26
     52         targetSdkVersion 37
     53         versionCode 30
     54         versionName "1.7.0"
     55         testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
     56 
     57         buildConfigField("String", "BACKEND_API_VERSION", "\"20:0:8\"")
     58         buildConfigField('String', 'SUMUP_AFFILIATE_KEY', JsonOutput.toJson(sumupAffiliateKey))
     59     }
     60 
     61     testBuildType "sim"
     62 
     63     buildTypes {
     64         release {
     65             minifyEnabled true
     66             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
     67         }
     68         debug {
     69             minifyEnabled minify_debug
     70             proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
     71         }
     72         sim {
     73             initWith debug
     74             signingConfig signingConfigs.debug
     75             minifyEnabled false
     76             enableAndroidTestCoverage true
     77             enableUnitTestCoverage true
     78             matchingFallbacks = ['debug']
     79         }
     80     }
     81 
     82     compileOptions {
     83         coreLibraryDesugaringEnabled true
     84         sourceCompatibility = JavaVersion.VERSION_17
     85         targetCompatibility = JavaVersion.VERSION_17
     86     }
     87 
     88     kotlinOptions {
     89         jvmTarget = "17"
     90     }
     91 
     92     buildFeatures {
     93         buildConfig = true
     94         compose = true
     95     }
     96 
     97     testOptions {
     98         unitTests {
     99             includeAndroidResources = true
    100         }
    101     }
    102     packagingOptions {
    103         resources {
    104             excludes += ['META-INF/common.kotlin_module', 'META-INF/*.kotlin_module']
    105         }
    106     }
    107 
    108     lint {
    109         abortOnError true
    110         disable 'WrongConstant'
    111         ignoreWarnings false
    112     }
    113 }
    114 
    115 dependencies {
    116     coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.5'
    117     implementation 'com.sumup:merchant-sdk:7.1.0'
    118     implementation project(":merchant-lib")
    119     implementation project(":taler-kotlin-android")
    120 
    121     implementation "com.google.android.material:material:$material_version"
    122     implementation "androidx.constraintlayout:constraintlayout:$constraintlayout_version"
    123     implementation platform('androidx.compose:compose-bom:2026.06.01')
    124     implementation 'androidx.compose.material3:material3'
    125     implementation 'androidx.compose.material:material-icons-extended'
    126     implementation 'androidx.compose.ui:ui'
    127     implementation 'androidx.compose.ui:ui-tooling-preview'
    128     implementation "androidx.compose.runtime:runtime-livedata"
    129     implementation 'androidx.activity:activity-compose:1.13.0'
    130     implementation "androidx.navigation:navigation-compose:$nav_version"
    131     implementation "androidx.fragment:fragment-ktx:1.9.0"
    132     implementation "androidx.recyclerview:recyclerview:1.4.0"
    133     implementation "androidx.recyclerview:recyclerview-selection:1.2.0"
    134 
    135     // CameraX
    136     implementation "androidx.camera:camera-camera2:1.6.2"
    137     implementation "androidx.camera:camera-lifecycle:1.6.2"
    138     implementation "androidx.camera:camera-view:1.6.2"
    139 
    140     // ZXING core – on-device barcode/QR detector
    141     implementation "com.google.zxing:core:3.5.4"
    142 
    143     implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0"
    144 
    145     testImplementation 'androidx.test.ext:junit:1.3.0'
    146     testImplementation 'org.robolectric:robolectric:4.16.1'
    147 
    148     debugImplementation 'androidx.compose.ui:ui-tooling'
    149     simImplementation 'androidx.compose.ui:ui-tooling'
    150 
    151     // Only the "sim" build type has instrumented tests; see
    152     // src/androidTestSim and tests/pos-simulator/README.md.
    153     androidTestSimImplementation 'junit:junit:4.13.2'
    154     androidTestSimImplementation 'androidx.test:runner:1.7.0'
    155     androidTestSimImplementation 'androidx.test.ext:junit:1.3.0'
    156 }