From 3c74551fe035f081750226bc32cfc254c3186555 Mon Sep 17 00:00:00 2001 From: Jonathan Koren Date: Wed, 2 Oct 2024 10:06:35 -0700 Subject: [PATCH] Update dependencies for codelabs branch (#94) * Deduplicate lifecycle runtime compose * kotlin 2.0 and compose gradle plugin * update compose bom and navigation suite * Update various UI libs * update test & other versions * run spotlessApply --- .gitignore | 1 + app/build.gradle.kts | 18 ++----- .../android/samples/socialite/MainActivity.kt | 9 ++-- .../android/samples/socialite/ui/Main.kt | 3 -- build.gradle.kts | 1 + gradle/libs.versions.toml | 49 +++++++++---------- 6 files changed, 33 insertions(+), 48 deletions(-) diff --git a/.gitignore b/.gitignore index ea8c8d29..5928b36e 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ .externalNativeBuild .cxx local.properties +.kotlin diff --git a/app/build.gradle.kts b/app/build.gradle.kts index f28f4a98..ce43fa1b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -14,10 +14,10 @@ * limitations under the License. */ -@Suppress("DSL_SCOPE_VIOLATION") // TODO: Remove once KTIJ-19369 is fixed plugins { alias(libs.plugins.androidApplication) alias(libs.plugins.baselineprofile) + alias(libs.plugins.compose) alias(libs.plugins.hilt) alias(libs.plugins.kotlinAndroid) alias(libs.plugins.ksp) @@ -25,6 +25,9 @@ plugins { kotlin { jvmToolchain(17) + compilerOptions { + freeCompilerArgs = listOf("-Xcontext-receivers") + } } android { @@ -47,20 +50,9 @@ android { proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } - compileOptions { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 - } - kotlinOptions { - jvmTarget = "17" - freeCompilerArgs = listOf("-Xcontext-receivers") - } buildFeatures { compose = true } - composeOptions { - kotlinCompilerExtensionVersion = libs.versions.composeCompiler.get() - } packaging { resources { excludes += "/META-INF/{AL2.0,LGPL2.1}" @@ -85,7 +77,6 @@ dependencies { val composeBom = platform(libs.compose.bom) implementation(composeBom) androidTestImplementation(composeBom) - implementation(libs.compose.foundation) implementation(libs.compose.ui) implementation(libs.compose.ui.graphics) implementation(libs.compose.ui.text.google.fonts) @@ -106,7 +97,6 @@ dependencies { implementation(libs.graphics.shapes) implementation(libs.lifecycle.ktx) - implementation(libs.lifecycle.compose) implementation(libs.lifecycle.runtime.compose) ksp(libs.room.compiler) diff --git a/app/src/main/java/com/google/android/samples/socialite/MainActivity.kt b/app/src/main/java/com/google/android/samples/socialite/MainActivity.kt index b1c22230..8dca7ce2 100644 --- a/app/src/main/java/com/google/android/samples/socialite/MainActivity.kt +++ b/app/src/main/java/com/google/android/samples/socialite/MainActivity.kt @@ -22,7 +22,6 @@ import android.os.Bundle import android.view.WindowInsetsController import androidx.activity.ComponentActivity import androidx.activity.compose.setContent -import androidx.activity.enableEdgeToEdge import androidx.compose.foundation.isSystemInDarkTheme import androidx.core.content.pm.ShortcutManagerCompat import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen @@ -36,7 +35,6 @@ class MainActivity : ComponentActivity() { installSplashScreen() super.onCreate(savedInstanceState) setContent { - // setSystemBarAppearance can be removed after calling enableEdgeToEdge() setSystemBarAppearance(isSystemInDarkTheme()) @@ -55,16 +53,17 @@ class MainActivity : ComponentActivity() { return ShortcutParams(shortcutId, text) } - private fun setSystemBarAppearance(isSystemInDarkTheme : Boolean) { + private fun setSystemBarAppearance(isSystemInDarkTheme: Boolean) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { if (isSystemInDarkTheme) { window?.insetsController?.setSystemBarsAppearance( - 0, WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS + 0, + WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, ) } else { window?.insetsController?.setSystemBarsAppearance( WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, - WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS + WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS, ) } } diff --git a/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt b/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt index 8f9a886e..7cd7e274 100644 --- a/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt +++ b/app/src/main/java/com/google/android/samples/socialite/ui/Main.kt @@ -20,14 +20,11 @@ import android.app.Activity import android.content.Intent import android.content.pm.ActivityInfo import android.os.Bundle -import androidx.compose.animation.core.CubicBezierEasing import androidx.compose.animation.core.FastOutLinearInEasing import androidx.compose.animation.core.FastOutSlowInEasing import androidx.compose.animation.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut -import androidx.compose.animation.scaleIn -import androidx.compose.animation.scaleOut import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier diff --git a/build.gradle.kts b/build.gradle.kts index f20db0e1..4eba6969 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -21,6 +21,7 @@ plugins { alias(libs.plugins.androidApplication) apply false alias(libs.plugins.androidTest) apply false alias(libs.plugins.baselineprofile) apply false + alias(libs.plugins.compose) apply false alias(libs.plugins.kotlinAndroid) apply false alias(libs.plugins.spotless) apply false alias(libs.plugins.hilt) apply false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 7c5d887e..db552487 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -13,40 +13,38 @@ # limitations under the License. [versions] -accompanist = "0.32.0" -activity = "1.9.0" +accompanist = "0.34.0" +activity = "1.9.1" agp = "8.2.2" -benchmarkMacroJunit4 = "1.2.4" -baselineprofile = "1.2.4" -camera = "1.3.3" -coil = "2.4.0" -compose_bom = "2024.05.00" -composeCompiler = "1.5.4" # Used in app/build.gradle.kts -compose-foundation = "1.6.0-beta03" -concurrent = "1.1.0" +benchmarkMacroJunit4 = "1.3.0" +baselineprofile = "1.3.0" +camera = "1.3.4" +coil = "2.6.0" +compose_bom = "2024.08.00" +concurrent = "1.2.0" core = "1.13.1" core-splashscreen = "1.2.0-alpha01" -espresso = "3.5.1" -graphics = "1.0.0-beta01" -hilt = "2.48.1" -hiltNavigationCompose = "1.1.0" +espresso = "3.6.1" +graphics = "1.0.0" +hilt = "2.51.1" +hiltNavigationCompose = "1.2.0" junit = "4.13.2" -kotlin = "1.9.20" -ksp = "1.9.20-1.0.14" -lifecycle = "2.7.0" +kotlin = "2.0.0" +ksp = "2.0.0-1.0.21" +lifecycle = "2.8.4" material3 = "1.2.1" -media3 = "1.3.1" +media3 = "1.4.1" navigation = "2.7.7" profileinstaller = "1.3.1" room = "2.6.1" spotless = "6.24.0" -test = "1.1.5" -truth = "1.1.3" +test = "1.2.1" +truth = "1.4.4" turbine = "1.0.0" uiautomator = "2.3.0" -window = "1.2.0" -material3-adaptive-navigation-suite = "1.0.0-alpha05" -glance = "1.1.0-beta02" +window = "1.3.0" +material3-adaptive-navigation-suite = "1.3.0-rc01" +glance = "1.1.0" [libraries] accompanist-painter = { group = "com.google.accompanist", name = "accompanist-drawablepainter", version.ref = "accompanist" } @@ -65,7 +63,6 @@ compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = compose-material-icons = { group = "androidx.compose.material", name = "material-icons-extended" } compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "material3" } compose-material3-adaptive = { group = "androidx.compose.material3", name = "material3-adaptive-navigation-suite", version.ref = "material3-adaptive-navigation-suite"} -compose-foundation = { group = "androidx.compose.foundation", name = "foundation" } compose-ui = { group = "androidx.compose.ui", name = "ui" } compose-ui-graphics = { group = "androidx.compose.ui", name = "ui-graphics" } compose-ui-test = { group = "androidx.compose.ui", name = "ui-test-junit4" } @@ -84,9 +81,8 @@ hilt-android = { group = "com.google.dagger", name = "hilt-android", version.ref hilt-compiler = { group = "com.google.dagger", name = "hilt-android-compiler", version.ref = "hilt" } hilt-navigation-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hiltNavigationCompose" } junit = { group = "junit", name = "junit", version.ref = "junit" } -lifecycle-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } lifecycle-ktx = { group = "androidx.lifecycle", name = "lifecycle-runtime-ktx", version.ref = "lifecycle" } -lifecycle-runtime-compose = { module = "androidx.lifecycle:lifecycle-runtime-compose", version.ref = "lifecycle" } +lifecycle-runtime-compose = { group = "androidx.lifecycle", name = "lifecycle-runtime-compose", version.ref = "lifecycle" } media3-common = { group = "androidx.media3", name = "media3-common", version.ref = "media3" } media3-effect = { group = "androidx.media3", name = "media3-effect", version.ref = "media3" } media3-exoplayer = { group = "androidx.media3", name = "media3-exoplayer", version.ref = "media3" } @@ -108,6 +104,7 @@ ktlint = "com.pinterest.ktlint:ktlint-cli:1.1.1" # Used in build.gradle.kts androidApplication = { id = "com.android.application", version.ref = "agp" } androidTest = { id = "com.android.test", version.ref = "agp" } baselineprofile = { id = "androidx.baselineprofile", version.ref = "baselineprofile" } +compose = { id = "org.jetbrains.kotlin.plugin.compose", version.ref = "kotlin" } hilt = { id = "com.google.dagger.hilt.android", version.ref = "hilt" } kotlinAndroid = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }