Files

78 lines
3.0 KiB
Groovy

apply plugin: 'com.android.application'
def mobileEnv = { String name, String defaultValue = null ->
return System.getenv(name) ?: (project.hasProperty(name) ? project.property(name).toString() : defaultValue)
}
def releaseStoreFile = mobileEnv('ANDROID_KEYSTORE_FILE')
def hasReleaseSigning = releaseStoreFile &&
mobileEnv('ANDROID_KEYSTORE_PASSWORD') &&
mobileEnv('ANDROID_KEY_ALIAS') &&
mobileEnv('ANDROID_KEY_PASSWORD')
android {
namespace = "io.truckwash.twa"
compileSdk = rootProject.ext.compileSdkVersion
defaultConfig {
applicationId "io.truckwash.twa"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode Integer.parseInt(mobileEnv('MOBILE_VERSION_CODE', '1'))
versionName mobileEnv('MOBILE_VERSION_NAME', '1.0')
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 {
release {
if (hasReleaseSigning) {
storeFile file(releaseStoreFile)
storePassword mobileEnv('ANDROID_KEYSTORE_PASSWORD')
keyAlias mobileEnv('ANDROID_KEY_ALIAS')
keyPassword mobileEnv('ANDROID_KEY_PASSWORD')
}
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
if (hasReleaseSigning) {
signingConfig signingConfigs.release
}
}
}
}
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")
}