104 lines
2.9 KiB
Groovy
104 lines
2.9 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
|
|
}
|
|
|
|
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")
|
|
}
|
|
|
|
def RELEASE_STORE_FILE = System.getenv("RELEASE_STORE_FILE")
|
|
buildFeatures {
|
|
buildConfig true
|
|
}
|
|
|
|
if (RELEASE_STORE_FILE) {
|
|
signingConfigs {
|
|
release {
|
|
storeFile file(RELEASE_STORE_FILE)
|
|
storePassword System.getenv("RELEASE_STORE_PASSWORD")
|
|
keyAlias System.getenv("RELEASE_KEY_ALIAS")
|
|
keyPassword System.getenv("RELEASE_KEY_PASSWORD")
|
|
|
|
v1SigningEnabled true
|
|
v2SigningEnabled true
|
|
|
|
enableV3Signing = true
|
|
enableV4Signing = true
|
|
}
|
|
}
|
|
}
|
|
|
|
if (RELEASE_STORE_FILE) {
|
|
buildTypes {
|
|
release {
|
|
signingConfig signingConfigs.release
|
|
}
|
|
}
|
|
} else {
|
|
project.logger.warn("RELEASE_STORE_FILE is not defined. Skipping signing step")
|
|
}
|
|
}
|
|
|
|
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'
|
|
}
|