diff --git a/README.md b/README.md index aad6abb9..bbeca21c 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ If you plan to fork the project to create a new app of your own, please make the 1. Configure secrets for [Continuous Integration](docs/CI.md). # Known Issues - +1. Intel-based machines may have trouble building in Android Studio. The workaround is to add the following line to `~/.gradle/gradle.properties` `ZCASH_IS_DEPENDENCY_LOCKING_ENABLED=false`. See [#420](https://github.com/zcash/secant-android-wallet/issues/420) for more information. 1. During builds, a warning will be printed that says "Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version." This can be safely ignored. The version under build-conventions is the same as the version used elsewhere in the application. 1. When the code coverage Gradle property `IS_ANDROID_INSTRUMENTATION_TEST_COVERAGE_ENABLED` is enabled, the debug app APK cannot be run. The coverage flag should therefore only be set when running automated tests. 1. Test coverage for Compose code will be low, due to [known limitations](https://github.com/jacoco/jacoco/issues/1208) in the interaction between Compose and Jacoco. @@ -43,5 +43,3 @@ If you plan to fork the project to create a new app of your own, please make the 1. Android Studio will warn about the Gradle checksum. This is a [known issue](https://github.com/gradle/gradle/issues/9361) and can be safely ignored. 1. [#96](https://github.com/zcash/secant-android-wallet/issues/96) - Release builds print some R8 warnings which can be safely ignored. 1. During app first launch, the following exception starting with `AndroidKeysetManager: keyset not found, will generate a new one` is printed twice. This exception is not an error, and the code is not being invoked twice. -1. When running instrumentation tests for the app module, this warning will be printed `WARNING: Failed to retrieve additional test outputs from device. -com.android.ddmlib.SyncException: Remote object doesn't exist!` followed by a stacktrace. This can be safely ignored. \ No newline at end of file diff --git a/build-conventions-secant/build.gradle.kts b/build-conventions-secant/build.gradle.kts index a9923797..f43e6be7 100644 --- a/build-conventions-secant/build.gradle.kts +++ b/build-conventions-secant/build.gradle.kts @@ -6,12 +6,35 @@ plugins { buildscript { dependencyLocking { - lockAllConfigurations() + // This property is treated specially, as it is not defined by default in the root gradle.properties + // and declaring it in the root gradle.properties is ignored by included builds. This only picks up + // a value declared as a system property, a command line argument, or a an environment variable. + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } } + dependencyLocking { - lockAllConfigurations() + // This property is treated specially, as it is not defined by default in the root gradle.properties + // and declaring it in the root gradle.properties is ignored by included builds. This only picks up + // a value declared as a system property, a command line argument, or a an environment variable. + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } // Per conversation in the KotlinLang Slack, Gradle uses Java 8 compatibility internally diff --git a/build-conventions-secant/settings.gradle.kts b/build-conventions-secant/settings.gradle.kts index b16268b8..463d07ab 100644 --- a/build-conventions-secant/settings.gradle.kts +++ b/build-conventions-secant/settings.gradle.kts @@ -3,7 +3,7 @@ dependencyResolutionManagement { repositories { val isRepoRestrictionEnabled = true - maven("https://dl.google.com/dl/android/maven2/") { //google() + google { if (isRepoRestrictionEnabled) { content { includeGroup("androidx.navigation") @@ -15,7 +15,7 @@ dependencyResolutionManagement { } } } - maven("https://repo.maven.apache.org/maven2/") { // mavenCentral() + mavenCentral { if (isRepoRestrictionEnabled) { content { excludeGroup("androidx.navigation") diff --git a/build-conventions-secant/src/main/kotlin/secant.dependency-conventions.gradle.kts b/build-conventions-secant/src/main/kotlin/secant.dependency-conventions.gradle.kts index 93add1fc..d0d58f20 100644 --- a/build-conventions-secant/src/main/kotlin/secant.dependency-conventions.gradle.kts +++ b/build-conventions-secant/src/main/kotlin/secant.dependency-conventions.gradle.kts @@ -1,5 +1,13 @@ dependencyLocking { - lockAllConfigurations() + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } tasks { diff --git a/build.gradle.kts b/build.gradle.kts index 8e3cd289..05cfd1c5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,17 @@ buildscript { dependencyLocking { - lockMode.set(LockMode.STRICT) - lockAllConfigurations() + // This property is treated specially, as it is not defined by default in the root gradle.properties + // and declaring it in the root gradle.properties is ignored by included builds. This only picks up + // a value declared as a system property, a command line argument, or a an environment variable. + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } } diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 0b675bf4..64930d56 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -6,12 +6,35 @@ plugins { buildscript { dependencyLocking { - lockAllConfigurations() + // This property is treated specially, as it is not defined by default in the root gradle.properties + // and declaring it in the root gradle.properties is ignored by included builds. This only picks up + // a value declared as a system property, a command line argument, or a an environment variable. + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } } + dependencyLocking { - lockAllConfigurations() + // This property is treated specially, as it is not defined by default in the root gradle.properties + // and declaring it in the root gradle.properties is ignored by included builds. This only picks up + // a value declared as a system property, a command line argument, or a an environment variable. + val isDependencyLockingEnabled = if (project.hasProperty("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED")) { + project.property("ZCASH_IS_DEPENDENCY_LOCKING_ENABLED").toString().toBoolean() + } else { + true + } + + if (isDependencyLockingEnabled) { + lockAllConfigurations() + } } // Per conversation in the KotlinLang Slack, Gradle uses Java 8 compatibility internally diff --git a/docs/Setup.md b/docs/Setup.md index 82a42e3f..f639b2f0 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -14,7 +14,7 @@ Start by making sure the command line with Gradle works first, because **all the 1. Install JVM 11 or greater on your system. Our setup has been tested with Java 11-17. Although a variety of JVM distributions are available and should work, we have settled on recommending [Adoptium/Temurin](https://adoptium.net), because this is the default distribution used by Gradle toolchains. For Windows or Linux, be sure that the `JAVA_HOME` environment variable points to the right Java version. Note: If you switch from a newer to an older JVM version, you may see an error like the following `> com.android.ide.common.signing.KeytoolException: Failed to read key AndroidDebugKey from store "~/.android/debug.keystore": Integrity check failed: java.security.NoSuchAlgorithmException: Algorithm HmacPBESHA256 not available`. A solution is to delete the debug keystore and allow it to be re-generated. 1. Android Studio has an embedded JVM, although running Gradle tasks from the command line requires a separate JVM to be installed. Our Gradle scripts are configured to use toolchains to automatically install the correct JVM version. 1. Install Android Studio and the Android SDK - 1. Download [Android Studio](https://developer.android.com/studio/). We typically use the stable version of Android Studio, unless specifically noted due to short-term known issues. For example, due to issue #420 Intel-based machines should avoid Android Studio Chipmunk and use Android Studio Dolphin instead. + 1. Download [Android Studio](https://developer.android.com/studio/). We typically use the stable version of Android Studio, unless specifically noted due to short-term known issues. Note that due to issue #420 Intel-based machines may have trouble building in Android Studio. The workaround is to add the following line to `~/.gradle/gradle.properties` `ZCASH_IS_DEPENDENCY_LOCKING_ENABLED=false`. 1. During the Android Studio setup wizard, choose the "Standard" setup option 1. Note the file path where Android Studio will install the Android developer tools, as you will need this path later 1. Continue and let Android Studio download and install the rest of the Android developer tools