118 lines
3.8 KiB
Groovy
118 lines
3.8 KiB
Groovy
plugins {
|
|
id 'com.android.application'
|
|
}
|
|
|
|
apply plugin: "androidx.navigation.safeargs"
|
|
|
|
//
|
|
// Creates version.xml
|
|
//
|
|
task createVersionXML {
|
|
doLast {
|
|
def versionP = 'git describe --tags --long --dirty=-x --always --abbrev=8'
|
|
.execute()
|
|
versionP.waitFor()
|
|
def version = versionP.text.trim()
|
|
if ( versionP.exitValue() )
|
|
throw new GradleException("Couldn't extract version. Git exited unexpectedly.")
|
|
|
|
def githashP = 'git rev-parse HEAD'.execute()
|
|
githashP.waitFor()
|
|
def githash = githashP.text.trim()
|
|
if ( githashP.exitValue() )
|
|
throw new GradleException("Couldn't extract git_hash. Git exited unexpectedly.")
|
|
|
|
def builddate = new Date()
|
|
def versionFile = new FileWriter("app/src/main/res/values/version.xml")
|
|
versionFile.println( '<?xml version="1.0" encoding="utf-8"?>' )
|
|
versionFile.println( '<resources>' )
|
|
versionFile.println( '<string name="git_version">' << version << '</string>' )
|
|
versionFile.println( '<string name="git_hash">' << githash << '</string>' )
|
|
versionFile.println( '<string name="build_date">' << builddate << '</string>' )
|
|
versionFile.println( '<string name="version_code">0x00020001</string>' )
|
|
versionFile.println( '</resources>' )
|
|
versionFile.close()
|
|
}
|
|
}
|
|
preBuild.dependsOn createVersionXML
|
|
|
|
//
|
|
// 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
|
|
|
|
android {
|
|
compileSdk 31
|
|
|
|
defaultConfig {
|
|
applicationId "org.vostan.banvor"
|
|
minSdk 21
|
|
targetSdk 31
|
|
versionCode 2
|
|
versionName "2.2"
|
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
}
|
|
|
|
buildTypes {
|
|
release {
|
|
minifyEnabled false
|
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
|
resValue "string", "debug_visibility", "gone"
|
|
manifestPlaceholders = [
|
|
appIcon: "@drawable/icon",
|
|
appIconRound: "@drawable/icon",
|
|
appName: "@string/app_name"
|
|
]
|
|
}
|
|
debug {
|
|
applicationIdSuffix ".debug"
|
|
resValue "string", "debug_visibility", "visible"
|
|
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'
|
|
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"
|
|
}
|
|
|