mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-06 00:45:32 +00:00
200 lines
6.6 KiB
Groovy
200 lines
6.6 KiB
Groovy
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.9.1' apply false
|
|
id 'name.remal.default-plugins'
|
|
}
|
|
|
|
ext.rootPath = '../../'
|
|
apply from: "$rootPath/version.gradle"
|
|
|
|
String tier = new File('../../TIER.md').getText('UTF-8').trim();
|
|
|
|
java {
|
|
toolchain {
|
|
languageVersion = JavaLanguageVersion.of(21)
|
|
}
|
|
}
|
|
|
|
android {
|
|
compileSdk 35
|
|
namespace="com.tavultesoft.kmapro"
|
|
|
|
// Don't compress kmp files so they can be copied via AssetManager
|
|
aaptOptions {
|
|
noCompress "kmp"
|
|
}
|
|
|
|
buildFeatures {
|
|
buildConfig = true
|
|
}
|
|
|
|
defaultConfig {
|
|
applicationId "com.tavultesoft.kmapro"
|
|
minSdkVersion 21
|
|
targetSdkVersion 35
|
|
|
|
//println "===DUMPING PROPERTIES==="
|
|
//dumpProperties(project) // Use this to dump all external properties for debugging TeamCity integration
|
|
//println "===END DUMP==="
|
|
|
|
// KEYMAN_VERSION strings from version.gradle
|
|
versionCode KEYMAN_VERSION_CODE as Integer
|
|
versionName KEYMAN_VERSION_NAME
|
|
buildConfigField 'String', 'KEYMAN_VERSION_ENVIRONMENT', '"'+KEYMAN_VERSION_ENVIRONMENT+'"'
|
|
buildConfigField 'String', 'KEYMAN_VERSION_GIT_TAG', '"'+KEYMAN_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 = KEYMAN_VERSION_TAG ? KEYMAN_VERSION_TAG : '-' + tier;
|
|
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 = KEYMAN_VERSION_ENVIRONMENT ? KEYMAN_VERSION_ENVIRONMENT : 'local';
|
|
if (environment.matches("local")) {
|
|
appSuffix = appSuffix + '-' + environment;
|
|
}
|
|
}
|
|
variant.resValue "string", "app_name", 'Keyman' + appSuffix;
|
|
|
|
// Adjust output name to "keyman-${KEYMAN_VERSION_MD}.apk"
|
|
variant.outputs.all {
|
|
outputFileName = "keyman-" + KEYMAN_VERSION_MD + ".apk"
|
|
}
|
|
}
|
|
lintOptions {
|
|
disable 'MissingQuantity', 'MissingTranslation'
|
|
lintConfig file("lint.xml")
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
jniLibs.srcDirs = ['libs']
|
|
}
|
|
}
|
|
}
|
|
|
|
// how to configure the sentry android gradle plugin
|
|
task publishSentry {
|
|
doLast {
|
|
println 'Publishing Keyman symbols to Sentry'
|
|
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 (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 {
|
|
google()
|
|
}
|
|
|
|
dependencies {
|
|
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
|
implementation 'androidx.appcompat:appcompat:1.7.0'
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.2.1'
|
|
implementation 'com.google.android.material:material:1.12.0'
|
|
implementation 'com.stepstone.stepper:material-stepper:4.3.1'
|
|
implementation files('libs/keyman-engine.aar')
|
|
implementation 'io.sentry:sentry-android:8.19.1'
|
|
implementation 'androidx.preference:preference:1.2.1'
|
|
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")
|
|
}*/
|