136 lines
4.0 KiB
Groovy
136 lines
4.0 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
}
|
|
|
|
apply plugin: "androidx.navigation.safeargs"
|
|
|
|
//This is needed for SVG->PNG
|
|
//apply plugin: 'com.trello.victor'
|
|
|
|
//
|
|
// Convert SVG images from art directory into PNG files.
|
|
//
|
|
//task generateDrawablesFromArt {
|
|
// doLast {
|
|
// def buildDir = (new File(project.buildDir,'art')).toString()
|
|
// def p = ('make -C app/src/main/art RES=../res TMP='+buildDir).execute()
|
|
// p.consumeProcessOutput()
|
|
// p.waitFor()
|
|
// if ( p.exitValue() )
|
|
// throw new GradleException("Generation of art failed.")
|
|
// }
|
|
//}
|
|
//preBuild.dependsOn generateDrawablesFromArt
|
|
|
|
static String gitVersion() {
|
|
def versionP = 'git describe --tags --long --dirty=-x --always --abbrev=8'
|
|
.execute()
|
|
versionP.waitFor()
|
|
if (versionP.exitValue())
|
|
throw new GradleException("Couldn't extract version. Git exited unexpectedly.")
|
|
return versionP.text.trim()
|
|
}
|
|
|
|
static String gitHash() {
|
|
def hashP = 'git rev-parse HEAD'.execute()
|
|
hashP.waitFor()
|
|
if (hashP.exitValue())
|
|
throw new GradleException("Couldn't extract git_hash. Git exited unexpectedly.")
|
|
return hashP.text.trim()
|
|
}
|
|
|
|
static Integer gitVersionCode() {
|
|
def gitP = 'git rev-list v2..HEAD --count'.execute()
|
|
gitP.waitFor()
|
|
if (gitP.exitValue())
|
|
throw new GradleException("Couldn't extract number of commit after v2.")
|
|
return gitP.text.trim().toInteger()
|
|
}
|
|
|
|
static String buildDate() {
|
|
def date = new Date()
|
|
return date.toString()
|
|
}
|
|
|
|
android {
|
|
signingConfigs {
|
|
release {
|
|
storeFile file('keys/signing_key')
|
|
keyAlias 'key0'
|
|
}
|
|
}
|
|
compileSdk 31
|
|
|
|
// sourceSets {
|
|
// main {
|
|
// svg.srcDir 'src/main/art'
|
|
// }
|
|
// }
|
|
|
|
defaultConfig {
|
|
applicationId "org.vostan.banvor"
|
|
minSdk 21
|
|
targetSdk 31
|
|
versionCode gitVersionCode()
|
|
versionName gitVersion()
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
resValue "bool", "debug_visible", "false"
|
|
resValue "string", "git_version", gitVersion()
|
|
resValue "string", "git_hash", gitHash()
|
|
resValue "string", "build_date", buildDate()
|
|
// resValue "string", "version_code", "0x00020001"
|
|
}
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
manifestPlaceholders = [
|
|
appIcon: "@drawable/icon",
|
|
appIconRound: "@drawable/icon",
|
|
appName: "@string/app_name"
|
|
]
|
|
}
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
resValue "bool", "debug_visible", "true"
|
|
manifestPlaceholders = [
|
|
appIcon: "@drawable/icon_debug",
|
|
appIconRound: "@drawable/icon_debug",
|
|
appName: "@string/app_name_debug"
|
|
]
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
buildFeatures {
|
|
viewBinding true
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
def nav_version = "2.3.5"
|
|
|
|
implementation 'androidx.appcompat:appcompat:1.3.1'
|
|
implementation 'com.google.android.material:material:1.4.0'
|
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
|
|
|
|
// This is for unit tests.
|
|
testImplementation 'junit:junit:4.+'
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
|
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
|
|
|
// Java language implementation
|
|
implementation "androidx.navigation:navigation-fragment:$nav_version"
|
|
implementation "androidx.navigation:navigation-ui:$nav_version"
|
|
// Feature module Support
|
|
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"
|
|
// Testing Navigation
|
|
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"
|
|
// Jetpack Compose Integration
|
|
implementation "androidx.navigation:navigation-compose:2.4.0-alpha10"
|
|
}
|
|
|