SimpleCloudNotifier/android/app/build.gradle

109 lines
4.2 KiB
Groovy
Raw Normal View History

2018-09-21 22:21:24 +02:00
apply plugin: 'com.android.application'
android {
2018-09-27 02:30:12 +02:00
compileSdkVersion 28
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
2018-09-27 02:30:12 +02:00
targetSdkVersion 28
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
2018-10-22 01:00:49 +02:00
//implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
2018-09-21 23:15:37 +02:00
2018-10-20 17:09:14 +02:00
implementation 'com.google.firebase:firebase-core:16.0.4'
2018-10-22 01:00:49 +02:00
implementation 'com.google.firebase:firebase-messaging:17.3.4'
2018-09-23 20:00:10 +02:00
2018-09-27 01:38:56 +02:00
implementation "android.arch.lifecycle:extensions:1.1.1"
2018-09-23 20:00:10 +02:00
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
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-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
task updateVersion << {
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) }
def matcher = lastTag =~ /^v([0-9]+)\.([0-9]+)\.([0-9]+)$/
if (!matcher.matches()) throw new Exception("Last Tag ('" + lastTag + "') has invalid format :(")
def vName = (matcher[0][1] as Integer) + "." + (matcher[0][2] as Integer) + "." + (matcher[0][3] as Integer)
def vCode = versionProps['VERSION_CODE'] as Integer
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()
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 ""
vCode++
new File(".do_publish_prod_release").createNewFile()
versionProps['VERSION_NAME'] = vName.toString()
versionProps['VERSION_CODE'] = vCode.toString()
versionPropsFile.newWriter().withCloseable { w -> versionProps.store(w, null) }
} else {
println ""
println "==============================================================="
println "(!) This is a new beta release - create deployment trigger file"
println "==============================================================="
println ""
vCode++
new File(".do_publish_beta_release").createNewFile()
versionProps['VERSION_NAME'] = vName.toString()
versionProps['VERSION_CODE'] = vCode.toString()
versionPropsFile.newWriter().withCloseable { w -> versionProps.store(w, null) }
}
}