2018-11-08 04:04:37 +01:00
|
|
|
import groovy.xml.XmlUtil
|
|
|
|
|
|
|
|
apply plugin: 'com.android.application'
|
2019-07-03 19:44:37 +02:00
|
|
|
apply plugin: 'kotlin-android'
|
2018-11-08 04:04:37 +01:00
|
|
|
|
|
|
|
android {
|
2019-06-03 17:23:09 +02:00
|
|
|
|
2020-09-09 21:46:30 +02:00
|
|
|
compileSdkVersion 30
|
|
|
|
buildToolsVersion '30.0.2' // adapt in .travis.yaml if changed here
|
2019-06-03 17:23:09 +02:00
|
|
|
|
|
|
|
defaultConfig {
|
2020-09-09 23:12:02 +02:00
|
|
|
minSdkVersion 29 // leave at 29 for robolectric tests
|
2020-09-09 21:46:30 +02:00
|
|
|
targetSdkVersion 30
|
2019-08-06 08:16:37 +02:00
|
|
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
2019-12-18 17:14:25 +01:00
|
|
|
testInstrumentationRunnerArguments disableAnalytics: 'true'
|
2019-06-03 17:23:09 +02:00
|
|
|
}
|
2018-11-08 04:04:37 +01:00
|
|
|
|
|
|
|
buildTypes {
|
|
|
|
release {
|
|
|
|
minifyEnabled false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
lintOptions {
|
|
|
|
abortOnError false
|
|
|
|
}
|
|
|
|
compileOptions {
|
|
|
|
targetCompatibility 1.8
|
|
|
|
sourceCompatibility 1.8
|
|
|
|
}
|
2020-01-18 19:39:53 +01:00
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = JavaVersion.VERSION_1_8.toString()
|
|
|
|
}
|
2019-07-09 19:22:24 +02:00
|
|
|
testOptions {
|
|
|
|
unitTests.all {
|
|
|
|
useJUnitPlatform()
|
|
|
|
testLogging {
|
|
|
|
events "passed", "skipped", "failed"
|
|
|
|
}
|
|
|
|
}
|
2019-12-18 17:14:25 +01:00
|
|
|
unitTests {
|
|
|
|
includeAndroidResources = true
|
|
|
|
}
|
2019-07-09 19:22:24 +02:00
|
|
|
}
|
2019-06-03 20:51:58 +02:00
|
|
|
|
2019-08-20 13:04:09 +02:00
|
|
|
sourceSets {
|
|
|
|
test {
|
|
|
|
java.srcDirs += "$projectDir/src/sharedTest/java"
|
|
|
|
}
|
|
|
|
androidTest {
|
|
|
|
java.srcDirs += "$projectDir/src/sharedTest/java"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-03 20:51:58 +02:00
|
|
|
// optional signingConfigs
|
|
|
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
|
|
|
if (keystorePropertiesFile.exists()) {
|
|
|
|
def keystoreProperties = new Properties()
|
|
|
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
|
|
|
|
|
|
|
signingConfigs {
|
|
|
|
release {
|
|
|
|
keyAlias keystoreProperties['keyAlias']
|
|
|
|
keyPassword keystoreProperties['keyPassword']
|
|
|
|
storeFile file(keystoreProperties['storeFile'])
|
|
|
|
storePassword keystoreProperties['storePassword']
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buildTypes.release.signingConfig = signingConfigs.release
|
2019-07-09 19:22:24 +02:00
|
|
|
buildTypes.debug.signingConfig = signingConfigs.release
|
2019-06-03 20:51:58 +02:00
|
|
|
}
|
2018-11-08 04:04:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
gradle.projectsEvaluated {
|
|
|
|
tasks.withType(JavaCompile) {
|
2019-09-19 16:19:44 +02:00
|
|
|
if (JavaVersion.current() >= JavaVersion.VERSION_1_9) {
|
|
|
|
options.compilerArgs.addAll(['--release', '8'])
|
|
|
|
}
|
2018-11-08 04:04:37 +01:00
|
|
|
options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-11 15:25:36 +02:00
|
|
|
// http://www.31mins.com/android-studio-build-system-application/
|
2019-06-03 17:23:09 +02:00
|
|
|
preBuild.doLast {
|
|
|
|
def imlFile = file(project.name + ".iml")
|
2018-11-08 04:04:37 +01:00
|
|
|
|
2019-06-03 17:23:09 +02:00
|
|
|
try {
|
|
|
|
def parsedXml = (new XmlParser()).parse(imlFile)
|
|
|
|
def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
|
|
|
|
parsedXml.component[1].remove(jdkNode)
|
2018-11-08 04:04:37 +01:00
|
|
|
|
2019-06-03 17:23:09 +02:00
|
|
|
def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
|
2019-09-19 16:19:44 +02:00
|
|
|
//noinspection GroovyResultOfObjectAllocationIgnored // the note gets inserted
|
2019-06-03 17:23:09 +02:00
|
|
|
new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
|
|
|
|
XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
|
2018-11-08 04:04:37 +01:00
|
|
|
|
2019-06-03 17:23:09 +02:00
|
|
|
} catch (NullPointerException | FileNotFoundException ex) {
|
|
|
|
ex.printStackTrace()
|
2018-11-08 04:04:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-09 19:22:24 +02:00
|
|
|
// To produce these binaries, in latest AOSP source tree, run
|
2020-09-09 21:45:51 +02:00
|
|
|
// $ m
|
2019-07-09 19:22:24 +02:00
|
|
|
def aospDeps = fileTree(include: [
|
2020-09-09 21:45:51 +02:00
|
|
|
// For more information about this module:
|
|
|
|
// https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-11.0.0_r3/Android.bp#507
|
|
|
|
// framework_intermediates/classes-header.jar works for gradle build as well,
|
|
|
|
// but not unit tests, so we use the actual classes (without updatable modules).
|
|
|
|
//
|
|
|
|
// out/target/common/obj/JAVA_LIBRARIES/framework-minus-apex_intermediates/classes.jar
|
2019-07-09 19:22:24 +02:00
|
|
|
'android.jar',
|
2020-09-09 21:45:51 +02:00
|
|
|
// out/target/common/obj/JAVA_LIBRARIES/core-libart.com.android.art.release_intermediates/classes.jar
|
2019-07-09 19:22:24 +02:00
|
|
|
'libcore.jar'
|
|
|
|
], dir: 'libs')
|
|
|
|
|
2020-07-10 02:33:24 +02:00
|
|
|
// If the dependencies below are updated please make sure to update the
|
|
|
|
// prebuilt libraries and Android.bp in the top `libs` folder to reflect that.
|
|
|
|
// You can copy these libraries from ~/.gradle/caches/modules-2
|
2018-11-08 04:04:37 +01:00
|
|
|
dependencies {
|
2019-07-09 19:22:24 +02:00
|
|
|
compileOnly aospDeps
|
2018-11-08 04:04:37 +01:00
|
|
|
|
2019-09-19 16:19:44 +02:00
|
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
2019-07-03 19:44:37 +02:00
|
|
|
|
2019-07-05 12:35:45 +02:00
|
|
|
implementation 'io.github.novacrypto:BIP39:2019.01.27'
|
2019-12-16 17:11:11 +01:00
|
|
|
implementation 'org.koin:koin-androidx-viewmodel:2.0.1'
|
2019-06-07 19:09:55 +02:00
|
|
|
|
2019-09-11 20:26:10 +02:00
|
|
|
implementation 'androidx.core:core-ktx:1.1.0'
|
|
|
|
implementation 'androidx.preference:preference-ktx:1.1.0'
|
2019-07-05 12:35:45 +02:00
|
|
|
implementation 'com.google.android.material:material:1.0.0'
|
2019-09-11 20:26:10 +02:00
|
|
|
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
|
2019-12-20 17:55:38 +01:00
|
|
|
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.1.0'
|
2020-07-10 02:33:24 +02:00
|
|
|
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.3.0-alpha05'
|
2019-07-05 12:35:45 +02:00
|
|
|
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
|
2019-07-09 19:22:24 +02:00
|
|
|
|
2020-08-26 19:17:50 +02:00
|
|
|
lintChecks 'com.github.thirdegg:lint-rules:0.0.5-alpha'
|
2019-07-09 19:22:24 +02:00
|
|
|
|
2020-08-07 21:57:27 +02:00
|
|
|
def junit_version = "5.5.2" // careful, upgrading this can change a Cipher's IV size in tests!?
|
2020-08-06 17:33:36 +02:00
|
|
|
def mockk_version = "1.10.0"
|
2020-08-07 21:57:27 +02:00
|
|
|
testImplementation aospDeps // anything less fails tests run with gradlew
|
2020-09-09 23:12:02 +02:00
|
|
|
testImplementation 'androidx.test.ext:junit:1.1.2'
|
|
|
|
testImplementation('org.robolectric:robolectric:4.3.1') { // 4.4 has issue with non-idle Looper
|
2020-09-14 19:04:40 +02:00
|
|
|
// https://github.com/robolectric/robolectric/issues/5245
|
|
|
|
exclude group: "com.google.auto.service", module: "auto-service"
|
|
|
|
}
|
2019-12-18 17:14:25 +01:00
|
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_version"
|
2020-08-06 17:33:36 +02:00
|
|
|
testImplementation "io.mockk:mockk:$mockk_version"
|
2019-12-18 17:14:25 +01:00
|
|
|
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_version"
|
|
|
|
testRuntimeOnly "org.junit.vintage:junit-vintage-engine:$junit_version"
|
2019-08-06 08:16:37 +02:00
|
|
|
|
2020-09-09 23:12:02 +02:00
|
|
|
androidTestImplementation 'androidx.test:runner:1.3.0'
|
|
|
|
androidTestImplementation 'androidx.test:rules:1.3.0'
|
|
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
|
2020-08-06 17:33:36 +02:00
|
|
|
androidTestImplementation "io.mockk:mockk-android:$mockk_version"
|
2018-11-08 04:04:37 +01:00
|
|
|
}
|