SimpleCloudNotifier/android/app/build.gradle

117 lines
4.7 KiB
Groovy
Raw Normal View History

2018-09-21 22:21:24 +02:00
apply plugin: 'com.android.application'
android {
2020-11-03 14:41:20 +01:00
compileSdkVersion 30
2018-10-20 17:09:14 +02:00
def versionPropsFile = file('version.properties')
def vNumber
def vName
if (versionPropsFile.canRead()) {
Properties versionProps = new Properties()
new FileInputStream(versionPropsFile).withCloseable { stream -> versionProps.load(stream) }
vNumber = versionProps['VERSION_CODE'].toInteger()
vName = versionProps['VERSION_NAME'].toString()
} else throw new FileNotFoundException("Could not read version.properties!")
2018-09-21 22:21:24 +02:00
defaultConfig {
applicationId "com.blackforestbytes.simplecloudnotifier"
2018-09-23 16:23:49 +02:00
minSdkVersion 21
2020-11-03 14:41:20 +01:00
targetSdkVersion 30
2018-10-20 17:09:14 +02:00
versionCode vNumber
versionName vName
2018-09-21 22:21:24 +02:00
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
2018-09-23 20:00:10 +02:00
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
2018-09-21 22:21:24 +02:00
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
2018-09-21 23:15:37 +02:00
2020-11-03 14:41:20 +01:00
implementation 'androidx.appcompat:appcompat:1.2.0'
2018-10-22 01:00:49 +02:00
implementation 'androidx.cardview:cardview:1.0.0'
2020-11-03 14:41:20 +01:00
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.firebase:firebase-core:18.0.0'
implementation 'com.google.firebase:firebase-messaging:21.0.0'
implementation 'com.google.android.gms:play-services-ads:19.5.0'
implementation 'com.android.billingclient:billing:3.0.1'
implementation 'com.squareup.okhttp3:okhttp:4.9.0'
2018-09-23 20:00:10 +02:00
implementation 'com.github.kenglxn.QRGen:android:2.5.0'
2018-10-22 01:00:49 +02:00
implementation "com.github.DeweyReed:UltimateMusicPicker:2.0.0"
2018-10-22 14:04:50 +02:00
implementation 'com.github.duanhong169:colorpicker:1.1.5'
2018-12-11 12:25:10 +01:00
2020-11-03 14:41:20 +01:00
implementation 'net.danlew:android.joda:2.10.7.1'
2018-09-21 22:21:24 +02:00
}
2018-09-21 23:15:37 +02:00
apply plugin: 'com.google.gms.google-services'
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
tasks.register("updateVersion") {
group = 'Custom'
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
doLast {
def lastTag = ['git', 'describe', "--abbrev=0", "--tags"].execute().text.trim()
def versionPropsFile = file('version.properties')
if (!versionPropsFile.canRead()) throw new FileNotFoundException("Could not read version.properties!")
Properties versionProps = new Properties()
new FileInputStream(versionPropsFile).withCloseable { fis -> versionProps.load(fis) }
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
def matcher = lastTag =~ /^v([0-9]+)\.([0-9]+)\.([0-9]+)$/
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
if (!matcher.matches()) throw new Exception("Last Tag ('" + lastTag + "') has invalid format :(")
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
def vName = (matcher[0][1] as Integer) + "." + (matcher[0][2] as Integer) + "." + (matcher[0][3] as Integer)
def vCode = versionProps['VERSION_CODE'] as Integer
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
if (new File(".do_publish_beta_release").exists()) new File(".do_publish_beta_release").delete()
if (new File(".do_publish_prod_release").exists()) new File(".do_publish_prod_release").delete()
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
if (vName == versionProps['VERSION_NAME'].toString()) {
println "This version was already built - skip deployment"
} else if (vName.endsWith(".0")) {
println ""
println "====================================================================="
println "====================================================================="
println "(!) This is a new PRODUCTION release - create deployment trigger file"
println "====================================================================="
println "====================================================================="
println ""
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
vCode++
new File(".do_publish_prod_release").createNewFile()
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
versionProps['VERSION_NAME'] = vName.toString()
versionProps['VERSION_CODE'] = vCode.toString()
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
versionPropsFile.newWriter().withCloseable { w -> versionProps.store(w, null) }
} else {
println ""
println "==============================================================="
println "(!) This is a new beta release - create deployment trigger file"
println "==============================================================="
println ""
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
vCode++
new File(".do_publish_beta_release").createNewFile()
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
versionProps['VERSION_NAME'] = vName.toString()
versionProps['VERSION_CODE'] = vCode.toString()
2018-10-20 17:09:14 +02:00
2020-11-03 14:41:20 +01:00
versionPropsFile.newWriter().withCloseable { w -> versionProps.store(w, null) }
}
2018-10-20 17:09:14 +02:00
}
}