From 66750a58b15396fe8f187f83ea2e402217b15722 Mon Sep 17 00:00:00 2001 From: Carter Jernigan Date: Fri, 3 Dec 2021 08:16:24 -0500 Subject: [PATCH] [#88] Kotlin 1.6 Updating the Compose compiler must happen in lockstep with the Kotlin version, because they are tightly coupled Kotlin 1.6 also fixes some annoying issues with Java 17, which will make first-time setup less error prone for new contributors --- README.md | 3 +- ...multiplatform-build-conventions.gradle.kts | 5 --- buildscript-gradle.lockfile | 41 +++++++++---------- docs/Setup.md | 6 +-- gradle.properties | 9 ++-- 5 files changed, 28 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 45e5629c..2f02c767 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,6 @@ If you plan to fork the project to create a new app of your own, please make the 1. Remove any copyrighted ZCash or Electric Coin Company icons, logos, or assets 1. Change the package name 1. Under [app/build.gradle.kts](app/build.gradle.kts), change the package name of the application - 1. Under [app/proguard-project.txt](app/proguard-project.txt), change the `-repackageclasses` directive to your own package name # Known Issues @@ -38,4 +37,4 @@ 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. The task `ktlintFormat` fails on Java 16 or greater. As a workaround, the task is run under Java 11. This requires that JDK 11 be installed, even if a newer JDK is also installed. While this is configured to use the Java toolchain API, [toolchain support for Java 11 does not work on Apple Silicon](https://github.com/gradle/gradle/issues/19140). [Azul Zulu](https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk) does offer JDK 11, which must be installed manually to run this task from the command line on Apple Silicon. \ No newline at end of file +1. The task `ktlintFormat` fails on Java 16 and greater. As a workaround, the task is run under Java 11. This requires that JDK 11 be installed, even if a newer JDK is also installed. While this is configured to use the Java toolchain API, [toolchain support for Java 11 does not work on Apple Silicon](https://github.com/gradle/gradle/issues/19140). [Azul Zulu](https://www.azul.com/downloads/?os=macos&architecture=arm-64-bit&package=jdk) does offer JDK 11, which must be installed manually to run this task from the command line on Apple Silicon. \ No newline at end of file diff --git a/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts b/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts index 1cf140ab..e987851c 100644 --- a/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts +++ b/build-conventions/src/main/kotlin/zcash.kotlin-multiplatform-build-conventions.gradle.kts @@ -28,10 +28,5 @@ pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { } } } - - sourceSets.all { - // Configure opt-in to various Kotlin APIs - // languageSettings.optIn("kotlin.time.ExperimentalTime") - } } } diff --git a/buildscript-gradle.lockfile b/buildscript-gradle.lockfile index 37d0493b..6089c8cb 100644 --- a/buildscript-gradle.lockfile +++ b/buildscript-gradle.lockfile @@ -115,33 +115,32 @@ org.glassfish.jaxb:jaxb-runtime:2.3.2=classpath org.glassfish.jaxb:txw2:2.3.2=classpath org.jdom:jdom2:2.0.6=classpath org.jetbrains.intellij.deps:trove4j:1.0.20181211=classpath -org.jetbrains.kotlin:kotlin-android-extensions:1.5.31=classpath -org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.5.31=classpath -org.jetbrains.kotlin:kotlin-build-common:1.5.31=classpath -org.jetbrains.kotlin:kotlin-compiler-embeddable:1.5.31=classpath -org.jetbrains.kotlin:kotlin-compiler-runner:1.5.31=classpath -org.jetbrains.kotlin:kotlin-daemon-client:1.5.31=classpath -org.jetbrains.kotlin:kotlin-daemon-embeddable:1.5.31=classpath -org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.5.31=classpath -org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.5.31=classpath -org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31=classpath -org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.5.31=classpath -org.jetbrains.kotlin:kotlin-native-utils:1.5.31=classpath -org.jetbrains.kotlin:kotlin-project-model:1.5.31=classpath +org.jetbrains.kotlin:kotlin-android-extensions:1.6.0=classpath +org.jetbrains.kotlin:kotlin-annotation-processing-gradle:1.6.0=classpath +org.jetbrains.kotlin:kotlin-build-common:1.6.0=classpath +org.jetbrains.kotlin:kotlin-compiler-embeddable:1.6.0=classpath +org.jetbrains.kotlin:kotlin-compiler-runner:1.6.0=classpath +org.jetbrains.kotlin:kotlin-daemon-client:1.6.0=classpath +org.jetbrains.kotlin:kotlin-daemon-embeddable:1.6.0=classpath +org.jetbrains.kotlin:kotlin-gradle-plugin-api:1.6.0=classpath +org.jetbrains.kotlin:kotlin-gradle-plugin-model:1.6.0=classpath +org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.0=classpath +org.jetbrains.kotlin:kotlin-klib-commonizer-api:1.6.0=classpath +org.jetbrains.kotlin:kotlin-native-utils:1.6.0=classpath +org.jetbrains.kotlin:kotlin-project-model:1.6.0=classpath org.jetbrains.kotlin:kotlin-reflect:1.5.31=classpath -org.jetbrains.kotlin:kotlin-scripting-common:1.5.31=classpath -org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.5.31=classpath -org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.5.31=classpath -org.jetbrains.kotlin:kotlin-scripting-jvm:1.5.31=classpath +org.jetbrains.kotlin:kotlin-scripting-common:1.6.0=classpath +org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:1.6.0=classpath +org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:1.6.0=classpath +org.jetbrains.kotlin:kotlin-scripting-jvm:1.6.0=classpath org.jetbrains.kotlin:kotlin-stdlib-common:1.5.31=classpath org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.5.31=classpath org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.5.31=classpath org.jetbrains.kotlin:kotlin-stdlib:1.5.31=classpath -org.jetbrains.kotlin:kotlin-tooling-metadata:1.5.31=classpath -org.jetbrains.kotlin:kotlin-util-io:1.5.31=classpath -org.jetbrains.kotlin:kotlin-util-klib:1.5.31=classpath +org.jetbrains.kotlin:kotlin-tooling-metadata:1.6.0=classpath +org.jetbrains.kotlin:kotlin-util-io:1.6.0=classpath +org.jetbrains.kotlin:kotlin-util-klib:1.6.0=classpath org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.5.0=classpath -org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.0=classpath org.jetbrains.kotlinx:kotlinx-serialization-core-jvm:1.1.0=classpath org.jetbrains.kotlinx:kotlinx-serialization-core:1.1.0=classpath org.jetbrains.kotlinx:kotlinx-serialization-json-jvm:1.1.0=classpath diff --git a/docs/Setup.md b/docs/Setup.md index a7a7dbbe..8e07ba76 100644 --- a/docs/Setup.md +++ b/docs/Setup.md @@ -10,10 +10,10 @@ To get set up for development, there are several steps that you need to go throu Start by making sure the command line with Gradle works first, because **all the Android Studio run configurations use Gradle internally.** The run configurations are not magic—they map directly to command line invocations with different arguments. -1. Configure Java - 1. Java 16 is currently recommended. Java 11 is the minimum requirement for Android Studio. +1. Install Java + 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. _Note: The ktlintFormat task will fail on Apple Silicon unless a Java 11 virtual machine is installed manually._ 1. Install Android Studio and the Android SDK - 1. Download the [Android Studio Bumblebee Canary](https://developer.android.com/studio/preview) (we're using the Canary version, due to its improved integration with Jetpack Compose) + 1. Download the [Android Studio Bumblebee Beta](https://developer.android.com/studio/preview) (we're using the Beta version, due to its improved integration with Jetpack Compose) 1. TODO: Fill in step-by-step instructions for setting up a new environment and installing the Android SDK from within Android Studio 1. Check out the code. _Use the command line (instead of Android Studio) to check out the code. This will ensure that your command line environment is set up correctly and avoids a few pitfalls with trying to use Android Studio directly. Android Studio's built-in git client is not as robust as standalone clients_ 1. Compile from the command line diff --git a/gradle.properties b/gradle.properties index 3bd80717..f25799d3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -70,7 +70,7 @@ ANDROIDX_ACTIVITY_VERSION=1.4.0 ANDROIDX_ANNOTATION_VERSION=1.3.0 ANDROIDX_APPCOMPAT_VERSION=1.3.1 ANDROIDX_COMPOSE_VERSION=1.0.5 -ANDROIDX_COMPOSE_COMPILER_VERSION=1.1.0-beta03 +ANDROIDX_COMPOSE_COMPILER_VERSION=1.1.0-beta04 ANDROIDX_CORE_VERSION=1.7.0 ANDROIDX_ESPRESSO_VERSION=3.4.0 ANDROIDX_LIFECYCLE_VERSION=2.4.0 @@ -84,15 +84,14 @@ CORE_LIBRARY_DESUGARING_VERSION=1.1.5 GOOGLE_MATERIAL_VERSION=1.4.0 JACOCO_VERSION=0.8.7 KOTLINX_COROUTINES_VERSION=1.5.2 -KOTLIN_VERSION=1.5.31 +KOTLIN_VERSION=1.6.0 ZCASH_SDK_VERSION=1.3.0-beta19 ZCASH_BIP39_VERSION=1.0.2 ZCASH_ANDROID_WALLET_PLUGINS_VERSION=1.0.0 # Toolchain is the Java version used to build the application, which is separate from the -# Java version used to run the application. Android requires a minimum of 11. Apple Silicon -# requires a newer toolchain. Kotlin won't support Java 17 until Kotlin 1.6 -JVM_TOOLCHAIN=16 +# Java version used to run the application. Android requires a minimum of 11. +JVM_TOOLCHAIN=17 # This shouldn't be changed, as Android doesn't support targets beyond Java 8 ANDROID_JVM_TARGET=1.8 \ No newline at end of file