238 lines
8.4 KiB
Groovy
238 lines
8.4 KiB
Groovy
buildscript {
|
|
ext.buildConfig = [
|
|
'compileSdkVersion': 28,
|
|
'minSdkVersion': 16,
|
|
'targetSdkVersion': 28
|
|
]
|
|
ext.versions = [
|
|
'architectureComponents': [
|
|
'lifecycle': '2.1.0-alpha03',
|
|
'room': '2.1.0-alpha06'
|
|
],
|
|
'grpc':'1.19.0',
|
|
'kotlin': '1.3.21',
|
|
'coroutines': '1.1.1',
|
|
'junitJupiter': '5.5.0-M1'
|
|
]
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
maven {
|
|
url 'https://jitpack.io'
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:3.5.0-alpha09'
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${versions.kotlin}"
|
|
classpath "org.jetbrains.kotlin:kotlin-allopen:${versions.kotlin}"
|
|
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.18"
|
|
classpath "com.github.ben-manes:gradle-versions-plugin:0.21.0"
|
|
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
|
|
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.8"
|
|
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:0.8.6'
|
|
classpath 'com.github.str4d:rust-android-gradle:68b4ecc053'
|
|
}
|
|
}
|
|
|
|
apply from: 'custom-tasks.gradle'
|
|
apply plugin: 'com.android.library'
|
|
apply plugin: 'kotlin-android-extensions'
|
|
apply plugin: 'kotlin-android'
|
|
apply plugin: 'kotlin-kapt'
|
|
apply plugin: 'kotlin-allopen'
|
|
apply plugin: 'org.jetbrains.dokka'
|
|
apply plugin: 'com.google.protobuf'
|
|
apply plugin: 'com.github.ben-manes.versions'
|
|
apply plugin: 'com.github.dcendents.android-maven'
|
|
apply plugin: 'com.getkeepsafe.dexcount'
|
|
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
|
|
|
|
group = 'cash.z.android.wallet'
|
|
version = '1.7.4'
|
|
|
|
repositories {
|
|
google()
|
|
jcenter()
|
|
}
|
|
|
|
android {
|
|
compileSdkVersion buildConfig.compileSdkVersion
|
|
|
|
useLibrary 'android.test.runner'
|
|
|
|
defaultConfig {
|
|
minSdkVersion buildConfig.minSdkVersion
|
|
targetSdkVersion buildConfig.targetSdkVersion
|
|
versionCode = 1_07_05_00 // last digits are alpha(0X) beta(1X) rc(2X) release(3X). Ex: 1_08_04_20 is a RC build
|
|
versionName = "$version-alpha"
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
|
testInstrumentationRunnerArguments clearPackageData: 'true'
|
|
multiDexEnabled true
|
|
archivesBaseName = "zcash-android-wallet-sdk-$versionName"
|
|
}
|
|
|
|
buildTypes {
|
|
debug {
|
|
// for test builds, which exceed the dex limit because they pull in things like mockito and grpc-testing
|
|
multiDexEnabled true
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
|
}
|
|
release {
|
|
multiDexEnabled false
|
|
minifyEnabled true
|
|
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
|
|
}
|
|
}
|
|
|
|
flavorDimensions 'network'
|
|
|
|
productFlavors {
|
|
// would rather name them "testnet" and "mainnet" but product flavor names cannot start with the word "test"
|
|
zcashtestnet {
|
|
dimension 'network'
|
|
}
|
|
|
|
zcashmainnet {
|
|
dimension 'network'
|
|
}
|
|
}
|
|
|
|
sourceSets {
|
|
main {
|
|
java {
|
|
srcDirs "build/generated/source/grpc"
|
|
}
|
|
proto {
|
|
srcDir 'src/main/proto'
|
|
}
|
|
}
|
|
}
|
|
compileOptions {
|
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
}
|
|
packagingOptions {
|
|
exclude 'META-INF/DEPENDENCIES'
|
|
exclude 'META-INF/LICENSE'
|
|
exclude 'META-INF/LICENSE.txt'
|
|
exclude 'META-INF/license.txt'
|
|
exclude 'META-INF/NOTICE'
|
|
exclude 'META-INF/NOTICE.txt'
|
|
exclude 'META-INF/notice.txt'
|
|
exclude 'META-INF/ASL2.0'
|
|
exclude 'META-INF/LICENSE.md'
|
|
exclude 'META-INF/LICENSE-notice.md'
|
|
}
|
|
}
|
|
|
|
allOpen {
|
|
// marker for classes that we want to be able to extend in debug builds for testing purposes
|
|
annotation 'cash.z.wallet.sdk.annotation.OpenClass'
|
|
}
|
|
|
|
clean {
|
|
delete "$project.projectDir/src/generated/source/grpc"
|
|
}
|
|
|
|
dokka {
|
|
outputFormat = 'gfm'
|
|
outputDirectory = "$buildDir/docs"
|
|
}
|
|
|
|
protobuf {
|
|
generatedFilesBaseDir = "$projectDir/src/generated/source/grpc"
|
|
protoc { artifact = 'com.google.protobuf:protoc:3.7.1' }
|
|
plugins {
|
|
javalite { artifact = "com.google.protobuf:protoc-gen-javalite:3.0.0" }
|
|
grpc { artifact = "io.grpc:protoc-gen-grpc-java:${versions.grpc}" }
|
|
}
|
|
generateProtoTasks {
|
|
all().each { task ->
|
|
task.plugins {
|
|
javalite {}
|
|
grpc { // Options added to --grpc_out
|
|
option 'lite'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
cargo {
|
|
module = "."
|
|
libname = "zcashwalletsdk"
|
|
targets = [
|
|
"arm",
|
|
"arm64",
|
|
"x86",
|
|
]
|
|
profile = "release"
|
|
forceTargets = true
|
|
|
|
variants {
|
|
zcashmainnetDebug {
|
|
defaultFeaturesAnd("mainnet")
|
|
}
|
|
|
|
zcashmainnetRelease {
|
|
defaultFeaturesAnd("mainnet")
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'androidx.appcompat:appcompat:1.1.0-alpha03'
|
|
|
|
// Architecture Components: Lifecycle
|
|
implementation "androidx.lifecycle:lifecycle-runtime:${versions.architectureComponents.lifecycle}"
|
|
implementation "androidx.lifecycle:lifecycle-extensions:${versions.architectureComponents.lifecycle}"
|
|
kapt "androidx.lifecycle:lifecycle-compiler:${versions.architectureComponents.lifecycle}"
|
|
|
|
// Architecture Components: Room
|
|
implementation "androidx.room:room-runtime:${versions.architectureComponents.room}"
|
|
implementation "androidx.room:room-common:${versions.architectureComponents.room}"
|
|
kapt "androidx.room:room-compiler:${versions.architectureComponents.room}"
|
|
|
|
// Kotlin
|
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:${versions.coroutines}"
|
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.coroutines}"
|
|
|
|
// grpc-java
|
|
implementation "io.grpc:grpc-okhttp:${versions.grpc}"
|
|
implementation "io.grpc:grpc-protobuf-lite:${versions.grpc}"
|
|
implementation "io.grpc:grpc-stub:${versions.grpc}"
|
|
implementation 'javax.annotation:javax.annotation-api:1.3.2'
|
|
// solves error: Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules jetified-guava-26.0-android.jar (com.google.guava:guava:26.0-android) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0)
|
|
// per this recommendation from Chris Povirk, given guava's decision to split ListenableFuture away from Guava: https://groups.google.com/d/msg/guava-discuss/GghaKwusjcY/bCIAKfzOEwAJ
|
|
implementation 'com.google.guava:guava:27.0.1-android'
|
|
|
|
// Other
|
|
implementation "com.jakewharton.timber:timber:4.7.1"
|
|
|
|
// Tests
|
|
testImplementation 'androidx.multidex:multidex:2.0.1'
|
|
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${versions.kotlin}"
|
|
testImplementation 'org.mockito:mockito-junit-jupiter:2.25.1'
|
|
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
|
|
testImplementation "org.junit.jupiter:junit-jupiter-api:${versions.junitJupiter}"
|
|
testImplementation "org.junit.jupiter:junit-jupiter-engine:${versions.junitJupiter}"
|
|
testImplementation "org.junit.jupiter:junit-jupiter-migrationsupport:${versions.junitJupiter}"
|
|
testImplementation "io.grpc:grpc-testing:${versions.grpc}"
|
|
|
|
// NOTE: androidTests will use JUnit4, while src/test/java tests will leverage Junit5
|
|
// Attempting to use JUnit5 via https://github.com/mannodermaus/android-junit5 was painful. The plugin configuration
|
|
// was buggy, crashing in several places. It also would require a separate test flavor because it's minimum API 26
|
|
// because "JUnit 5 uses Java 8-specific APIs that didn't exist on Android before the Oreo release."
|
|
androidTestImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.1.0'
|
|
androidTestImplementation 'org.mockito:mockito-android:2.25.1'
|
|
androidTestImplementation "androidx.test:runner:1.1.2-alpha02"
|
|
androidTestImplementation "androidx.test:core:1.1.1-alpha02"
|
|
androidTestImplementation "androidx.arch.core:core-testing:2.0.1"
|
|
androidTestImplementation 'androidx.test.ext:junit:1.1.1-alpha02'
|
|
androidTestImplementation 'androidx.test:runner:1.1.1'
|
|
}
|
|
|
|
preBuild.dependsOn includeDirBugFix
|