2017-04-13 11:30:54 +00:00
|
|
|
plugins {
|
|
|
|
id 'org.ajoberstar.grgit' version '1.7.1'
|
|
|
|
id 'com.palantir.git-version' version '0.7.1'
|
|
|
|
}
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
apply plugin: 'com.android.application'
|
|
|
|
|
2017-04-13 11:30:54 +00:00
|
|
|
import org.ajoberstar.grgit.Grgit
|
|
|
|
|
2017-04-19 08:36:58 +00:00
|
|
|
// Use commit date as version code (valid up to 07/18/2036)
|
2017-04-13 11:30:54 +00:00
|
|
|
def buildVersionCode() {
|
|
|
|
def repo = Grgit.open()
|
|
|
|
def head = repo.head()
|
|
|
|
|
|
|
|
// Sanity check across git plugins
|
2019-01-10 16:38:37 +00:00
|
|
|
assert head.getAbbreviatedId(10) == versionDetails().gitHash: "Internal error: SHA1 mismatch!"
|
2017-04-13 11:30:54 +00:00
|
|
|
|
|
|
|
return head.time
|
|
|
|
}
|
|
|
|
|
|
|
|
// Derive version name from release tag and add commit SHA1
|
|
|
|
def buildVersionName() {
|
2018-10-05 14:22:23 +00:00
|
|
|
def pattern = /client_release\/\d+\.\d+\/(?<major>\d+)\.(?<minor>\d+)\.(?<revision>\d+)(?<suffix>[-_\.]?.*)/
|
2017-04-19 08:36:58 +00:00
|
|
|
def version = ': DEVELOPMENT'
|
2017-04-13 11:30:54 +00:00
|
|
|
|
2017-04-19 08:36:58 +00:00
|
|
|
def head = versionDetails()
|
|
|
|
def tag = head.lastTag
|
2017-04-13 11:30:54 +00:00
|
|
|
def match = (tag =~ pattern)
|
|
|
|
|
|
|
|
// Sanity checks for tag format
|
2019-01-10 16:38:37 +00:00
|
|
|
if (match.hasGroup() && 1L == match.size() && 5L == match[0].size() && head.commitDistance == 0) {
|
2017-04-19 08:36:58 +00:00
|
|
|
def major = match.group('major')
|
|
|
|
def minor = match.group('minor')
|
|
|
|
def revision = match.group('revision')
|
|
|
|
def suffix = match.group('suffix')
|
|
|
|
version = "${major}.${minor}.${revision}${suffix}"
|
2019-01-10 16:38:37 +00:00
|
|
|
assert !suffix.endsWith('.dirty'): "Dirty working tree detected! Preventing release build!"
|
|
|
|
} else {
|
2017-04-19 08:36:58 +00:00
|
|
|
println "Warning! Non-release tag or offset found: $tag (offset: $head.commitDistance)"
|
|
|
|
println "Flagging as DEVELOPMENT build..."
|
|
|
|
}
|
2017-04-13 11:30:54 +00:00
|
|
|
|
|
|
|
def commit = versionDetails().gitHash
|
|
|
|
|
2017-04-19 08:36:58 +00:00
|
|
|
return "${version} (${commit})"
|
2017-04-13 11:30:54 +00:00
|
|
|
}
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
android {
|
2020-03-24 10:22:09 +00:00
|
|
|
compileSdkVersion 29
|
|
|
|
buildToolsVersion '29.0.3'
|
2016-11-08 08:02:01 +00:00
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
applicationId "edu.berkeley.boinc"
|
2018-09-04 12:40:09 +00:00
|
|
|
minSdkVersion 19
|
2020-03-24 10:22:09 +00:00
|
|
|
targetSdkVersion 29
|
2017-04-13 11:30:54 +00:00
|
|
|
versionCode buildVersionCode()
|
|
|
|
versionName buildVersionName()
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
|
|
}
|
2016-11-09 17:36:50 +00:00
|
|
|
debug {
|
|
|
|
minifyEnabled false
|
|
|
|
debuggable true
|
|
|
|
}
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
2020-03-14 00:10:15 +00:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility '1.8'
|
|
|
|
targetCompatibility '1.8'
|
|
|
|
}
|
2016-11-08 08:02:01 +00:00
|
|
|
|
2020-03-24 14:44:08 +00:00
|
|
|
tasks.withType(Test) {
|
|
|
|
testLogging {
|
|
|
|
events "passed", "skipped", "failed"
|
|
|
|
}
|
2020-03-24 02:29:39 +00:00
|
|
|
}
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
|
|
|
|
2020-03-22 03:37:50 +00:00
|
|
|
ext.powermock_version = '2.0.5'
|
|
|
|
ext.lombok_version = '1.18.12'
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
dependencies {
|
2020-03-11 23:45:55 +00:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.0.0'
|
2020-03-22 03:37:50 +00:00
|
|
|
implementation 'org.apache.commons:commons-lang3:3.9'
|
|
|
|
testImplementation 'junit:junit:4.13'
|
|
|
|
testImplementation "org.powermock:powermock-module-junit4:$powermock_version"
|
|
|
|
testImplementation "org.powermock:powermock-api-mockito2:$powermock_version"
|
|
|
|
|
|
|
|
// The line below is needed for access to the Lombok annotations.
|
|
|
|
compileOnly "org.projectlombok:lombok:$lombok_version"
|
|
|
|
annotationProcessor "org.projectlombok:lombok:$lombok_version"
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|