A fully functional Android app built entirely with Kotlin and Jetpack Compose
Replace gradle script with explicit convention plugins
satyan555c4b4855f3
diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.ktsindex ab9e700ec..9a5baaa41 100644--- a/build-logic/convention/build.gradle.kts+++ b/build-logic/convention/build.gradle.kts@@ -30,3 +30,44 @@ dependencies {implementation(libs.kotlin.gradlePlugin)implementation(libs.spotless.gradlePlugin)}++gradlePlugin {+ plugins {+ register("androidApplicationCompose") {+ id = "nowinandroid.android.application.compose"+ implementationClass = "AndroidApplicationComposeConventionPlugin"+ }+ register("androidApplication") {+ id = "nowinandroid.android.application"+ implementationClass = "AndroidApplicationConventionPlugin"+ }+ register("androidApplicationJacoco") {+ id = "nowinandroid.android.application.jacoco"+ implementationClass = "AndroidApplicationJacocoConventionPlugin"+ }+ register("androidLibraryCompose") {+ id = "nowinandroid.android.library.compose"+ implementationClass = "AndroidLibraryComposeConventionPlugin"+ }+ register("androidLibrary") {+ id = "nowinandroid.android.library"+ implementationClass = "AndroidLibraryConventionPlugin"+ }+ register("androidFeature") {+ id = "nowinandroid.android.feature"+ implementationClass = "AndroidFeatureConventionPlugin"+ }+ register("androidLibraryJacoco") {+ id = "nowinandroid.android.library.jacoco"+ implementationClass = "AndroidLibraryJacocoConventionPlugin"+ }+ register("androidTest") {+ id = "nowinandroid.android.test"+ implementationClass = "AndroidTestConventionPlugin"+ }+ register("spotless") {+ id = "nowinandroid.spotless"+ implementationClass = "SpotlessConventionPlugin"+ }+ }+}diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.ktnew file mode 100644index 000000000..90a5b303c--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt@@ -0,0 +1,17 @@+import com.android.build.gradle.internal.dsl.BaseAppModuleExtension+import com.google.samples.apps.nowinandroid.configureAndroidCompose+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.getByType++class AndroidApplicationComposeConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ pluginManager.withPlugin("com.android.application") {+ val extension = extensions.getByType<BaseAppModuleExtension>()+ configureAndroidCompose(extension)+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.ktnew file mode 100644index 000000000..4dd91eb86--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt@@ -0,0 +1,22 @@+import com.android.build.gradle.internal.dsl.BaseAppModuleExtension+import com.google.samples.apps.nowinandroid.configureKotlinAndroid+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.configure++class AndroidApplicationConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ with(pluginManager) {+ apply("com.android.application")+ apply("org.jetbrains.kotlin.android")+ }++ extensions.configure<BaseAppModuleExtension> {+ configureKotlinAndroid(this)+ defaultConfig.targetSdk = 32+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.ktnew file mode 100644index 000000000..77c9f2d18--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt@@ -0,0 +1,18 @@+import com.android.build.api.variant.ApplicationAndroidComponentsExtension+import com.google.samples.apps.nowinandroid.configureJacoco+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.getByType++class AndroidApplicationJacocoConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ pluginManager.withPlugin("com.android.application") {+ pluginManager.apply("org.gradle.jacoco")+ val extension = extensions.getByType<ApplicationAndroidComponentsExtension>()+ configureJacoco(extension)+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.ktnew file mode 100644index 000000000..cea79078a--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidFeatureConventionPlugin.kt@@ -0,0 +1,56 @@+import com.android.build.gradle.LibraryExtension+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.api.artifacts.VersionCatalogsExtension+import org.gradle.kotlin.dsl.configure+import org.gradle.kotlin.dsl.dependencies+import org.gradle.kotlin.dsl.getByType++class AndroidFeatureConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ pluginManager.apply {+ apply("com.android.library")+ apply("org.jetbrains.kotlin.android")+ apply("org.jetbrains.kotlin.kapt")+ }+ extensions.configure<LibraryExtension> {+ defaultConfig {+ testInstrumentationRunner =+ "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"+ }+ }++ val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")++ dependencies {+ add("implementation", project(":core-model"))+ add("implementation", project(":core-ui"))+ add("implementation", project(":core-data"))+ add("implementation", project(":core-common"))+ add("implementation", project(":core-navigation"))++ add("testImplementation", project(":core-testing"))+ add("androidTestImplementation", project(":core-testing"))++ add("implementation", libs.findLibrary("coil.kt").get())+ add("implementation", libs.findLibrary("coil.kt.compose").get())++ add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())+ add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())++ add("implementation", libs.findLibrary("kotlinx.coroutines.android").get())++ add("implementation", libs.findLibrary("hilt.android").get())+ add("kapt", libs.findLibrary("hilt.compiler").get())++ // TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042+ // These dependencies are currently necessary to render Compose previews+ add(+ "debugImplementation",+ libs.findLibrary("androidx.customview.poolingcontainer").get()+ )+ }+ }+ }+}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.ktnew file mode 100644index 000000000..84d87480a--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt@@ -0,0 +1,17 @@+import com.android.build.gradle.LibraryExtension+import com.google.samples.apps.nowinandroid.configureAndroidCompose+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.getByType++class AndroidLibraryComposeConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ pluginManager.withPlugin("com.android.library") {+ val extension = extensions.getByType<LibraryExtension>()+ configureAndroidCompose(extension)+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.ktnew file mode 100644index 000000000..8dbb83c29--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt@@ -0,0 +1,36 @@+import com.android.build.gradle.LibraryExtension+import com.google.samples.apps.nowinandroid.configureKotlinAndroid+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.api.artifacts.VersionCatalogsExtension+import org.gradle.kotlin.dsl.configure+import org.gradle.kotlin.dsl.dependencies+import org.gradle.kotlin.dsl.getByType++class AndroidLibraryConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ with(pluginManager) {+ apply("com.android.library")+ apply("org.jetbrains.kotlin.android")+ }++ extensions.configure<LibraryExtension> {+ configureKotlinAndroid(this)+ defaultConfig.targetSdk = 32+ }++ val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")+ dependencies {+ configurations.configureEach {+ resolutionStrategy {+ force(libs.findLibrary("junit4").get())+ // Temporary workaround for https://issuetracker.google.com/174733673+ force("org.objenesis:objenesis:2.6")+ }+ }+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.ktnew file mode 100644index 000000000..66dad8ae5--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt@@ -0,0 +1,18 @@+import com.android.build.api.variant.LibraryAndroidComponentsExtension+import com.google.samples.apps.nowinandroid.configureJacoco+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.getByType++class AndroidLibraryJacocoConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ pluginManager.withPlugin("com.android.library") {+ pluginManager.apply("org.gradle.jacoco")+ val extension = extensions.getByType<LibraryAndroidComponentsExtension>()+ configureJacoco(extension)+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.ktnew file mode 100644index 000000000..fe631f59e--- /dev/null+++ b/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.kt@@ -0,0 +1,22 @@+import com.android.build.gradle.TestExtension+import com.google.samples.apps.nowinandroid.configureKotlinAndroid+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.kotlin.dsl.configure++class AndroidTestConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with(target) {+ with(pluginManager) {+ apply("com.android.test")+ apply("org.jetbrains.kotlin.android")+ }++ extensions.configure<TestExtension> {+ configureKotlinAndroid(this)+ defaultConfig.targetSdk = 32+ }+ }+ }++}\ No newline at end of filediff --git a/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.kt b/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.ktnew file mode 100644index 000000000..11ad1d622--- /dev/null+++ b/build-logic/convention/src/main/kotlin/SpotlessConventionPlugin.kt@@ -0,0 +1,37 @@+import com.diffplug.gradle.spotless.SpotlessExtension+import org.gradle.api.Plugin+import org.gradle.api.Project+import org.gradle.api.artifacts.VersionCatalogsExtension+import org.gradle.kotlin.dsl.configure+import org.gradle.kotlin.dsl.getByType++class SpotlessConventionPlugin : Plugin<Project> {+ override fun apply(target: Project) {+ with (target) {+ pluginManager.apply("com.diffplug.spotless")+ val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")++ extensions.configure<SpotlessExtension> {+ kotlin {+ target("**/*.kt")+ targetExclude("**/build/**/*.kt")+ ktlint(libs.findVersion("ktlint").get().toString()).userData(mapOf("android" to "true"))+ licenseHeaderFile(rootProject.file("spotless/copyright.kt"))+ }+ format("kts") {+ target("**/*.kts")+ targetExclude("**/build/**/*.kts")+ // Look for the first line that doesn't have a block comment (assumed to be the license)+ licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")+ }+ format("xml") {+ target("**/*.xml")+ targetExclude("**/build/**/*.xml")+ // Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)+ licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")+ }+ }+ }+ }++}\ No newline at end of filediff --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.ktindex e94c839b8..9ba1b31cc 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@@ -19,6 +19,7 @@ package com.google.samples.apps.nowinandroidimport com.android.build.api.dsl.CommonExtensionimport org.gradle.api.Projectimport org.gradle.api.artifacts.VersionCatalogsExtension+import org.gradle.kotlin.dsl.dependenciesimport org.gradle.kotlin.dsl.getByType/**diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.compose.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.application.compose.gradle.ktsdeleted file mode 100644index b53d49c69..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.compose.gradle.kts+++ /dev/null@@ -1,25 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureAndroidCompose--plugins {- id("com.android.application")-}--android {- configureAndroidCompose(this)-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.application.gradle.ktsdeleted file mode 100644index 4f6a8da1e..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.gradle.kts+++ /dev/null@@ -1,30 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureKotlinAndroid--plugins {- id("com.android.application")- kotlin("android")-}--android {- configureKotlinAndroid(this)-- defaultConfig {- targetSdk = 32- }-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.jacoco.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.application.jacoco.gradle.ktsdeleted file mode 100644index d96d5d040..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.application.jacoco.gradle.kts+++ /dev/null@@ -1,28 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureJacoco--plugins {- id("com.android.application")- jacoco-}--android {- androidComponents {- configureJacoco(this)- }-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.feature.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.feature.gradle.ktsdeleted file mode 100644index fdd9b4a90..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.feature.gradle.kts+++ /dev/null@@ -1,59 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureKotlinAndroid-import org.gradle.kotlin.dsl.support.delegates.ProjectDelegate--plugins {- id("com.android.library")- kotlin("android")- kotlin("kapt")-}--android {- defaultConfig {- testInstrumentationRunner =- "com.google.samples.apps.nowinandroid.core.testing.NiaTestRunner"- }-}--val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")--dependencies {- implementation(project(":core-model"))- implementation(project(":core-ui"))- implementation(project(":core-data"))- implementation(project(":core-common"))- implementation(project(":core-navigation"))-- testImplementation(project(":core-testing"))- androidTestImplementation(project(":core-testing"))-- add("implementation", libs.findLibrary("coil.kt").get())- add("implementation", libs.findLibrary("coil.kt.compose").get())-- add("implementation", libs.findLibrary("androidx.hilt.navigation.compose").get())- add("implementation", libs.findLibrary("androidx.lifecycle.viewModelCompose").get())-- add("implementation", libs.findLibrary("kotlinx.coroutines.android").get())-- add("implementation", libs.findLibrary("hilt.android").get())- add("kapt", libs.findLibrary("hilt.compiler").get())-- // TODO : Remove this dependency once we upgrade to Android Studio Dolphin b/228889042- // These dependencies are currently necessary to render Compose previews- add("debugImplementation", libs.findLibrary("androidx.customview.poolingcontainer").get())-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.compose.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.library.compose.gradle.ktsdeleted file mode 100644index a43b2af87..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.compose.gradle.kts+++ /dev/null@@ -1,25 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureAndroidCompose--plugins {- id("com.android.library")-}--android {- configureAndroidCompose(this)-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.library.gradle.ktsdeleted file mode 100644index 2ddc4b01a..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.gradle.kts+++ /dev/null@@ -1,43 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureKotlinAndroid--plugins {- id("com.android.library")- kotlin("android")-}--android {- configureKotlinAndroid(this)-- defaultConfig {- targetSdk = 32- }-}--val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")--dependencies {- // androidx.test is forcing JUnit, 4.12. This forces it to use 4.13- configurations.configureEach {- resolutionStrategy {- force(libs.findLibrary("junit4").get())- // Temporary workaround for https://issuetracker.google.com/174733673- force("org.objenesis:objenesis:2.6")- }- }-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.jacoco.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.library.jacoco.gradle.ktsdeleted file mode 100644index 2f9a999b8..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.library.jacoco.gradle.kts+++ /dev/null@@ -1,28 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureJacoco--plugins {- id("com.android.library")- jacoco-}--android {- androidComponents {- configureJacoco(this)- }-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.android.test.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.android.test.gradle.ktsdeleted file mode 100644index c273a652c..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.android.test.gradle.kts+++ /dev/null@@ -1,30 +0,0 @@-/*- * Copyright 2022 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.- */--import com.google.samples.apps.nowinandroid.configureKotlinAndroid--plugins {- id("com.android.test")- kotlin("android")-}--android {- configureKotlinAndroid(this)-- defaultConfig {- targetSdk = 31- }-}diff --git a/build-logic/convention/src/main/kotlin/nowinandroid.spotless.gradle.kts b/build-logic/convention/src/main/kotlin/nowinandroid.spotless.gradle.ktsdeleted file mode 100644index 3ba2190f8..000000000--- a/build-logic/convention/src/main/kotlin/nowinandroid.spotless.gradle.kts+++ /dev/null@@ -1,42 +0,0 @@-/*- * Copyright 2022 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.- */--plugins {- id("com.diffplug.spotless")-}--val libs = extensions.getByType<VersionCatalogsExtension>().named("libs")--spotless {- kotlin {- target("**/*.kt")- targetExclude("**/build/**/*.kt")- ktlint(libs.findVersion("ktlint").get().toString()).userData(mapOf("android" to "true"))- licenseHeaderFile(rootProject.file("spotless/copyright.kt"))- }- format("kts") {- target("**/*.kts")- targetExclude("**/build/**/*.kts")- // Look for the first line that doesn't have a block comment (assumed to be the license)- licenseHeaderFile(rootProject.file("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")- }- format("xml") {- target("**/*.xml")- targetExclude("**/build/**/*.xml")- // Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)- licenseHeaderFile(rootProject.file("spotless/copyright.xml"), "(<[^!?])")- }-}