diff --git a/.gitignore b/.gitignore index dd483a7ef..21756ab28 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,9 @@ build/ local.properties +# Kotlin 2.0 +.kotlin/ + # Build artifacts *.apk *.aab diff --git a/CHANGELOG.md b/CHANGELOG.md index 55149f126..be22f75e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Release Notes +## Unreleased + +* Update to K2 (aka Kotlin `2.0.0`) +* Update Compose BOM to 2024.05.00 +* Update AndroidX to 1.13.1 +* Update Activity to 1.9.0 +* Update Fragment to 1.7.1 +* Update Datastore to 1.1.1 +* Update Sentry to 7.9.0 + ## 10.1.2 * Better error message when the device is low on storage diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 90f432d65..d78943129 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,8 +106,7 @@ uploadKeystorePassword= length. However, if it is not possible (i.e. a long resource name), you can disable the check for the line by adding `// ktlint-disable max-line-length` to the end of the line - You can obtain Compose Compiler metrics (i.e. to debug performance or recomposition issues) by - running `./gradlew clean assemble -PenableComposeCompilerReports=true`. The reports will be - saved to `lib/build/compose-metrics` and `sample/build/compose-metrics` + viewing the reports saved to `lib/build/compose_compiler` and `sample/build/compose_compiler` - It is recommended to set up a pre-commit hook (ktLint - formatting, lint - Composable lints). To do so, add the following to `.git/hooks/pre-commit`: ``` diff --git a/build.gradle.kts b/build.gradle.kts index 3179327d0..768210810 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,6 +5,7 @@ plugins { // Applied depending on sub-module alias(libs.plugins.android.application) apply false alias(libs.plugins.android.library) apply false + alias(libs.plugins.compose.compiler) apply false alias(libs.plugins.kotlin.jvm) apply false alias(libs.plugins.kotlin.android) apply false alias(libs.plugins.ksp) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index a474868c6..0a15cf8c9 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,43 +1,42 @@ [versions] accompanist-permissions = "0.34.0" android-gradle-plugin = "8.2.2" -androidx-activity = "1.8.2" -androidx-compose-bom = "2024.04.00" -androidx-compose-compiler = "1.5.11" -androidx-core = "1.12.0" +androidx-activity = "1.9.0" +androidx-compose-bom = "2024.05.00" +androidx-core = "1.13.1" androidx-core-splashscreen = "1.0.1" -androidx-fragment = "1.6.2" +androidx-fragment = "1.7.1" androidx-lifecycle = "2.7.0" androidx-navigation = "2.7.7" androidx-test-core = "1.5.0" androidx-test-espresso = "3.5.1" -androidx-test-fragment = "1.6.2" +androidx-test-fragment = "1.7.1" androidx-test-junit = "1.1.5" androidx-test-rules = "1.5.0" camposer = "0.4.0" chucker = "4.0.0" coil = "2.6.0" compose-lint-checks = "1.3.1" -coroutines = "1.8.0" -datastore = "1.0.0" +coroutines = "1.8.1" +datastore = "1.1.1" junit = "4.13.2" -kotlin = "1.9.23" +kotlin = "2.0.0" kotlin-immutable-collections = "0.3.7" -ksp = "1.9.23-1.0.19" -ktlint-plugin = "12.1.0" -leakcanary = "2.13" +ksp = "2.0.0-1.0.21" +ktlint-plugin = "12.1.1" +leakcanary = "2.14" lottie = "6.4.0" maven-publish = "0.28.0" mlkit-code-scanner = "16.1.0" mlkit-obj-detection = "17.0.1" -mockk = "1.13.10" +mockk = "1.13.11" moshi = "1.15.1" -moshix = "0.25.1" +moshix = "0.27.0" moshi-lazy-adapters = "2.2" okhttp = "4.12.0" play-services-mlkit-face-detection = "17.1.0" retrofit = "2.11.0" -sentry = "7.7.0" +sentry = "7.9.0" tflite = "2.14.0" tflite-metadata = "0.4.4" tflite-support = "0.4.4" @@ -48,6 +47,7 @@ uiautomator = "2.3.0" [plugins] android-application = { id = "com.android.application", version.ref = "android-gradle-plugin" } android-library = { id = "com.android.library", version.ref = "android-gradle-plugin" } +compose-compiler = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" } diff --git a/lib/lib.gradle.kts b/lib/lib.gradle.kts index 2852800be..bd6a2f5c6 100644 --- a/lib/lib.gradle.kts +++ b/lib/lib.gradle.kts @@ -2,6 +2,7 @@ plugins { alias(libs.plugins.android.library) + alias(libs.plugins.compose.compiler) alias(libs.plugins.kotlin.android) alias(libs.plugins.ktlint) alias(libs.plugins.ksp) @@ -61,15 +62,6 @@ android { // without having to add the opt-in annotation to every usage. The annotation's purpose // is primarily for consumers of the SDK to use, not for us. freeCompilerArgs += "-opt-in=com.smileidentity.SmileIDOptIn" - if (project.hasProperty("enableComposeCompilerReports")) { - val outputDir = layout.buildDirectory.dir("compose-reports").get().asFile.path - freeCompilerArgs += listOf( - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$outputDir", - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$outputDir", - ) - } } } @@ -79,16 +71,18 @@ android { mlModelBinding = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } - lint { enable += "ComposeM2Api" error += "ComposeM2Api" } } +composeCompiler { + enableStrongSkippingMode = true + reportsDestination = layout.buildDirectory.dir("compose_compiler") + metricsDestination = layout.buildDirectory.dir("compose_compiler") +} + mavenPublishing { publishToMavenCentral(automaticRelease = true) signAllPublications() diff --git a/sample/sample.gradle.kts b/sample/sample.gradle.kts index 5b92b8bae..bd3849702 100644 --- a/sample/sample.gradle.kts +++ b/sample/sample.gradle.kts @@ -1,5 +1,6 @@ plugins { alias(libs.plugins.android.application) + alias(libs.plugins.compose.compiler) alias(libs.plugins.kotlin.android) alias(libs.plugins.ktlint) alias(libs.plugins.moshix) @@ -64,15 +65,6 @@ android { // without having to add the opt-in annotation to every usage. The annotation's purpose // is primarily for consumers of the SDK to use, not for us. freeCompilerArgs += "-opt-in=com.smileidentity.SmileIDOptIn" - if (project.hasProperty("enableComposeCompilerReports")) { - val outputDir = layout.buildDirectory.dir("compose-reports").get().asFile.path - freeCompilerArgs += listOf( - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=$outputDir", - "-P", - "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=$outputDir", - ) - } } } @@ -81,10 +73,6 @@ android { buildConfig = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.androidx.compose.compiler.get() - } - packaging { resources.excludes += "/META-INF/{AL2.0,LGPL2.1}" } @@ -97,6 +85,12 @@ android { } } +composeCompiler { + enableStrongSkippingMode = true + reportsDestination = layout.buildDirectory.dir("compose_compiler") + metricsDestination = layout.buildDirectory.dir("compose_compiler") +} + val checkSmileConfigFileTaskName = "checkSmileConfigFile" tasks.register(checkSmileConfigFileTaskName) { doLast {