blob: 8fe39a43e535e8eca99760a1550aabce2bca2cda [file] [log] [blame]
Steve Soltyse8720182018-11-07 22:04:37 -05001import groovy.xml.XmlUtil
2
3apply plugin: 'com.android.application'
Torsten Grote3d5911d2019-07-03 19:44:37 +02004apply plugin: 'kotlin-android'
5apply plugin: 'kotlin-android-extensions'
Steve Soltyse8720182018-11-07 22:04:37 -05006
7android {
Torsten Grote2434fe32019-06-03 12:23:09 -03008
Steve Soltysdf0b3d62019-02-11 22:00:33 -05009 compileSdkVersion 28
Torsten Grote2434fe32019-06-03 12:23:09 -030010 buildToolsVersion '28.0.3'
11
12 defaultConfig {
13 minSdkVersion 26
Torsten Groteb17a55a2019-06-11 10:25:36 -030014 targetSdkVersion 28
Torsten Grotee955e022019-08-06 08:16:37 +020015 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Torsten Grote2434fe32019-06-03 12:23:09 -030016 }
Steve Soltyse8720182018-11-07 22:04:37 -050017
18 buildTypes {
19 release {
20 minifyEnabled false
Steve Soltyse8720182018-11-07 22:04:37 -050021 }
22 }
23
24 lintOptions {
25 abortOnError false
26 }
27 compileOptions {
28 targetCompatibility 1.8
29 sourceCompatibility 1.8
30 }
Torsten Grote2ce625a2019-07-09 19:22:24 +020031 testOptions {
32 unitTests.all {
33 useJUnitPlatform()
34 testLogging {
35 events "passed", "skipped", "failed"
36 }
37 }
38 }
Torsten Groted1f59862019-06-03 15:51:58 -030039
Torsten Grote74aa62a2019-08-20 13:04:09 +020040 sourceSets {
41 test {
42 java.srcDirs += "$projectDir/src/sharedTest/java"
43 }
44 androidTest {
45 java.srcDirs += "$projectDir/src/sharedTest/java"
46 }
47 }
48
Torsten Groted1f59862019-06-03 15:51:58 -030049 // optional signingConfigs
50 def keystorePropertiesFile = rootProject.file("keystore.properties")
51 if (keystorePropertiesFile.exists()) {
52 def keystoreProperties = new Properties()
53 keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
54
55 signingConfigs {
56 release {
57 keyAlias keystoreProperties['keyAlias']
58 keyPassword keystoreProperties['keyPassword']
59 storeFile file(keystoreProperties['storeFile'])
60 storePassword keystoreProperties['storePassword']
61 }
62 }
63 buildTypes.release.signingConfig = signingConfigs.release
Torsten Grote2ce625a2019-07-09 19:22:24 +020064 buildTypes.debug.signingConfig = signingConfigs.release
Torsten Groted1f59862019-06-03 15:51:58 -030065 }
Steve Soltyse8720182018-11-07 22:04:37 -050066}
67
68gradle.projectsEvaluated {
69 tasks.withType(JavaCompile) {
70 options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar')
71 }
72}
73
Torsten Groteb17a55a2019-06-11 10:25:36 -030074// http://www.31mins.com/android-studio-build-system-application/
Torsten Grote2434fe32019-06-03 12:23:09 -030075preBuild.doLast {
76 def imlFile = file(project.name + ".iml")
Steve Soltyse8720182018-11-07 22:04:37 -050077
Torsten Grote2434fe32019-06-03 12:23:09 -030078 try {
79 def parsedXml = (new XmlParser()).parse(imlFile)
80 def jdkNode = parsedXml.component[1].orderEntry.find { it.'@type' == 'jdk' }
81 parsedXml.component[1].remove(jdkNode)
Steve Soltyse8720182018-11-07 22:04:37 -050082
Torsten Grote2434fe32019-06-03 12:23:09 -030083 def sdkString = "Android API " + android.compileSdkVersion.substring("android-".length()) + " Platform"
84 new Node(parsedXml.component[1], 'orderEntry', ['type': 'jdk', 'jdkName': sdkString, 'jdkType': 'Android SDK'])
85 XmlUtil.serialize(parsedXml, new FileOutputStream(imlFile))
Steve Soltyse8720182018-11-07 22:04:37 -050086
Torsten Grote2434fe32019-06-03 12:23:09 -030087 } catch (NullPointerException | FileNotFoundException ex) {
88 ex.printStackTrace()
Steve Soltyse8720182018-11-07 22:04:37 -050089 }
90}
91
Torsten Grote2ce625a2019-07-09 19:22:24 +020092// To produce these binaries, in latest AOSP source tree, run
93// $ make
94def aospDeps = fileTree(include: [
95 // out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar
96 'android.jar',
97 // out/target/common/obj/JAVA_LIBRARIES/core-libart_intermediates/classes.jar
98 'libcore.jar'
99], dir: 'libs')
100
Steve Soltyse8720182018-11-07 22:04:37 -0500101dependencies {
Torsten Grote2ce625a2019-07-09 19:22:24 +0200102 compileOnly aospDeps
Steve Soltyse8720182018-11-07 22:04:37 -0500103
Torsten Grote3d5911d2019-07-03 19:44:37 +0200104 implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
105
Torsten Grote3981d3d2019-07-03 12:44:12 +0200106 implementation 'commons-io:commons-io:2.6'
Torsten Grote66c09192019-07-05 12:35:45 +0200107 implementation 'io.github.novacrypto:BIP39:2019.01.27'
Torsten Grote7fd38102019-06-07 14:09:55 -0300108
Torsten Grote66c09192019-07-05 12:35:45 +0200109 implementation 'androidx.core:core-ktx:1.0.2'
Torsten Grote3d5911d2019-07-03 19:44:37 +0200110 implementation 'androidx.preference:preference-ktx:1.0.0'
Torsten Grote66c09192019-07-05 12:35:45 +0200111 implementation 'com.google.android.material:material:1.0.0'
Torsten Grote3981d3d2019-07-03 12:44:12 +0200112 implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
Torsten Grote66c09192019-07-05 12:35:45 +0200113 implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Torsten Grote2ce625a2019-07-09 19:22:24 +0200114
115 lintChecks 'com.github.thirdegg:lint-rules:0.0.4-alpha'
116
117 testImplementation aospDeps
118 testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.0'
119 testImplementation 'io.mockk:mockk:1.9.3'
120 testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.0'
Torsten Grotee955e022019-08-06 08:16:37 +0200121
122 androidTestImplementation 'androidx.test:runner:1.2.0'
123 androidTestImplementation 'androidx.test:rules:1.2.0'
Steve Soltyse8720182018-11-07 22:04:37 -0500124}