2017-04-13 11:30:54 +00:00
|
|
|
plugins {
|
2020-04-28 04:15:29 +00:00
|
|
|
id 'org.ajoberstar.grgit' version '4.0.2'
|
|
|
|
id 'com.palantir.git-version' version '0.12.3'
|
2017-04-13 11:30:54 +00:00
|
|
|
}
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
apply plugin: 'com.android.application'
|
2020-03-25 06:30:22 +00:00
|
|
|
apply plugin: 'kotlin-android'
|
|
|
|
apply plugin: 'kotlin-android-extensions'
|
2020-05-04 04:45:00 +00:00
|
|
|
apply plugin: 'kotlin-kapt'
|
2016-11-08 08:02:01 +00:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2020-05-20 21:29:18 +00:00
|
|
|
preBuild.doFirst {
|
|
|
|
def configFile = android.sourceSets.main.res.sourceFiles.find { it.name.equals 'configuration.xml' }
|
|
|
|
def clientName = new XmlParser().parse(configFile).string.find { it.@name.equals 'client_name' }.text()
|
|
|
|
def clientCabundle = new XmlParser().parse(configFile).string.find { it.@name.equals 'client_cabundle' }.text()
|
|
|
|
def allProjectsList = new XmlParser().parse(configFile).string.find { it.@name.equals 'all_projects_list' }.text()
|
|
|
|
assert file("src/main/assets/arm64-v8a/" + clientName).exists()
|
|
|
|
assert file("src/main/assets/armeabi-v7a/" + clientName).exists()
|
|
|
|
assert file("src/main/assets/x86/" + clientName).exists()
|
|
|
|
assert file("src/main/assets/x86_64/" + clientName).exists()
|
|
|
|
assert file("src/main/assets/" + clientCabundle).exists()
|
|
|
|
assert file("src/main/assets/" + allProjectsList).exists()
|
|
|
|
}
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
android {
|
2020-05-16 04:28:03 +00:00
|
|
|
compileSdkVersion 29
|
|
|
|
buildToolsVersion '29.0.3'
|
2016-11-08 08:02:01 +00:00
|
|
|
|
2020-05-29 04:02:24 +00:00
|
|
|
buildFeatures {
|
|
|
|
viewBinding true
|
|
|
|
}
|
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
defaultConfig {
|
|
|
|
applicationId "edu.berkeley.boinc"
|
2020-05-30 07:47:46 +00:00
|
|
|
minSdkVersion 16
|
2020-05-13 10:29:51 +00:00
|
|
|
targetSdkVersion 28
|
2020-04-28 04:15:29 +00:00
|
|
|
versionCode buildVersionCode().toInteger()
|
2017-04-13 11:30:54 +00:00
|
|
|
versionName buildVersionName()
|
2020-05-15 06:35:42 +00:00
|
|
|
|
|
|
|
// Required when setting minSdkVersion to 20 or lower
|
|
|
|
multiDexEnabled true
|
2020-04-26 01:27:52 +00:00
|
|
|
vectorDrawables.useSupportLibrary = true
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
2020-04-05 23:11:14 +00:00
|
|
|
minifyEnabled true
|
|
|
|
shrinkResources true
|
2016-11-08 08:02:01 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
|
|
|
|
}
|
2016-11-09 17:36:50 +00:00
|
|
|
debug {
|
2020-04-05 23:11:14 +00:00
|
|
|
// Without this, a build error occurs for debug.
|
|
|
|
minifyEnabled true
|
2016-11-09 17:36:50 +00:00
|
|
|
debuggable true
|
2020-05-02 01:16:42 +00:00
|
|
|
testCoverageEnabled true
|
2020-05-13 13:52:05 +00:00
|
|
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.txt'
|
2016-11-09 17:36:50 +00:00
|
|
|
}
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
2020-03-14 00:10:15 +00:00
|
|
|
compileOptions {
|
|
|
|
sourceCompatibility '1.8'
|
|
|
|
targetCompatibility '1.8'
|
2020-05-15 06:35:42 +00:00
|
|
|
|
|
|
|
// Flag to enable support for the new language APIs
|
|
|
|
coreLibraryDesugaringEnabled true
|
2020-03-14 00:10:15 +00:00
|
|
|
}
|
2020-04-21 23:21:30 +00:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = '1.8'
|
|
|
|
}
|
2016-11-08 08:02:01 +00:00
|
|
|
|
2020-04-24 12:55:31 +00:00
|
|
|
testOptions {
|
2020-04-28 01:59:40 +00:00
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
all {
|
|
|
|
useJUnitPlatform()
|
|
|
|
}
|
2020-04-24 12:55:31 +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-04-15 08:13:44 +00:00
|
|
|
ext {
|
2020-05-18 15:09:14 +00:00
|
|
|
coroutines_version = '1.3.5'
|
2020-05-04 04:45:00 +00:00
|
|
|
dagger_version = '2.27'
|
2020-06-15 13:50:24 +00:00
|
|
|
lifecycle_version = "2.2.0"
|
2020-04-15 08:13:44 +00:00
|
|
|
powermock_version = '2.0.5'
|
|
|
|
junit5_version = '5.6.2'
|
|
|
|
}
|
2020-03-22 03:37:50 +00:00
|
|
|
|
2016-11-08 08:02:01 +00:00
|
|
|
dependencies {
|
2020-05-15 06:35:42 +00:00
|
|
|
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.5'
|
|
|
|
implementation 'androidx.multidex:multidex:2.0.1'
|
|
|
|
|
2020-03-30 02:57:19 +00:00
|
|
|
implementation 'androidx.appcompat:appcompat:1.1.0'
|
2020-05-25 05:36:42 +00:00
|
|
|
implementation "androidx.fragment:fragment-ktx:1.2.4"
|
2020-03-30 02:57:19 +00:00
|
|
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
2020-04-08 00:14:23 +00:00
|
|
|
implementation 'androidx.core:core-ktx:1.2.0'
|
2020-06-15 13:50:24 +00:00
|
|
|
implementation "androidx.lifecycle:lifecycle-service:$lifecycle_version"
|
2020-05-26 08:36:54 +00:00
|
|
|
implementation 'androidx.preference:preference:1.1.1'
|
2020-05-26 02:31:59 +00:00
|
|
|
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
2020-06-01 01:22:56 +00:00
|
|
|
implementation 'commons-codec:commons-codec:1.14'
|
2020-05-30 10:54:33 +00:00
|
|
|
implementation 'commons-io:commons-io:2.7'
|
2020-04-08 00:14:23 +00:00
|
|
|
implementation 'org.apache.commons:commons-lang3:3.10'
|
2020-05-15 06:35:42 +00:00
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
2020-05-18 15:09:14 +00:00
|
|
|
|
|
|
|
// Coroutine dependencies
|
|
|
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
|
|
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"
|
2020-04-04 11:17:44 +00:00
|
|
|
|
2020-05-04 04:45:00 +00:00
|
|
|
// Dagger dependencies
|
|
|
|
implementation 'javax.annotation:javax.annotation-api:1.3.2'
|
|
|
|
implementation "com.google.dagger:dagger:$dagger_version"
|
|
|
|
annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
|
|
|
|
kapt "com.google.dagger:dagger-compiler:$dagger_version"
|
|
|
|
|
2020-04-28 01:59:40 +00:00
|
|
|
testImplementation 'androidx.test:core:1.2.0'
|
2020-04-08 00:14:23 +00:00
|
|
|
testImplementation 'com.google.guava:guava-testlib:28.2-jre'
|
2020-03-22 03:37:50 +00:00
|
|
|
testImplementation 'junit:junit:4.13'
|
2020-04-15 08:13:44 +00:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
|
2020-04-23 13:24:49 +00:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-params:$junit5_version"
|
2020-03-22 03:37:50 +00:00
|
|
|
testImplementation "org.powermock:powermock-module-junit4:$powermock_version"
|
|
|
|
testImplementation "org.powermock:powermock-api-mockito2:$powermock_version"
|
2020-04-28 01:59:40 +00:00
|
|
|
testImplementation 'org.robolectric:robolectric:4.3.1'
|
2020-04-15 08:13:44 +00:00
|
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit5_version"
|
2020-04-24 12:55:31 +00:00
|
|
|
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit5_version"
|
2016-11-08 08:02:01 +00:00
|
|
|
}
|
2020-03-25 06:30:22 +00:00
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
|
|
|
}
|