Files
cardy/mobile-client/android/app/build.gradle
T

88 lines
3.8 KiB
Groovy

apply plugin: 'com.android.application'
// ---- Cardy: versioning and signing ----
// versionCode from the build time (UTC): yyDDDHHmm (year, day of year, time), e.g. 262721430.
// Grows with every build and stays below Android's limit (2100000000) until 2099.
// Override with -PcardyVersionCode=... (the APK publishing script passes the value it records).
def cardyVersionCode = project.findProperty('cardyVersionCode') ?: new Date().format('yyDDDHHmm', TimeZone.getTimeZone('UTC'))
def cardyVersionName = project.findProperty('cardyVersionName') ?: '1.0'
// Release key: android/keystore.properties (not in git) with storeFile, storePassword, keyAlias, keyPassword.
// Debug builds use the same key so that Android Studio builds and published APKs can replace each other.
def keystoreProps = new Properties()
def keystoreFile = rootProject.file('keystore.properties')
if (keystoreFile.exists()) keystoreFile.withInputStream { keystoreProps.load(it) }
def hasReleaseKey = ['storeFile', 'storePassword', 'keyAlias', 'keyPassword'].every { keystoreProps.getProperty(it)?.trim() }
android {
namespace = "com.aggtaa.cardy"
compileSdk = rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "com.aggtaa.cardy"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode cardyVersionCode as Integer
versionName cardyVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
// Default: https://android.googlesource.com/platform/frameworks/base/+/282e181b58cf72b6ca770dc7ca5f91f135444502/tools/aapt/AaptAssets.cpp#61
ignoreAssetsPattern = '!.svn:!.git:!.ds_store:!*.scc:.*:!CVS:!thumbs.db:!picasa.ini:!*~'
}
}
signingConfigs {
if (hasReleaseKey) {
cardy {
storeFile file(keystoreProps.getProperty('storeFile').trim())
storePassword keystoreProps.getProperty('storePassword')
keyAlias keystoreProps.getProperty('keyAlias').trim()
keyPassword keystoreProps.getProperty('keyPassword')
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (hasReleaseKey) signingConfig signingConfigs.cardy
}
debug {
if (hasReleaseKey) signingConfig signingConfigs.cardy
}
}
}
if (!hasReleaseKey) {
logger.warn('Cardy: android/keystore.properties is missing or incomplete: debug builds use the debug key, release builds are unsigned.')
}
repositories {
flatDir{
dirs '../capacitor-cordova-android-plugins/src/main/libs', 'libs'
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "androidx.appcompat:appcompat:$androidxAppCompatVersion"
implementation "androidx.coordinatorlayout:coordinatorlayout:$androidxCoordinatorLayoutVersion"
implementation "androidx.core:core-splashscreen:$coreSplashScreenVersion"
implementation project(':capacitor-android')
testImplementation "junit:junit:$junitVersion"
androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion"
implementation project(':capacitor-cordova-android-plugins')
}
apply from: 'capacitor.build.gradle'
try {
def servicesJSON = file('google-services.json')
if (servicesJSON.text) {
apply plugin: 'com.google.gms.google-services'
}
} catch(Exception e) {
logger.info("google-services.json not found, google-services plugin not applied. Push Notifications won't work")
}