SWADroid/SWADroid/build.gradle
Amab b2af0dedb4
All checks were successful
continuous-integration/drone/push Build is passing
Update Gradle Plugin & update Java version to 17 (#425)
## What changes were proposed in this pull request?

Update Gradle Plugin & update Java version to 17.

## How was this patch tested?

Manually.

Reviewed-on: #425
Co-authored-by: Amab <juanmi1982@gmail.com>
Co-committed-by: Amab <juanmi1982@gmail.com>
2023-11-26 10:37:19 +01:00

97 lines
2.7 KiB
Groovy

import io.github.reactivecircus.appversioning.SemVer
plugins {
id("io.github.reactivecircus.app-versioning") version "1.3.1"
}
apply plugin: 'com.android.application'
//return a BuildConfigField from a properties file.
def static getBuildConfigField(String property){
def propFile = new File("keystore.properties")
def value
if(propFile.exists()) {
Properties properties = new Properties()
properties.load(new FileInputStream(propFile))
value = "\"" + properties.getProperty(property) + "\""
} else {
value = "\"" + System.getenv(property) + "\""
}
return value
}
def build_param = "${build}"
if (build_param != "prod") {
//exclude development build
android.variantFilter { variant ->
if (variant.buildType.name == 'prod') {
variant.setIgnore(true)
}
}
} else {
//exclude all except development build
android.variantFilter { variant ->
if (variant.buildType.name != 'prod') {
variant.setIgnore(true)
}
}
}
appVersioning {
overrideVersionCode { gitTag, providers, variantInfo ->
//SemVer-based version code
def semVer = SemVer.fromGitTag(gitTag)
semVer.major * 1000000 + semVer.minor * 1000 + semVer.patch
//Timestamp-based version code
//Instant.now().epochSecond.toInt()
}
}
android {
namespace 'es.ugr.swad.swadroid'
compileSdk 34
lint {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
defaultConfig {
applicationId "es.ugr.swad.swadroid"
minSdkVersion 24
targetSdkVersion 34
testApplicationId "es.ugr.swad.swadroid.test"
testInstrumentationRunner "android.test.InstrumentationTestRunner"
buildConfigField "String", "SWAD_APP_KEY", getBuildConfigField("SWAD_APP_KEY")
}
buildTypes {
prod {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
implementation 'commons-io:commons-io:2.11.0'
implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
implementation 'com.journeyapps:zxing-android-embedded:4.3.0@aar'
implementation 'com.google.zxing:core:3.5.2'
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'com.google.android.material:material:1.10.0'
}