plugins { id 'com.android.application' id 'io.sentry.android.gradle' // https://github.com/Triple-T/gradle-play-publisher/issues/947#issuecomment-843634852 id 'com.github.triplet.play' version '3.8.1' apply false id 'name.remal.default-plugins' } ext.rootPath = '../../' apply from: "$rootPath/version.gradle" android { compileSdk 34 namespace="com.tavultesoft.kmapro" // Don't compress kmp files so they can be copied via AssetManager aaptOptions { noCompress "kmp" } defaultConfig { applicationId "com.tavultesoft.kmapro" minSdkVersion 21 targetSdkVersion 34 //println "===DUMPING PROPERTIES===" //dumpProperties(project) // Use this to dump all external properties for debugging TeamCity integration //println "===END DUMP===" // VERSION strings from version.gradle versionCode VERSION_CODE as Integer versionName VERSION_NAME buildConfigField 'String', 'VERSION_ENVIRONMENT', '"'+VERSION_ENVIRONMENT+'"' buildConfigField 'String', 'VERSION_GIT_TAG', '"'+VERSION_GIT_TAG+'"' } String env_release_store_file = System.getenv("release_store_file") String env_release_store_password = System.getenv("release_store_password") String env_release_key_alias = System.getenv("release_key_alias") String env_release_key_password = System.getenv("release_key_password") if (env_release_store_file != null && file(env_release_store_file).exists()) { signingConfigs { release { println "Using signing from environment" storeFile file(String.valueOf(env_release_store_file)) storePassword env_release_store_password keyAlias env_release_key_alias keyPassword env_release_key_password } } } buildTypes { debug { applicationIdSuffix ".debug" pseudoLocalesEnabled true debuggable true } release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' if (env_release_store_file != null && file(env_release_store_file).exists()) { signingConfig signingConfigs.release } } } productFlavors { } applicationVariants.all { variant -> // Append tag to app name to help differentiate versions for app testers: // - stable builds have no suffix // - beta and alpha release builds have "Beta" and "Alpha" suffixes // - local builds (incl. from IDE) also have "-local" suffix // - PR builds also have "-test-1234" suffix (where 1234 is PR#) // Gradle sync will nullify these values, so have a fallback String appSuffix = '' String tag = VERSION_TAG ? VERSION_TAG : '-' + new File('../../TIER.md').getText('UTF-8'); if (tag.startsWithAny("-beta", "beta")) { appSuffix = ' Beta'; } else if (tag.startsWithAny("-alpha", "alpha")) { appSuffix = ' Alpha'; } def match = (tag =~ /.*(-test-\d+)$/); if (match.find()) { // -test-PR_NUMBER appSuffix = appSuffix + match.group(1) } else { String environment = VERSION_ENVIRONMENT ? VERSION_ENVIRONMENT : 'local'; if (environment.matches("local")) { appSuffix = appSuffix + '-' + environment; } } variant.resValue "string", "app_name", 'Keyman' + appSuffix; // Adjust output name to "keyman-${VERSION_MD}.apk" variant.outputs.all { outputFileName = "keyman-" + VERSION_MD + ".apk" } } lintOptions { disable 'MissingQuantity', 'MissingTranslation' lintConfig file("lint.xml") } } // how to configure the sentry android gradle plugin sentry { // Disables or enables the automatic configuration of Native symbols uploadNativeSymbols = true // Does or doesn't include the source code of native code for Sentry includeNativeSources = true } String env_keys_json_file = System.getenv("keys_json_file") if (env_keys_json_file != null && file(env_keys_json_file).exists()) { apply plugin: 'com.github.triplet.play' play { serviceAccountCredentials = file(String.valueOf(env_keys_json_file)) // Deactivate lower conflicting version APKs resolutionStrategy.set(com.github.triplet.gradle.androidpublisher.ResolutionStrategy.IGNORE) switch (System.env.TIER) { case 'beta': track.set("beta") println "TIER set to beta" break case 'stable': track.set("production") println "TIER set to production" break default: track.set("alpha") println "TIER set to alpha" } } } repositories { flatDir { dirs 'libs' } google() jcenter() } dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.6.0-rc01' implementation 'com.google.android.material:material:1.6.0' implementation 'com.stepstone.stepper:material-stepper:4.3.1' api(name: 'keyman-engine', ext: 'aar') implementation 'io.sentry:sentry-android:6.9.2' implementation 'androidx.preference:preference:1.2.0' implementation "com.android.installreferrer:installreferrer:2.2" // Add dependency for generating QR Codes // (Even though it's embedded in KMEA, because we're manually copying keyman-engine.aar, // we "lose" it in the dependency management) implementation ('com.github.kenglxn.QRGen:android:3.0.1') { transitive = true } } /*def void dumpProperties(it){ //println "Examining $it.name:" //println "Meta:" //println it.metaClass.metaMethods*.name.sort().unique() //println "Methods:" //println it.metaClass.methods*.name.sort().unique() //println "Depends On:" //println it.dependsOn.collect({it*.getName()}) println "Properties:" println it.properties.entrySet()*.toString() .sort().toString().replaceAll(", ","\n") }*/