From 3009cdf081d363cd07235b0a4ff647b096979f2a Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 14 Dec 2024 21:11:26 +0900 Subject: [PATCH 1/4] Create Const value of `String`. Change-Id: I8fa1a79ea71578395a4ce861ff883f8f6f01cdd0 --- .../apps/nowinandroid/StringSources.kt | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt new file mode 100644 index 000000000..f52044345 --- /dev/null +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt @@ -0,0 +1,47 @@ +/* + * Copyright 2024 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.samples.apps.nowinandroid + +/** + * String for `implementation`. + */ +internal const val implementation = "implementation" + +/** + * String for `testImplementation`. + */ +internal const val testImplementation = "testImplementation" + +/** + * String for `androidTestImplementation`. + */ +internal const val androidTestImplementation = "androidTestImplementation" + +/** + * String for `ksp`. + */ +internal const val ksp = "ksp" + +/** + * String for `debugImplementation`. + */ +internal const val debugImplementation = "debugImplementation" + +/** + * String for `coreLibraryDesugaring`. + */ +internal const val coreLibraryDesugaring = "coreLibraryDesugaring" From 18e35c27f67cc6251936af56577b61a9c0e35be1 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 14 Dec 2024 21:13:26 +0900 Subject: [PATCH 2/4] Followed Kotlin DSL without type-safe accessors. https://docs.gradle.org/current/userguide/kotlin_dsl.html#ex-configuring-plugins-without-type-safe-accessors Change-Id: Id711ad25146e291cbae40a5df4251f0ffef7b0a6 --- ...roidApplicationFirebaseConventionPlugin.kt | 9 ++++---- .../kotlin/AndroidFeatureConventionPlugin.kt | 23 +++++++++++-------- .../kotlin/AndroidLibraryConventionPlugin.kt | 9 +++++--- .../kotlin/AndroidRoomConventionPlugin.kt | 10 ++++---- .../src/main/kotlin/HiltConventionPlugin.kt | 8 ++++--- .../main/kotlin/JvmLibraryConventionPlugin.kt | 3 ++- .../apps/nowinandroid/AndroidCompose.kt | 8 +++---- .../apps/nowinandroid/KotlinAndroid.kt | 2 +- 8 files changed, 42 insertions(+), 30 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt index a5e001bd2..9abc693a5 100644 --- a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt @@ -16,6 +16,7 @@ import com.android.build.api.dsl.ApplicationExtension import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension +import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -34,9 +35,9 @@ class AndroidApplicationFirebaseConventionPlugin : Plugin { dependencies { val bom = libs.findLibrary("firebase-bom").get() - add("implementation", platform(bom)) - "implementation"(libs.findLibrary("firebase.analytics").get()) - "implementation"(libs.findLibrary("firebase.performance").get()) { + implementation(platform(bom)) + implementation(libs.findLibrary("firebase.analytics").get()) + implementation(libs.findLibrary("firebase.performance").get()) { /* Exclusion of protobuf / protolite dependencies is necessary as the datastore-proto brings in protobuf dependencies. These are the source of truth @@ -46,7 +47,7 @@ class AndroidApplicationFirebaseConventionPlugin : Plugin { exclude(group = "com.google.protobuf", module = "protobuf-javalite") exclude(group = "com.google.firebase", module = "protolite-well-known-types") } - "implementation"(libs.findLibrary("firebase.crashlytics").get()) + implementation(libs.findLibrary("firebase.crashlytics").get()) } extensions.configure { diff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt index 6d0f213d4..03b8bc296 100644 --- a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt @@ -15,8 +15,11 @@ */ import com.android.build.gradle.LibraryExtension +import com.google.samples.apps.nowinandroid.androidTestImplementation import com.google.samples.apps.nowinandroid.configureGradleManagedDevices +import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs +import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure @@ -36,18 +39,18 @@ class AndroidFeatureConventionPlugin : Plugin { } dependencies { - add("implementation", project(":core:ui")) - add("implementation", project(":core:designsystem")) + implementation(project(":core:ui")) + implementation(project(":core:designsystem")) - add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get()) - add("implementation", libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) - add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) - add("implementation", libs.findLibrary("androidx.navigation.compose").get()) - add("implementation", libs.findLibrary("androidx.tracing.ktx").get()) - add("implementation", libs.findLibrary("kotlinx.serialization.json").get()) + implementation(libs.findLibrary("androidx.hilt.navigation.compose").get()) + implementation(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) + implementation(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) + implementation(libs.findLibrary("androidx.navigation.compose").get()) + implementation(libs.findLibrary("androidx.tracing.ktx").get()) + implementation(libs.findLibrary("kotlinx.serialization.json").get()) - add("testImplementation", libs.findLibrary("androidx.navigation.testing").get()) - add("androidTestImplementation", libs.findLibrary("androidx.lifecycle.runtimeTesting").get()) + testImplementation(libs.findLibrary("androidx.navigation.testing").get()) + androidTestImplementation(libs.findLibrary("androidx.lifecycle.runtimeTesting").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index 2a10901fb..7e2a88b88 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -16,12 +16,15 @@ import com.android.build.api.variant.LibraryAndroidComponentsExtension import com.android.build.gradle.LibraryExtension +import com.google.samples.apps.nowinandroid.androidTestImplementation import com.google.samples.apps.nowinandroid.configureFlavors import com.google.samples.apps.nowinandroid.configureGradleManagedDevices import com.google.samples.apps.nowinandroid.configureKotlinAndroid import com.google.samples.apps.nowinandroid.configurePrintApksTask import com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTests +import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs +import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure @@ -53,10 +56,10 @@ class AndroidLibraryConventionPlugin : Plugin { disableUnnecessaryAndroidTests(target) } dependencies { - add("androidTestImplementation", libs.findLibrary("kotlin.test").get()) - add("testImplementation", libs.findLibrary("kotlin.test").get()) + androidTestImplementation(libs.findLibrary("kotlin.test").get()) + testImplementation(libs.findLibrary("kotlin.test").get()) - add("implementation", libs.findLibrary("androidx.tracing.ktx").get()) + implementation(libs.findLibrary("androidx.tracing.ktx").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt index dbca79a5e..5ce0fc286 100644 --- a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt @@ -16,6 +16,8 @@ import androidx.room.gradle.RoomExtension import com.google.devtools.ksp.gradle.KspExtension +import com.google.samples.apps.nowinandroid.implementation +import com.google.samples.apps.nowinandroid.ksp import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -41,10 +43,10 @@ class AndroidRoomConventionPlugin : Plugin { } dependencies { - add("implementation", libs.findLibrary("room.runtime").get()) - add("implementation", libs.findLibrary("room.ktx").get()) - add("ksp", libs.findLibrary("room.compiler").get()) + implementation(libs.findLibrary("room.runtime").get()) + implementation(libs.findLibrary("room.ktx").get()) + ksp(libs.findLibrary("room.compiler").get()) } } } -} \ No newline at end of file +} diff --git a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt index f49366f75..304cd93ea 100644 --- a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt @@ -15,6 +15,8 @@ */ import com.android.build.gradle.api.AndroidBasePlugin +import com.google.samples.apps.nowinandroid.implementation +import com.google.samples.apps.nowinandroid.ksp import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -25,13 +27,13 @@ class HiltConventionPlugin : Plugin { with(target) { pluginManager.apply("com.google.devtools.ksp") dependencies { - add("ksp", libs.findLibrary("hilt.compiler").get()) + ksp(libs.findLibrary("hilt.compiler").get()) } // Add support for Jvm Module, base on org.jetbrains.kotlin.jvm pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { dependencies { - add("implementation", libs.findLibrary("hilt.core").get()) + implementation(libs.findLibrary("hilt.core").get()) } } @@ -39,7 +41,7 @@ class HiltConventionPlugin : Plugin { pluginManager.withPlugin("com.android.base") { pluginManager.apply("dagger.hilt.android.plugin") dependencies { - add("implementation", libs.findLibrary("hilt.android").get()) + implementation(libs.findLibrary("hilt.android").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt index afe47eeee..4739d434e 100644 --- a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt @@ -16,6 +16,7 @@ import com.google.samples.apps.nowinandroid.configureKotlinJvm import com.google.samples.apps.nowinandroid.libs +import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.dependencies @@ -30,7 +31,7 @@ class JvmLibraryConventionPlugin : Plugin { } configureKotlinJvm() dependencies { - add("testImplementation", libs.findLibrary("kotlin.test").get()) + testImplementation(libs.findLibrary("kotlin.test").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt index ffb6358c3..8189aee5c 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt @@ -37,10 +37,10 @@ internal fun Project.configureAndroidCompose( dependencies { val bom = libs.findLibrary("androidx-compose-bom").get() - add("implementation", platform(bom)) - add("androidTestImplementation", platform(bom)) - add("implementation", libs.findLibrary("androidx-compose-ui-tooling-preview").get()) - add("debugImplementation", libs.findLibrary("androidx-compose-ui-tooling").get()) + implementation(platform(bom)) + androidTestImplementation(platform(bom)) + implementation(libs.findLibrary("androidx-compose-ui-tooling-preview").get()) + debugImplementation(libs.findLibrary("androidx-compose-ui-tooling").get()) } testOptions { diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt index 57f026029..cb97db6be 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt @@ -54,7 +54,7 @@ internal fun Project.configureKotlinAndroid( configureKotlin() dependencies { - add("coreLibraryDesugaring", libs.findLibrary("android.desugarJdkLibs").get()) + coreLibraryDesugaring(libs.findLibrary("android.desugarJdkLibs").get()) } } From f422b8539ed4594f8e1945c662895f8eaf2a32be Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Wed, 18 Dec 2024 21:38:41 +0900 Subject: [PATCH 3/4] Remove StringSources.kt Change-Id: I17972f94277364cd588f40d422370b21e40af0e9 --- .../apps/nowinandroid/StringSources.kt | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt deleted file mode 100644 index f52044345..000000000 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/StringSources.kt +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2024 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.google.samples.apps.nowinandroid - -/** - * String for `implementation`. - */ -internal const val implementation = "implementation" - -/** - * String for `testImplementation`. - */ -internal const val testImplementation = "testImplementation" - -/** - * String for `androidTestImplementation`. - */ -internal const val androidTestImplementation = "androidTestImplementation" - -/** - * String for `ksp`. - */ -internal const val ksp = "ksp" - -/** - * String for `debugImplementation`. - */ -internal const val debugImplementation = "debugImplementation" - -/** - * String for `coreLibraryDesugaring`. - */ -internal const val coreLibraryDesugaring = "coreLibraryDesugaring" From cf2db95db0dcfecc407a0f9a329b63c7c209a9e1 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Wed, 18 Dec 2024 21:42:59 +0900 Subject: [PATCH 4/4] Restore into a plain String text. Change-Id: I3f4ead0be88ed460de007dae7b53c4d2f6c2249b --- ...roidApplicationFirebaseConventionPlugin.kt | 9 ++++---- .../kotlin/AndroidFeatureConventionPlugin.kt | 23 ++++++++----------- .../kotlin/AndroidLibraryConventionPlugin.kt | 10 +++----- .../kotlin/AndroidRoomConventionPlugin.kt | 8 +++---- .../src/main/kotlin/HiltConventionPlugin.kt | 8 +++---- .../main/kotlin/JvmLibraryConventionPlugin.kt | 4 +--- .../apps/nowinandroid/AndroidCompose.kt | 8 +++---- .../apps/nowinandroid/KotlinAndroid.kt | 2 +- 8 files changed, 29 insertions(+), 43 deletions(-) diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt index 9abc693a5..7aacc0ffe 100644 --- a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt @@ -16,7 +16,6 @@ import com.android.build.api.dsl.ApplicationExtension import com.google.firebase.crashlytics.buildtools.gradle.CrashlyticsExtension -import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -35,9 +34,9 @@ class AndroidApplicationFirebaseConventionPlugin : Plugin { dependencies { val bom = libs.findLibrary("firebase-bom").get() - implementation(platform(bom)) - implementation(libs.findLibrary("firebase.analytics").get()) - implementation(libs.findLibrary("firebase.performance").get()) { + "implementation"(platform(bom)) + "implementation"(libs.findLibrary("firebase.analytics").get()) + "implementation"(libs.findLibrary("firebase.performance").get()) { /* Exclusion of protobuf / protolite dependencies is necessary as the datastore-proto brings in protobuf dependencies. These are the source of truth @@ -47,7 +46,7 @@ class AndroidApplicationFirebaseConventionPlugin : Plugin { exclude(group = "com.google.protobuf", module = "protobuf-javalite") exclude(group = "com.google.firebase", module = "protolite-well-known-types") } - implementation(libs.findLibrary("firebase.crashlytics").get()) + "implementation"(libs.findLibrary("firebase.crashlytics").get()) } extensions.configure { diff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt index 03b8bc296..aa30f5115 100644 --- a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt @@ -15,11 +15,8 @@ */ import com.android.build.gradle.LibraryExtension -import com.google.samples.apps.nowinandroid.androidTestImplementation import com.google.samples.apps.nowinandroid.configureGradleManagedDevices -import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs -import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure @@ -39,18 +36,18 @@ class AndroidFeatureConventionPlugin : Plugin { } dependencies { - implementation(project(":core:ui")) - implementation(project(":core:designsystem")) + "implementation"(project(":core:ui")) + "implementation"(project(":core:designsystem")) - implementation(libs.findLibrary("androidx.hilt.navigation.compose").get()) - implementation(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) - implementation(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) - implementation(libs.findLibrary("androidx.navigation.compose").get()) - implementation(libs.findLibrary("androidx.tracing.ktx").get()) - implementation(libs.findLibrary("kotlinx.serialization.json").get()) + "implementation"(libs.findLibrary("androidx.hilt.navigation.compose").get()) + "implementation"(libs.findLibrary("androidx.lifecycle.runtimeCompose").get()) + "implementation"(libs.findLibrary("androidx.lifecycle.viewModelCompose").get()) + "implementation"(libs.findLibrary("androidx.navigation.compose").get()) + "implementation"(libs.findLibrary("androidx.tracing.ktx").get()) + "implementation"(libs.findLibrary("kotlinx.serialization.json").get()) - testImplementation(libs.findLibrary("androidx.navigation.testing").get()) - androidTestImplementation(libs.findLibrary("androidx.lifecycle.runtimeTesting").get()) + "testImplementation"(libs.findLibrary("androidx.navigation.testing").get()) + "androidTestImplementation"(libs.findLibrary("androidx.lifecycle.runtimeTesting").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt index 7e2a88b88..aadd2b13e 100644 --- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt @@ -16,20 +16,16 @@ import com.android.build.api.variant.LibraryAndroidComponentsExtension import com.android.build.gradle.LibraryExtension -import com.google.samples.apps.nowinandroid.androidTestImplementation import com.google.samples.apps.nowinandroid.configureFlavors import com.google.samples.apps.nowinandroid.configureGradleManagedDevices import com.google.samples.apps.nowinandroid.configureKotlinAndroid import com.google.samples.apps.nowinandroid.configurePrintApksTask import com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTests -import com.google.samples.apps.nowinandroid.implementation import com.google.samples.apps.nowinandroid.libs -import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.configure import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.kotlin class AndroidLibraryConventionPlugin : Plugin { override fun apply(target: Project) { @@ -56,10 +52,10 @@ class AndroidLibraryConventionPlugin : Plugin { disableUnnecessaryAndroidTests(target) } dependencies { - androidTestImplementation(libs.findLibrary("kotlin.test").get()) - testImplementation(libs.findLibrary("kotlin.test").get()) + "androidTestImplementation"(libs.findLibrary("kotlin.test").get()) + "testImplementation"(libs.findLibrary("kotlin.test").get()) - implementation(libs.findLibrary("androidx.tracing.ktx").get()) + "implementation"(libs.findLibrary("androidx.tracing.ktx").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt index 5ce0fc286..5a8d648f3 100644 --- a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt @@ -16,8 +16,6 @@ import androidx.room.gradle.RoomExtension import com.google.devtools.ksp.gradle.KspExtension -import com.google.samples.apps.nowinandroid.implementation -import com.google.samples.apps.nowinandroid.ksp import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -43,9 +41,9 @@ class AndroidRoomConventionPlugin : Plugin { } dependencies { - implementation(libs.findLibrary("room.runtime").get()) - implementation(libs.findLibrary("room.ktx").get()) - ksp(libs.findLibrary("room.compiler").get()) + "implementation"(libs.findLibrary("room.runtime").get()) + "implementation"(libs.findLibrary("room.ktx").get()) + "ksp"(libs.findLibrary("room.compiler").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt index 304cd93ea..24d8c3382 100644 --- a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt @@ -15,8 +15,6 @@ */ import com.android.build.gradle.api.AndroidBasePlugin -import com.google.samples.apps.nowinandroid.implementation -import com.google.samples.apps.nowinandroid.ksp import com.google.samples.apps.nowinandroid.libs import org.gradle.api.Plugin import org.gradle.api.Project @@ -27,13 +25,13 @@ class HiltConventionPlugin : Plugin { with(target) { pluginManager.apply("com.google.devtools.ksp") dependencies { - ksp(libs.findLibrary("hilt.compiler").get()) + "ksp"(libs.findLibrary("hilt.compiler").get()) } // Add support for Jvm Module, base on org.jetbrains.kotlin.jvm pluginManager.withPlugin("org.jetbrains.kotlin.jvm") { dependencies { - implementation(libs.findLibrary("hilt.core").get()) + "implementation"(libs.findLibrary("hilt.core").get()) } } @@ -41,7 +39,7 @@ class HiltConventionPlugin : Plugin { pluginManager.withPlugin("com.android.base") { pluginManager.apply("dagger.hilt.android.plugin") dependencies { - implementation(libs.findLibrary("hilt.android").get()) + "implementation"(libs.findLibrary("hilt.android").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt index 4739d434e..f9ae4a1c4 100644 --- a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt @@ -16,11 +16,9 @@ import com.google.samples.apps.nowinandroid.configureKotlinJvm import com.google.samples.apps.nowinandroid.libs -import com.google.samples.apps.nowinandroid.testImplementation import org.gradle.api.Plugin import org.gradle.api.Project import org.gradle.kotlin.dsl.dependencies -import org.gradle.kotlin.dsl.kotlin class JvmLibraryConventionPlugin : Plugin { override fun apply(target: Project) { @@ -31,7 +29,7 @@ class JvmLibraryConventionPlugin : Plugin { } configureKotlinJvm() dependencies { - testImplementation(libs.findLibrary("kotlin.test").get()) + "testImplementation"(libs.findLibrary("kotlin.test").get()) } } } diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt index 8189aee5c..81320a600 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidCompose.kt @@ -37,10 +37,10 @@ internal fun Project.configureAndroidCompose( dependencies { val bom = libs.findLibrary("androidx-compose-bom").get() - implementation(platform(bom)) - androidTestImplementation(platform(bom)) - implementation(libs.findLibrary("androidx-compose-ui-tooling-preview").get()) - debugImplementation(libs.findLibrary("androidx-compose-ui-tooling").get()) + "implementation"(platform(bom)) + "androidTestImplementation"(platform(bom)) + "implementation"(libs.findLibrary("androidx-compose-ui-tooling-preview").get()) + "debugImplementation"(libs.findLibrary("androidx-compose-ui-tooling").get()) } testOptions { diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt index cb97db6be..d1ae4eb36 100644 --- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt +++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/KotlinAndroid.kt @@ -54,7 +54,7 @@ internal fun Project.configureKotlinAndroid( configureKotlin() dependencies { - coreLibraryDesugaring(libs.findLibrary("android.desugarJdkLibs").get()) + "coreLibraryDesugaring"(libs.findLibrary("android.desugarJdkLibs").get()) } }