Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 1 | import groovy.xml.XmlUtil |
| 2 | |
| 3 | apply plugin: 'com.android.application' |
Torsten Grote | 3d5911d | 2019-07-03 19:44:37 +0200 | [diff] [blame] | 4 | apply plugin: 'kotlin-android' |
| 5 | apply plugin: 'kotlin-android-extensions' |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 6 | |
| 7 | android { |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 8 | |
Steve Soltys | df0b3d6 | 2019-02-11 22:00:33 -0500 | [diff] [blame] | 9 | compileSdkVersion 28 |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 10 | buildToolsVersion '28.0.3' |
| 11 | |
| 12 | defaultConfig { |
| 13 | minSdkVersion 26 |
Torsten Grote | b17a55a | 2019-06-11 10:25:36 -0300 | [diff] [blame] | 14 | targetSdkVersion 28 |
Torsten Grote | e955e02 | 2019-08-06 08:16:37 +0200 | [diff] [blame] | 15 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 16 | } |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 17 | |
| 18 | buildTypes { |
| 19 | release { |
| 20 | minifyEnabled false |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 21 | } |
| 22 | } |
| 23 | |
| 24 | lintOptions { |
| 25 | abortOnError false |
| 26 | } |
| 27 | compileOptions { |
| 28 | targetCompatibility 1.8 |
| 29 | sourceCompatibility 1.8 |
| 30 | } |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 31 | testOptions { |
| 32 | unitTests.all { |
| 33 | useJUnitPlatform() |
| 34 | testLogging { |
| 35 | events "passed", "skipped", "failed" |
| 36 | } |
| 37 | } |
| 38 | } |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 39 | |
Torsten Grote | 74aa62a | 2019-08-20 13:04:09 +0200 | [diff] [blame^] | 40 | sourceSets { |
| 41 | test { |
| 42 | java.srcDirs += "$projectDir/src/sharedTest/java" |
| 43 | } |
| 44 | androidTest { |
| 45 | java.srcDirs += "$projectDir/src/sharedTest/java" |
| 46 | } |
| 47 | } |
| 48 | |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 49 | // 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 Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 64 | buildTypes.debug.signingConfig = signingConfigs.release |
Torsten Grote | d1f5986 | 2019-06-03 15:51:58 -0300 | [diff] [blame] | 65 | } |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 66 | } |
| 67 | |
| 68 | gradle.projectsEvaluated { |
| 69 | tasks.withType(JavaCompile) { |
| 70 | options.compilerArgs.add('-Xbootclasspath/p:app/libs/android.jar:app/libs/libcore.jar') |
| 71 | } |
| 72 | } |
| 73 | |
Torsten Grote | b17a55a | 2019-06-11 10:25:36 -0300 | [diff] [blame] | 74 | // http://www.31mins.com/android-studio-build-system-application/ |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 75 | preBuild.doLast { |
| 76 | def imlFile = file(project.name + ".iml") |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 77 | |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 78 | 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 Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 82 | |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 83 | 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 Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 86 | |
Torsten Grote | 2434fe3 | 2019-06-03 12:23:09 -0300 | [diff] [blame] | 87 | } catch (NullPointerException | FileNotFoundException ex) { |
| 88 | ex.printStackTrace() |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 92 | // To produce these binaries, in latest AOSP source tree, run |
| 93 | // $ make |
| 94 | def 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 Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 101 | dependencies { |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 102 | compileOnly aospDeps |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 103 | |
Torsten Grote | 3d5911d | 2019-07-03 19:44:37 +0200 | [diff] [blame] | 104 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" |
| 105 | |
Torsten Grote | 3981d3d | 2019-07-03 12:44:12 +0200 | [diff] [blame] | 106 | implementation 'commons-io:commons-io:2.6' |
Torsten Grote | 66c0919 | 2019-07-05 12:35:45 +0200 | [diff] [blame] | 107 | implementation 'io.github.novacrypto:BIP39:2019.01.27' |
Torsten Grote | 7fd3810 | 2019-06-07 14:09:55 -0300 | [diff] [blame] | 108 | |
Torsten Grote | 66c0919 | 2019-07-05 12:35:45 +0200 | [diff] [blame] | 109 | implementation 'androidx.core:core-ktx:1.0.2' |
Torsten Grote | 3d5911d | 2019-07-03 19:44:37 +0200 | [diff] [blame] | 110 | implementation 'androidx.preference:preference-ktx:1.0.0' |
Torsten Grote | 66c0919 | 2019-07-05 12:35:45 +0200 | [diff] [blame] | 111 | implementation 'com.google.android.material:material:1.0.0' |
Torsten Grote | 3981d3d | 2019-07-03 12:44:12 +0200 | [diff] [blame] | 112 | implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0' |
Torsten Grote | 66c0919 | 2019-07-05 12:35:45 +0200 | [diff] [blame] | 113 | implementation 'androidx.constraintlayout:constraintlayout:1.1.3' |
Torsten Grote | 2ce625a | 2019-07-09 19:22:24 +0200 | [diff] [blame] | 114 | |
| 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 Grote | e955e02 | 2019-08-06 08:16:37 +0200 | [diff] [blame] | 121 | |
| 122 | androidTestImplementation 'androidx.test:runner:1.2.0' |
| 123 | androidTestImplementation 'androidx.test:rules:1.2.0' |
Steve Soltys | e872018 | 2018-11-07 22:04:37 -0500 | [diff] [blame] | 124 | } |