duckstation/android/app/build.gradle

84 lines
2.4 KiB
Groovy

apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.github.stenzek.duckstation"
minSdkVersion 23
targetSdkVersion 29
versionCode(getBuildVersionCode())
versionName "${getVersion()}"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "../../CMakeLists.txt"
version "3.10.2"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
externalNativeBuild {
cmake {
arguments "-DCMAKE_BUILD_TYPE=Release"
abiFilters "arm64-v8a", "armeabi-v7a"
}
}
}
sourceSets {
main.assets.srcDirs += "../../data"
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
implementation 'androidx.preference:preference:1.1.0-alpha05'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation "androidx.viewpager2:viewpager2:1.0.0"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
// Adapted from Dolphin.
def getVersion() {
def versionNumber = '0.0-unknown'
try {
versionNumber = 'git describe --tags --exclude latest --exclude preview'.execute([], project.rootDir).text
.trim()
.replaceAll(/(-0)?-[^-]+$/, "")
} catch (Exception e) {
logger.error('Cannot find git, defaulting to dummy version number')
}
return versionNumber
}
def getBuildVersionCode() {
try {
def versionNumber = 'git rev-list --first-parent --count HEAD'.execute([], project.rootDir).text
.trim()
return Integer.valueOf(versionNumber);
} catch (Exception e) {
logger.error('Cannot find git, defaulting to dummy version number')
}
return 1;
}