Merge pull request #170 from zcash/166-included-build
[#166] Included build for SDK development
This commit is contained in:
commit
b59c7a187b
|
@ -78,7 +78,7 @@ android {
|
||||||
// TODO [#6]: Figure out how to move this into the build-conventions
|
// TODO [#6]: Figure out how to move this into the build-conventions
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = libs.versions.java.get()
|
jvmTarget = libs.versions.java.get()
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
}
|
}
|
||||||
|
|
||||||
packagingOptions {
|
packagingOptions {
|
||||||
|
|
|
@ -29,5 +29,3 @@ dependencyResolutionManagement {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rootProject.name = "build-conventions"
|
|
|
@ -23,7 +23,7 @@ pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
|
||||||
targets.all {
|
targets.all {
|
||||||
compilations.all {
|
compilations.all {
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
|
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,6 @@ Start by making sure the command line with Gradle works first, because **all the
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
1. Verify that the Git repo has not been modified. Due to strict dependency locking (for security reasons), the build will fail unless the locks are also updated
|
1. Verify that the Git repo has not been modified. Due to strict dependency locking (for security reasons), the build will fail unless the locks are also updated
|
||||||
1. If you
|
|
||||||
1. Try running from the command line instead of Android Studio, to rule out Android Studio issues. If it works from the command line, try this step to reset Android Studio
|
1. Try running from the command line instead of Android Studio, to rule out Android Studio issues. If it works from the command line, try this step to reset Android Studio
|
||||||
1. Quit Android Studio
|
1. Quit Android Studio
|
||||||
2. Deleting the invisible `.idea` in the root directory of the project
|
2. Deleting the invisible `.idea` in the root directory of the project
|
||||||
|
@ -69,3 +68,19 @@ To enable release signing, a release keystore needs to be provided during the bu
|
||||||
* ZCASH_RELEASE_KEY_ALIAS_PASSWORD
|
* ZCASH_RELEASE_KEY_ALIAS_PASSWORD
|
||||||
|
|
||||||
On a developer machine, these might be set under the user's global properties (e.g. `~/.gradle/gradle.properties` on macOS and Linux). On a continuous integration machine, these can also be set using environment variables with the prefix `ORG_GRADLE_PROJECT_` (e.g. `ORG_GRADLE_PROJECT_ZCASH_RELEASE_KEYSTORE_PATH`). DO NOT set these in the gradle.properties inside the Git repository, as this will leak your keystore password.
|
On a developer machine, these might be set under the user's global properties (e.g. `~/.gradle/gradle.properties` on macOS and Linux). On a continuous integration machine, these can also be set using environment variables with the prefix `ORG_GRADLE_PROJECT_` (e.g. `ORG_GRADLE_PROJECT_ZCASH_RELEASE_KEYSTORE_PATH`). DO NOT set these in the gradle.properties inside the Git repository, as this will leak your keystore password.
|
||||||
|
|
||||||
|
### Included builds
|
||||||
|
To simplify implementation of SDK features in conjunction with changes to the app, a Gradle [Included Build](https://docs.gradle.org/current/userguide/composite_builds.html) can be configured.
|
||||||
|
|
||||||
|
1. Check out the SDK to a directory path of `../zcash-android-sdk` relative to the root of this app's repo. For example:
|
||||||
|
|
||||||
|
parent/
|
||||||
|
secant-android-wallet/
|
||||||
|
zcash-android-sdk/
|
||||||
|
|
||||||
|
1. Verify that the `zcash-android-sdk` builds correctly on its own
|
||||||
|
1. Build `secant-android-wallet`, setting the Gradle property `IS_SDK_INCLUDED_BUILD=true`
|
||||||
|
|
||||||
|
There are some limitations of included builds:
|
||||||
|
1. Properties from `secant-android-wallet` will override those set in `zcash-android-sdk` with the same name
|
||||||
|
1. Modules in each project cannot share the same name. For this reason, build-conventions have different names in each repo (`zcash-android-sdk/build-conventions` vs `secant-android-wallet/build-convention`)
|
|
@ -12,7 +12,7 @@ android.nonTransitiveRClass=true
|
||||||
android.builder.sdkDownload=true
|
android.builder.sdkDownload=true
|
||||||
|
|
||||||
# Kotlin compiler warnings can be considered errors, failing the build.
|
# Kotlin compiler warnings can be considered errors, failing the build.
|
||||||
IS_TREAT_WARNINGS_AS_ERRORS=true
|
ZCASH_IS_TREAT_WARNINGS_AS_ERRORS=true
|
||||||
|
|
||||||
# The app module will crash at launch when coverage is enabled, so coverage is only enabled explicitly for tests.
|
# The app module will crash at launch when coverage is enabled, so coverage is only enabled explicitly for tests.
|
||||||
IS_COVERAGE_ENABLED=false
|
IS_COVERAGE_ENABLED=false
|
||||||
|
@ -48,6 +48,9 @@ ZCASH_GOOGLE_PLAY_SERVICE_KEY_FILE_PATH=
|
||||||
# Deploy commits the build on Google Play, creating a new release
|
# Deploy commits the build on Google Play, creating a new release
|
||||||
ZCASH_GOOGLE_PLAY_DEPLOY_MODE=build
|
ZCASH_GOOGLE_PLAY_DEPLOY_MODE=build
|
||||||
|
|
||||||
|
# Toggles between using the SDK Maven artifact versus an included build
|
||||||
|
IS_SDK_INCLUDED_BUILD=false
|
||||||
|
|
||||||
# Versions
|
# Versions
|
||||||
ANDROID_MIN_SDK_VERSION=24
|
ANDROID_MIN_SDK_VERSION=24
|
||||||
ANDROID_TARGET_SDK_VERSION=31
|
ANDROID_TARGET_SDK_VERSION=31
|
||||||
|
|
|
@ -9,7 +9,7 @@ android {
|
||||||
// TODO [#6]: Figure out how to move this into the build-conventions
|
// TODO [#6]: Figure out how to move this into the build-conventions
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = libs.versions.java.get()
|
jvmTarget = libs.versions.java.get()
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
|
freeCompilerArgs = freeCompilerArgs + "-Xopt-in=kotlin.RequiresOptIn"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ android {
|
||||||
// TODO [#6]: Figure out how to move this into the build-conventions
|
// TODO [#6]: Figure out how to move this into the build-conventions
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = libs.versions.java.get()
|
jvmTarget = libs.versions.java.get()
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
freeCompilerArgs = freeCompilerArgs.plus("-Xopt-in=kotlin.RequiresOptIn")
|
freeCompilerArgs = freeCompilerArgs.plus("-Xopt-in=kotlin.RequiresOptIn")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,7 @@ dependencyResolutionManagement {
|
||||||
|
|
||||||
rootProject.name = "zcash-android-app"
|
rootProject.name = "zcash-android-app"
|
||||||
|
|
||||||
includeBuild("build-conventions")
|
includeBuild("build-convention")
|
||||||
|
|
||||||
include("app")
|
include("app")
|
||||||
include("build-info-lib")
|
include("build-info-lib")
|
||||||
|
@ -157,3 +157,14 @@ include("preference-api-lib")
|
||||||
include("preference-impl-android-lib")
|
include("preference-impl-android-lib")
|
||||||
include("sdk-ext-lib")
|
include("sdk-ext-lib")
|
||||||
include("ui-lib")
|
include("ui-lib")
|
||||||
|
|
||||||
|
if (extra["IS_SDK_INCLUDED_BUILD"].toString().toBoolean()) {
|
||||||
|
// Currently assume the SDK is up one level with a hardcoded directory name
|
||||||
|
// If this becomes problematic, `IS_SDK_INCLUDED_BUILD` could be turned into a path
|
||||||
|
// instead.
|
||||||
|
includeBuild("../zcash-android-sdk") {
|
||||||
|
dependencySubstitution {
|
||||||
|
substitute(module("cash.z.ecc.android:zcash-android-sdk")).using(project(":sdk-lib"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ android {
|
||||||
// TODO [#6]: Figure out how to move this into the build-conventions
|
// TODO [#6]: Figure out how to move this into the build-conventions
|
||||||
kotlinOptions {
|
kotlinOptions {
|
||||||
jvmTarget = libs.versions.java.get()
|
jvmTarget = libs.versions.java.get()
|
||||||
allWarningsAsErrors = project.property("IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
allWarningsAsErrors = project.property("ZCASH_IS_TREAT_WARNINGS_AS_ERRORS").toString().toBoolean()
|
||||||
freeCompilerArgs = freeCompilerArgs.plus("-Xopt-in=kotlin.RequiresOptIn")
|
freeCompilerArgs = freeCompilerArgs.plus("-Xopt-in=kotlin.RequiresOptIn")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue