2020-06-10 00:08:19 -07:00
import cash.z.ecc.android.Deps
2018-11-20 23:01:45 -08:00
buildscript {
2018-11-20 23:04:53 -08:00
ext . buildConfig = [
2019-08-30 10:05:02 -07:00
'compileSdkVersion' : 29 ,
2018-11-20 23:04:53 -08:00
'minSdkVersion' : 16 ,
2019-08-30 10:05:02 -07:00
'targetSdkVersion' : 29
2018-11-20 23:04:53 -08:00
]
ext . versions = [
2019-03-12 10:05:38 -07:00
'architectureComponents' : [
2020-02-11 17:31:56 -08:00
'lifecycle' : '2.2.0' ,
2020-06-09 18:56:49 -07:00
'room' : '2.2.5' ,
'paging' : '2.1.2'
2019-03-12 10:05:38 -07:00
] ,
2020-02-21 15:16:25 -08:00
'grpc' : '1.25.0' , // NOTE: cannot use a higher version because they use protobuf 3.10+ which is not compatible with 3.0+ so we'd have to implement changes in our protobuf files which breaks everything
2020-09-11 00:35:32 -07:00
'coroutines' : '1.3.9' ,
2020-06-09 18:56:49 -07:00
'junitJupiter' : '5.6.1'
2018-11-20 23:04:53 -08:00
]
2018-11-20 23:01:45 -08:00
repositories {
google ( )
jcenter ( )
2019-04-18 15:56:52 -07:00
maven {
url 'https://jitpack.io'
}
2020-06-09 18:56:49 -07:00
maven {
url "https://plugins.gradle.org/m2/"
}
2018-11-20 23:01:45 -08:00
}
dependencies {
2020-11-20 12:56:06 -08:00
classpath 'com.android.tools.build:gradle:4.0.2'
2020-09-11 00:35:32 -07:00
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${Deps.kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-allopen:${Deps.kotlinVersion}"
2020-02-11 17:31:56 -08:00
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.10.1"
2020-09-11 00:35:32 -07:00
classpath "com.github.ben-manes:gradle-versions-plugin:0.31.0"
2018-11-21 01:48:26 -08:00
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
2020-09-11 00:35:32 -07:00
classpath "com.google.protobuf:protobuf-gradle-plugin:0.8.13"
2020-02-11 17:31:56 -08:00
classpath 'com.getkeepsafe.dexcount:dexcount-gradle-plugin:1.0.2'
2019-07-26 13:55:50 -07:00
classpath 'com.github.str4d:rust-android-gradle:68b4ecc053'
2020-09-11 00:35:32 -07:00
classpath 'org.owasp:dependency-check-gradle:6.0.0'
2020-06-09 18:56:49 -07:00
classpath "gradle.plugin.com.dorongold.plugins:task-tree:1.5"
2020-06-10 02:59:40 -07:00
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5'
2018-11-20 23:01:45 -08:00
}
}
2018-11-20 23:04:53 -08:00
apply from: 'custom-tasks.gradle'
2020-06-10 02:59:40 -07:00
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
2018-11-20 23:04:53 -08:00
apply plugin: 'com.android.library'
2019-03-28 23:31:25 -07:00
apply plugin: 'kotlin-android'
2019-08-30 10:05:02 -07:00
apply plugin: 'kotlin-android-extensions'
2018-11-27 22:43:36 -08:00
apply plugin: 'kotlin-kapt'
2019-01-23 02:45:26 -08:00
apply plugin: 'kotlin-allopen'
2019-03-28 23:31:25 -07:00
apply plugin: 'org.jetbrains.dokka'
2019-01-02 21:31:12 -08:00
apply plugin: 'com.google.protobuf'
2018-11-21 01:48:26 -08:00
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'com.github.dcendents.android-maven'
2019-02-05 10:19:06 -08:00
apply plugin: 'com.getkeepsafe.dexcount'
2019-04-18 15:56:52 -07:00
apply plugin: 'org.mozilla.rust-android-gradle.rust-android'
2019-06-17 02:01:29 -07:00
apply plugin: 'org.owasp.dependencycheck'
2020-06-09 18:56:49 -07:00
apply plugin: "com.dorongold.task-tree"
apply from: 'ci.gradle'
2020-06-10 02:59:40 -07:00
apply from: 'publish.gradle'
2018-11-21 01:48:26 -08:00
2020-06-10 00:08:19 -07:00
group = Deps . group
version = Deps . versionName
2018-11-20 23:04:53 -08:00
2018-11-20 23:01:45 -08:00
repositories {
google ( )
2018-11-20 23:04:53 -08:00
jcenter ( )
2020-02-11 17:31:56 -08:00
maven { url 'https://jitpack.io' }
2018-11-20 09:59:08 -08:00
}
android {
2019-03-28 23:03:11 -07:00
compileSdkVersion buildConfig . compileSdkVersion
useLibrary 'android.test.runner'
2018-11-20 09:59:08 -08:00
2020-06-09 18:56:49 -07:00
ndkVersion "21.1.6352462"
2018-11-20 09:59:08 -08:00
defaultConfig {
2019-03-28 23:03:11 -07:00
minSdkVersion buildConfig . minSdkVersion
targetSdkVersion buildConfig . targetSdkVersion
2020-06-10 00:08:19 -07:00
versionCode = Deps . versionCode
versionName = Deps . versionName
2018-11-27 21:49:03 -08:00
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2019-03-28 23:03:11 -07:00
testInstrumentationRunnerArguments clearPackageData: 'true'
multiDexEnabled true
2020-09-11 02:16:45 -07:00
archivesBaseName = "zcash-android-sdk-${Deps.versionName}"
2020-02-21 15:16:25 -08:00
javaCompileOptions {
annotationProcessorOptions {
arguments = [ "room.schemaLocation" : "$projectDir/schemas" . toString ( ) ]
}
}
2018-11-20 09:59:08 -08:00
}
buildTypes {
2019-03-28 23:03:11 -07:00
debug {
// for test builds, which exceed the dex limit because they pull in things like mockito and grpc-testing
multiDexEnabled true
2019-06-14 16:04:18 -07:00
minifyEnabled false
2019-03-28 23:03:11 -07:00
proguardFiles getDefaultProguardFile ( "proguard-android-optimize.txt" ) , "proguard-rules.pro"
}
2018-11-20 23:04:53 -08:00
release {
2019-03-28 23:03:11 -07:00
multiDexEnabled false
2019-06-14 16:04:18 -07:00
minifyEnabled false
2018-11-20 23:04:53 -08:00
proguardFiles getDefaultProguardFile ( "proguard-android-optimize.txt" ) , "proguard-rules.pro"
}
}
2019-03-28 23:03:11 -07:00
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'
}
}
2018-11-20 23:04:53 -08:00
sourceSets {
main {
java {
2019-01-02 21:31:12 -08:00
srcDirs "build/generated/source/grpc"
}
proto {
srcDir 'src/main/proto'
2018-11-20 23:04:53 -08:00
}
2018-11-20 09:59:08 -08:00
}
}
2019-02-19 10:09:01 -08:00
compileOptions {
2019-02-24 11:17:29 -08:00
sourceCompatibility JavaVersion . VERSION_1_8
targetCompatibility JavaVersion . VERSION_1_8
2019-02-19 10:09:01 -08:00
}
2019-01-13 07:37:23 -08:00
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'
}
2018-11-20 09:59:08 -08:00
}
2019-01-23 02:45:26 -08:00
allOpen {
// marker for classes that we want to be able to extend in debug builds for testing purposes
2020-06-10 00:08:19 -07:00
annotation 'cash.z.ecc.android.sdk.annotation.OpenClass'
2019-01-23 02:45:26 -08:00
}
2019-01-02 21:31:12 -08:00
clean {
delete "$project.projectDir/src/generated/source/grpc"
}
2019-03-28 23:31:25 -07:00
dokka {
2020-03-25 14:56:27 -07:00
outputFormat = 'html'
outputDirectory = "$buildDir/docs/rtd"
2019-03-28 23:31:25 -07:00
}
2019-01-02 21:31:12 -08:00
protobuf {
generatedFilesBaseDir = "$projectDir/src/generated/source/grpc"
2019-03-28 23:03:11 -07:00
protoc { artifact = 'com.google.protobuf:protoc:3.7.1' }
2019-01-02 21:31:12 -08:00
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
2019-03-28 23:03:11 -07:00
option 'lite'
}
2019-01-02 21:31:12 -08:00
}
}
}
}
2019-04-18 15:56:52 -07:00
cargo {
module = "."
libname = "zcashwalletsdk"
targets = [
"arm" ,
"arm64" ,
"x86" ,
2020-06-11 11:00:06 -07:00
"x86_64"
2019-04-18 15:56:52 -07:00
]
profile = "release"
forceTargets = true
2019-11-26 12:46:31 -08:00
prebuiltToolchains = true
2019-07-26 13:55:50 -07:00
variants {
zcashmainnetDebug {
defaultFeaturesAnd ( "mainnet" )
}
zcashmainnetRelease {
defaultFeaturesAnd ( "mainnet" )
}
2020-06-10 02:59:40 -07:00
zcashtestnetDebug {
}
zcashtestnetRelease {
}
2019-07-26 13:55:50 -07:00
}
2019-04-18 15:56:52 -07:00
}
2018-11-20 09:59:08 -08:00
dependencies {
2019-07-12 01:47:17 -07:00
2020-09-11 00:35:32 -07:00
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
2018-11-20 23:04:53 -08:00
2019-03-12 10:05:38 -07:00
// Architecture Components: Lifecycle
implementation "androidx.lifecycle:lifecycle-runtime:${versions.architectureComponents.lifecycle}"
implementation "androidx.lifecycle:lifecycle-extensions:${versions.architectureComponents.lifecycle}"
2019-06-17 02:01:29 -07:00
implementation "androidx.lifecycle:lifecycle-common-java8:${versions.architectureComponents.lifecycle}"
2019-03-12 10:05:38 -07:00
// Architecture Components: Room
implementation "androidx.room:room-runtime:${versions.architectureComponents.room}"
implementation "androidx.room:room-common:${versions.architectureComponents.room}"
2019-11-01 13:25:28 -07:00
implementation "androidx.room:room-ktx:${versions.architectureComponents.room}"
2019-10-21 03:26:02 -07:00
implementation "androidx.paging:paging-runtime-ktx:${versions.architectureComponents.paging}"
2019-03-12 10:05:38 -07:00
kapt "androidx.room:room-compiler:${versions.architectureComponents.room}"
2018-11-27 22:43:36 -08:00
2019-03-12 10:05:38 -07:00
// Kotlin
2020-09-11 00:35:32 -07:00
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${Deps.kotlinVersion}"
2019-01-02 21:31:12 -08:00
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}"
2019-06-17 02:01:29 -07:00
implementation "io.grpc:grpc-android:${versions.grpc}"
2019-01-02 21:31:12 -08:00
implementation "io.grpc:grpc-protobuf-lite:${versions.grpc}"
implementation "io.grpc:grpc-stub:${versions.grpc}"
2019-02-14 13:43:06 -08:00
implementation 'javax.annotation:javax.annotation-api:1.3.2'
2019-03-28 23:03:11 -07:00
// 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'
2018-11-28 15:15:36 -08:00
// Tests
2019-03-28 23:03:11 -07:00
testImplementation 'androidx.multidex:multidex:2.0.1'
2020-09-11 00:35:32 -07:00
testImplementation "org.jetbrains.kotlin:kotlin-reflect:${Deps.kotlinVersion}"
testImplementation 'org.mockito:mockito-junit-jupiter:3.5.10'
2020-02-11 17:31:56 -08:00
testImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
2019-02-14 13:43:06 -08:00
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}"
2019-03-12 10:05:38 -07:00
testImplementation "io.grpc:grpc-testing:${versions.grpc}"
2019-02-14 13:43:06 -08:00
2019-02-24 11:17:29 -08:00
// 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."
2020-02-11 17:31:56 -08:00
androidTestImplementation 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0'
2020-09-11 00:35:32 -07:00
androidTestImplementation 'org.mockito:mockito-android:3.5.10'
androidTestImplementation "androidx.test:runner:1.3.0"
androidTestImplementation "androidx.test:core:1.3.0"
2019-10-21 03:26:02 -07:00
androidTestImplementation "androidx.arch.core:core-testing:2.1.0"
2020-09-11 00:35:32 -07:00
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test:runner:1.3.0'
2020-02-11 17:31:56 -08:00
// sample mnemonic plugin
2020-06-09 18:56:49 -07:00
androidTestImplementation 'com.github.zcash:zcash-android-wallet-plugins:1.0.1'
2020-11-20 11:14:43 -08:00
androidTestImplementation 'cash.z.ecc.android:kotlin-bip39:1.0.1'
2018-11-20 23:01:45 -08:00
}
2018-11-20 23:04:53 -08:00
2020-06-09 18:56:49 -07:00
taskTree {
noRepeat = true //do not print a sub-tree in the task-tree more than once
impliesSubProjects = true //do not print task-tree for child projects in a multi-project
taskDepth = 2 // limit tree depth to 3. Equivalent to running with the --task-depth option.
}
defaultTasks 'ciBuild'
2019-01-02 21:31:12 -08:00
preBuild . dependsOn includeDirBugFix
2020-06-09 20:28:21 -07:00
check . dependsOn dependencyCheckAggregate