A fully functional Android app built entirely with Kotlin and Jetpack Compose
Apply spotless by default (#2055)
Aurimas5ba16edde991
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.mdindex 265ff2ba5..efe4ef29a 100644--- a/.github/pull_request_template.md+++ b/.github/pull_request_template.md@@ -10,7 +10,7 @@ Thanks for submitting a pull request. To accept your pull request we need you do**Ensure tests pass and code is formatted correctly**- Run local tests on the `DemoDebug` variant by running `./gradlew testDemoDebug`-- Fix code formatting: `./gradlew --init-script gradle/init.gradle.kts spotlessApply`+- Fix code formatting: `./gradlew spotlessApply`**Add a description**diff --git a/.github/workflows/Build.yaml b/.github/workflows/Build.yamlindex 7e5a80eea..eec554b37 100644--- a/.github/workflows/Build.yaml+++ b/.github/workflows/Build.yaml@@ -48,7 +48,7 @@ jobs:run: ./gradlew :build-logic:convention:check- name: Check spotless- run: ./gradlew spotlessCheck --init-script gradle/init.gradle.kts --no-configuration-cache+ run: ./gradlew spotlessCheck- name: Check Dependency Guardid: dependencyguard_verifydiff --git a/.run/spotlessApply.run.xml b/.run/spotlessApply.run.xmlindex 5c4dac833..03bd19a6d 100644--- a/.run/spotlessApply.run.xml+++ b/.run/spotlessApply.run.xml@@ -4,7 +4,6 @@<option name="executionName" /><option name="externalProjectPath" value="$PROJECT_DIR$" /><option name="externalSystemIdString" value="GRADLE" />- <option name="scriptParameters" value="--init-script=gradle/init.gradle.kts" /><option name="taskDescriptions"><list /></option>diff --git a/AGENTS.md b/AGENTS.mdindex efb39ef19..edcfd396e 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -26,7 +26,7 @@ The main Android app lives in the `app/` folder. Feature modules live in `featurThe app and Android libraries have two product flavors: `demo` and `prod`, and two build types: `debug` and `release`.- Build: `./gradlew assemble{Variant}`. Typically `assembleDemoDebug`.-- Fix linting/formatting: `./gradlew --init-script gradle/init.gradle.kts spotlessApply`+- Fix linting/formatting: `./gradlew spotlessApply`- Run local tests: `./gradlew {variant}Test`- Run single test: `./gradlew {variant}Test --tests "com.example.myapp.MyTestClass"`- Run local screenshot tests: `./gradlew verifyRoborazziDemoDebug`diff --git a/app-nia-catalog/src/main/AndroidManifest.xml b/app-nia-catalog/src/main/AndroidManifest.xmlindex 90341aac1..57286c5f1 100644--- a/app-nia-catalog/src/main/AndroidManifest.xml+++ b/app-nia-catalog/src/main/AndroidManifest.xml@@ -36,4 +36,4 @@</activity></application>-</manifest>\ No newline at end of file+</manifest>diff --git a/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xmlindex 28878a729..9572fa6cb 100644--- a/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml+++ b/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml@@ -18,4 +18,4 @@<background android:drawable="@drawable/ic_launcher_background"/><foreground android:drawable="@drawable/ic_launcher_foreground"/><monochrome android:drawable="@drawable/ic_launcher_foreground" />-</adaptive-icon>\ No newline at end of file+</adaptive-icon>diff --git a/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmlindex 28878a729..9572fa6cb 100644--- a/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml+++ b/app-nia-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml@@ -18,4 +18,4 @@<background android:drawable="@drawable/ic_launcher_background"/><foreground android:drawable="@drawable/ic_launcher_foreground"/><monochrome android:drawable="@drawable/ic_launcher_foreground" />-</adaptive-icon>\ No newline at end of file+</adaptive-icon>diff --git a/app-nia-catalog/src/main/res/values/strings.xml b/app-nia-catalog/src/main/res/values/strings.xmlindex 69a3e1b11..0d92aba29 100644--- a/app-nia-catalog/src/main/res/values/strings.xml+++ b/app-nia-catalog/src/main/res/values/strings.xml@@ -16,4 +16,4 @@--><resources><string name="app_name">NiA Catalog</string>-</resources>\ No newline at end of file+</resources>diff --git a/app-nia-catalog/src/main/res/values/themes.xml b/app-nia-catalog/src/main/res/values/themes.xmlindex 9aeeb83a6..afcbaf5fc 100644--- a/app-nia-catalog/src/main/res/values/themes.xml+++ b/app-nia-catalog/src/main/res/values/themes.xml@@ -16,4 +16,4 @@--><resources><style name="Theme.NiaCatalog" parent="android:Theme.Material.Light.NoActionBar" />-</resources>\ No newline at end of file+</resources>diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xmlindex 28878a729..9572fa6cb 100644--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml@@ -18,4 +18,4 @@<background android:drawable="@drawable/ic_launcher_background"/><foreground android:drawable="@drawable/ic_launcher_foreground"/><monochrome android:drawable="@drawable/ic_launcher_foreground" />-</adaptive-icon>\ No newline at end of file+</adaptive-icon>diff --git a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xmlindex 28878a729..9572fa6cb 100644--- a/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml+++ b/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml@@ -18,4 +18,4 @@<background android:drawable="@drawable/ic_launcher_background"/><foreground android:drawable="@drawable/ic_launcher_foreground"/><monochrome android:drawable="@drawable/ic_launcher_foreground" />-</adaptive-icon>\ No newline at end of file+</adaptive-icon>diff --git a/app/src/prod/AndroidManifest.xml b/app/src/prod/AndroidManifest.xmlindex 2f8a8592a..4438a1de0 100644--- a/app/src/prod/AndroidManifest.xml+++ b/app/src/prod/AndroidManifest.xml@@ -23,4 +23,4 @@android:name="firebase_analytics_collection_deactivated"android:value="false" /></application>-</manifest>\ No newline at end of file+</manifest>diff --git a/build-logic/convention/build.gradle.kts b/build-logic/convention/build.gradle.ktsindex 5faf257c1..41491da4f 100644--- a/build-logic/convention/build.gradle.kts+++ b/build-logic/convention/build.gradle.kts@@ -45,6 +45,7 @@ dependencies {compileOnly(libs.kotlin.gradlePlugin)compileOnly(libs.ksp.gradlePlugin)compileOnly(libs.room.gradlePlugin)+ compileOnly(libs.spotless.gradlePlugin)implementation(libs.truth)lintChecks(libs.androidx.lint.gradle)}diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.ktindex 0a33b719f..b5725e63c 100644--- a/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationComposeConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.ktindex 8c45a056c..1dd550d87 100644--- a/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtension@@ -20,6 +20,7 @@ import com.google.samples.apps.nowinandroid.configureBadgingTasksimport com.google.samples.apps.nowinandroid.configureGradleManagedDevicesimport com.google.samples.apps.nowinandroid.configureKotlinAndroidimport com.google.samples.apps.nowinandroid.configurePrintApksTask+import com.google.samples.apps.nowinandroid.configureSpotlessForAndroidimport org.gradle.api.Pluginimport org.gradle.api.Projectimport org.gradle.kotlin.dsl.apply@@ -42,6 +43,7 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {configurePrintApksTask(this)configureBadgingTasks(this)}+ configureSpotlessForAndroid()}}}diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.ktindex be3ec0365..343bb2e8e 100644--- a/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationFirebaseConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtension@@ -41,7 +41,7 @@ class AndroidApplicationFirebaseConventionPlugin : Plugin<Project> {datastore-proto brings in protobuf dependencies. These are the source of truthfor Now in Android.That's why the duplicate classes from below dependencies are excluded.- */+ */exclude(group = "com.google.protobuf", module = "protobuf-javalite")exclude(group = "com.google.firebase", module = "protolite-well-known-types")}diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationFlavorsConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationFlavorsConventionPlugin.ktindex 46b019d7a..6954aaae6 100644--- a/build-logic/convention/src/main/kotlin/AndroidApplicationFlavorsConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationFlavorsConventionPlugin.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtension@@ -28,4 +28,4 @@ class AndroidApplicationFlavorsConventionPlugin : Plugin<Project> {}}}-}\ No newline at end of file+}diff --git a/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.ktindex 326d03f4f..22e25b638 100644--- a/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidApplicationJacocoConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureApiConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureApiConventionPlugin.ktindex 969cf96d4..7c2b49180 100644--- a/build-logic/convention/src/main/kotlin/AndroidFeatureApiConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidFeatureApiConventionPlugin.kt@@ -1,20 +1,19 @@/** 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+ * 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+ * 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.+ * 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.libsimport org.gradle.api.Pluginimport org.gradle.api.Projectimport org.gradle.kotlin.dsl.applydiff --git a/build-logic/convention/src/main/kotlin/AndroidFeatureImplConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidFeatureImplConventionPlugin.ktindex 500e3e983..82459e07f 100644--- a/build-logic/convention/src/main/kotlin/AndroidFeatureImplConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidFeatureImplConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.LibraryExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.ktindex 18cd2bd7d..10938ca37 100644--- a/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryComposeConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.LibraryExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.ktindex ee47e823a..1f97fe8d1 100644--- a/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.LibraryExtension@@ -20,6 +20,7 @@ import com.google.samples.apps.nowinandroid.configureFlavorsimport com.google.samples.apps.nowinandroid.configureGradleManagedDevicesimport com.google.samples.apps.nowinandroid.configureKotlinAndroidimport com.google.samples.apps.nowinandroid.configurePrintApksTask+import com.google.samples.apps.nowinandroid.configureSpotlessForAndroidimport com.google.samples.apps.nowinandroid.disableUnnecessaryAndroidTestsimport com.google.samples.apps.nowinandroid.libsimport org.gradle.api.Plugin@@ -52,6 +53,7 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {configurePrintApksTask(this)disableUnnecessaryAndroidTests(target)}+ configureSpotlessForAndroid()dependencies {"androidTestImplementation"(libs.findLibrary("kotlin.test").get())"testImplementation"(libs.findLibrary("kotlin.test").get())diff --git a/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.ktindex 2fd97d456..dcda1d98a 100644--- a/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidLibraryJacocoConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.LibraryExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidLintConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidLintConventionPlugin.ktindex 884d6f076..c701983b1 100644--- a/build-logic/convention/src/main/kotlin/AndroidLintConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidLintConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.ApplicationExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.ktindex 6919b5e5d..c199914db 100644--- a/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidRoomConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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 androidx.room.gradle.RoomExtensiondiff --git a/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.ktindex 8a2f0b5a4..155889464 100644--- a/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/AndroidTestConventionPlugin.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.android.build.api.dsl.TestExtensiondiff --git a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.ktindex 82bf9f60c..938595417 100644--- a/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/HiltConventionPlugin.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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.android.build.gradle.api.AndroidBasePlugindiff --git a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.ktindex a1477891d..f2be5c8ac 100644--- a/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt+++ b/build-logic/convention/src/main/kotlin/JvmLibraryConventionPlugin.kt@@ -1,20 +1,21 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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.configureKotlinJvm+import com.google.samples.apps.nowinandroid.configureSpotlessForJvmimport com.google.samples.apps.nowinandroid.libsimport org.gradle.api.Pluginimport org.gradle.api.Project@@ -28,6 +29,7 @@ class JvmLibraryConventionPlugin : Plugin<Project> {apply(plugin = "nowinandroid.android.lint")configureKotlinJvm()+ configureSpotlessForJvm()dependencies {"testImplementation"(libs.findLibrary("kotlin.test").get())}diff --git a/build-logic/convention/src/main/kotlin/RootPlugin.kt b/build-logic/convention/src/main/kotlin/RootPlugin.ktindex b704adf76..34d194443 100644--- a/build-logic/convention/src/main/kotlin/RootPlugin.kt+++ b/build-logic/convention/src/main/kotlin/RootPlugin.kt@@ -15,6 +15,7 @@*/import com.google.samples.apps.nowinandroid.configureGraphTasks+import com.google.samples.apps.nowinandroid.configureSpotlessForRootProjectimport org.gradle.api.Pluginimport org.gradle.api.Project@@ -22,5 +23,6 @@ class RootPlugin : Plugin<Project> {override fun apply(target: Project) {require(target.path == ":")target.subprojects { configureGraphTasks() }+ target.configureSpotlessForRootProject()}}diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidInstrumentedTests.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidInstrumentedTests.ktindex c51dac5c9..9531e9caf 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidInstrumentedTests.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/AndroidInstrumentedTests.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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@@ -30,6 +30,6 @@ import org.gradle.api.Projectinternal fun LibraryAndroidComponentsExtension.disableUnnecessaryAndroidTests(project: Project,) = beforeVariants {- it.androidTest.enable = it.androidTest.enable- && project.projectDir.resolve("src/androidTest").exists()+ it.androidTest.enable = it.androidTest.enable &&+ project.projectDir.resolve("src/androidTest").exists()}diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.ktindex e747325ee..803ee00e7 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Badging.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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@@ -123,7 +123,6 @@ fun Project.configureBadgingTasks(badging = project.layout.buildDirectory.file("outputs/apk_from_bundle/${variant.name}/${variant.name}-badging.txt",)-}val updateBadgingTaskName = "update${capitalizedVariantName}Badging"@@ -141,7 +140,6 @@ fun Project.configureBadgingTasks(this.updateBadgingTaskName = updateBadgingTaskNameoutput = project.layout.buildDirectory.dir("intermediates/$checkBadgingTaskName")-}}}diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.ktindex 992a3f91e..548df4c2f 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/GradleManagedDevices.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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@@ -34,7 +34,6 @@ internal fun configureGradleManagedDevices(val allDevices = listOf(pixel4, pixel6, pixelC)val ciDevices = listOf(pixel4, pixelC)-commonExtension.testOptions.apply {@Suppress("UnstableApiUsage")managedDevices {diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.ktindex 8d16c428e..096808c60 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Jacoco.kt@@ -17,12 +17,10 @@package com.google.samples.apps.nowinandroidimport com.android.build.api.artifact.ScopedArtifact-import com.android.build.api.dsl.BuildTypeimport com.android.build.api.dsl.CommonExtensionimport com.android.build.api.variant.AndroidComponentsExtensionimport com.android.build.api.variant.ScopedArtifactsimport com.android.build.api.variant.SourceDirectories-import org.gradle.api.NamedDomainObjectContainerimport org.gradle.api.Projectimport org.gradle.api.file.Directoryimport org.gradle.api.file.RegularFile@@ -86,7 +84,6 @@ internal fun Project.configureJacoco("create${variant.name.capitalize()}CombinedCoverageReport",JacocoReport::class,) {-classDirectories.setFrom(allJars,allDirectories.map { dirs ->@@ -107,7 +104,7 @@ internal fun Project.configureJacoco(sourceDirectories.setFrom(files(variant.sources.java.toFilePaths(),- variant.sources.kotlin.toFilePaths()+ variant.sources.kotlin.toFilePaths(),),)@@ -120,7 +117,6 @@ internal fun Project.configureJacoco()}-variant.artifacts.forScope(ScopedArtifacts.Scope.PROJECT).use(reportTask).toGet(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.ktindex 37b1ba99b..7ee7b0e90 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@@ -103,7 +103,7 @@ private inline fun <reified T : KotlinBaseExtension> Project.configureKotlin() =* The binary signature changes. The error on the declaration is no longer reported.* '-Xconsistent-data-class-copy-visibility' compiler flag and ConsistentCopyVisibility annotation are now unnecessary.*/- "-Xconsistent-data-class-copy-visibility"+ "-Xconsistent-data-class-copy-visibility",)}}diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaBuildType.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaBuildType.ktindex e4f40840d..f4d6f038b 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaBuildType.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaBuildType.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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.nowinandroiddiff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.ktindex 96ca6073d..a294c0c51 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/NiaFlavor.kt@@ -1,3 +1,19 @@+/*+ * Copyright 2026 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.nowinandroidimport com.android.build.api.dsl.ApplicationExtension@@ -8,7 +24,7 @@ import org.gradle.kotlin.dsl.invoke@Suppress("EnumEntryName")enum class FlavorDimension {- contentType+ contentType,}// The content for the app can either come from local static data which is useful for demodiff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/PrintTestApks.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/PrintTestApks.ktindex 271fc51b7..e2a96eedf 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/PrintTestApks.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/PrintTestApks.kt@@ -1,17 +1,17 @@/** 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+ * 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+ * 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.+ * 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@@ -49,7 +49,9 @@ internal fun Project.configurePrintApksTask(extension: AndroidComponentsExtensiojavaSources.zip(kotlinSources) { javaDirs, kotlinDirs ->javaDirs + kotlinDirs}- } else javaSources ?: kotlinSources+ } else {+ javaSources ?: kotlinSources+ }if (artifact != null && testSources != null) {tasks.register(@@ -96,8 +98,9 @@ internal abstract class PrintApkLocationTask : DefaultTask() {val builtArtifacts = builtArtifactsLoader.get().load(apkFolder.get())?: throw RuntimeException("Cannot load APKs")- if (builtArtifacts.elements.size != 1)+ if (builtArtifacts.elements.size != 1) {throw RuntimeException("Expected one APK !")+ }val apk = File(builtArtifacts.elements.single().outputFile).toPath()println(apk)}diff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/ProjectExtensions.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/ProjectExtensions.ktindex e45d7f2e1..8bf6e1dfe 100644--- a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/ProjectExtensions.kt+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/ProjectExtensions.kt@@ -1,17 +1,17 @@/** Copyright 2023 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+ * 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+ * 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.+ * 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.nowinandroiddiff --git a/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.ktnew file mode 100644index 000000000..3d4ac8f3e--- /dev/null+++ b/build-logic/convention/src/main/kotlin/com/google/samples/apps/nowinandroid/Spotless.kt@@ -0,0 +1,80 @@+/*+ * Copyright 2026 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++import com.diffplug.gradle.spotless.SpotlessExtension+import org.gradle.api.Project+import org.gradle.kotlin.dsl.apply+import org.gradle.kotlin.dsl.configure++internal fun Project.configureSpotlessForAndroid() {+ configureSpotlessCommon()+ extensions.configure<SpotlessExtension> {+ format("xml") {+ target("src/**/*.xml")+ // Look for the first XML tag that isn't a comment (<!--) or the xml declaration (<?xml)+ licenseHeaderFile(rootDir.resolve("spotless/copyright.xml"), "(<[^!?])")+ endWithNewline()+ }+ }+}++internal fun Project.configureSpotlessForJvm() {+ configureSpotlessCommon()+}++internal fun Project.configureSpotlessForRootProject() {+ apply(plugin = "com.diffplug.spotless")+ extensions.configure<SpotlessExtension> {+ kotlin {+ target("build-logic/convention/src/**/*.kt")+ ktlint(libs.findVersion("ktlint").get().requiredVersion).editorConfigOverride(+ mapOf("android" to "true"),+ )+ licenseHeaderFile(rootDir.resolve("spotless/copyright.kt"))+ endWithNewline()+ }+ format("kts") {+ target("*.kts")+ target("build-logic/*.kts")+ target("build-logic/convention/*.kts")+ // Look for the first line that doesn't have a block comment (assumed to be the license)+ licenseHeaderFile(rootDir.resolve("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")+ endWithNewline()+ }+ }+}++private fun Project.configureSpotlessCommon() {+ apply(plugin = "com.diffplug.spotless")+ extensions.configure<SpotlessExtension> {+ kotlin {+ target("src/**/*.kt")+ ktlint(libs.findVersion("ktlint").get().requiredVersion).editorConfigOverride(+ mapOf("android" to "true"),+ )+ licenseHeaderFile(rootDir.resolve("spotless/copyright.kt"))+ endWithNewline()+ }+ format("kts") {+ target("*.kts")+ // Look for the first line that doesn't have a block comment (assumed to be the license)+ licenseHeaderFile(rootDir.resolve("spotless/copyright.kts"), "(^(?![\\/ ]\\*).*$)")+ endWithNewline()+ }+ }+}diff --git a/build.gradle.kts b/build.gradle.ktsindex 594f7f92e..3096d6bda 100644--- a/build.gradle.kts+++ b/build.gradle.kts@@ -38,5 +38,6 @@ plugins {alias(libs.plugins.roborazzi) apply falsealias(libs.plugins.google.osslicenses) apply falsealias(libs.plugins.room) apply false+ alias(libs.plugins.spotless) apply falsealias(libs.plugins.nowinandroid.root)}diff --git a/core/analytics/src/main/AndroidManifest.xml b/core/analytics/src/main/AndroidManifest.xmlindex a522a4c23..312b22fd3 100644--- a/core/analytics/src/main/AndroidManifest.xml+++ b/core/analytics/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/common/build.gradle.kts b/core/common/build.gradle.ktsindex f1aa9771c..e71b9dc8e 100644--- a/core/common/build.gradle.kts+++ b/core/common/build.gradle.kts@@ -22,4 +22,4 @@ dependencies {implementation(libs.kotlinx.coroutines.core)testImplementation(libs.kotlinx.coroutines.test)testImplementation(libs.turbine)-}\ No newline at end of file+}diff --git a/core/data/src/main/AndroidManifest.xml b/core/data/src/main/AndroidManifest.xmlindex a5c595622..50b72ebf5 100644--- a/core/data/src/main/AndroidManifest.xml+++ b/core/data/src/main/AndroidManifest.xml@@ -16,4 +16,4 @@--><manifest xmlns:android="http://schemas.android.com/apk/res/android"><uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />-</manifest>\ No newline at end of file+</manifest>diff --git a/core/database/src/main/AndroidManifest.xml b/core/database/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/database/src/main/AndroidManifest.xml+++ b/core/database/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/datastore-test/src/main/AndroidManifest.xml b/core/datastore-test/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/datastore-test/src/main/AndroidManifest.xml+++ b/core/datastore-test/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/datastore/src/main/AndroidManifest.xml b/core/datastore/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/datastore/src/main/AndroidManifest.xml+++ b/core/datastore/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/designsystem/src/main/AndroidManifest.xml b/core/designsystem/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/designsystem/src/main/AndroidManifest.xml+++ b/core/designsystem/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/domain/build.gradle.kts b/core/domain/build.gradle.ktsindex 191877459..728f8758a 100644--- a/core/domain/build.gradle.kts+++ b/core/domain/build.gradle.kts@@ -30,4 +30,4 @@ dependencies {implementation(libs.javax.inject)testImplementation(projects.core.testing)-}\ No newline at end of file+}diff --git a/core/domain/src/main/AndroidManifest.xml b/core/domain/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/domain/src/main/AndroidManifest.xml+++ b/core/domain/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/network/src/main/AndroidManifest.xml b/core/network/src/main/AndroidManifest.xmlindex 0cb50fd30..7d11a6f1b 100644--- a/core/network/src/main/AndroidManifest.xml+++ b/core/network/src/main/AndroidManifest.xml@@ -17,4 +17,4 @@<manifest xmlns:android="http://schemas.android.com/apk/res/android"><uses-permission android:name="android.permission.INTERNET" />-</manifest>\ No newline at end of file+</manifest>diff --git a/core/notifications/src/main/res/drawable-anydpi-v24/core_notifications_ic_nia_notification.xml b/core/notifications/src/main/res/drawable-anydpi-v24/core_notifications_ic_nia_notification.xmlindex 8037f9089..243238250 100644--- a/core/notifications/src/main/res/drawable-anydpi-v24/core_notifications_ic_nia_notification.xml+++ b/core/notifications/src/main/res/drawable-anydpi-v24/core_notifications_ic_nia_notification.xml@@ -28,4 +28,4 @@android:pathData="M17.6,11.48 L19.44,8.3a0.63,0.63 0,0 0,-1.09 -0.63l-1.88,3.24a11.43,11.43 0,0 0,-8.94 0L5.65,7.67a0.63,0.63 0,0 0,-1.09 0.63L6.4,11.48A10.81,10.81 0,0 0,1 20L23,20A10.81,10.81 0,0 0,17.6 11.48ZM7,17.25A1.25,1.25 0,1 1,8.25 16,1.25 1.25,0 0,1 7,17.25ZM17,17.25A1.25,1.25 0,1 1,18.25 16,1.25 1.25,0 0,1 17,17.25Z"android:fillColor="#FF000000"/></group>-</vector>\ No newline at end of file+</vector>diff --git a/core/screenshot-testing/src/main/AndroidManifest.xml b/core/screenshot-testing/src/main/AndroidManifest.xmlindex 5952f8bfd..59ed4cb48 100644--- a/core/screenshot-testing/src/main/AndroidManifest.xml+++ b/core/screenshot-testing/src/main/AndroidManifest.xml@@ -21,4 +21,4 @@Theme_Material_Light_NoActionBar is the base theme used by the production app.--><application android:theme="@android:style/Theme.Material.NoActionBar" />-</manifest>\ No newline at end of file+</manifest>diff --git a/core/testing/src/main/AndroidManifest.xml b/core/testing/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/testing/src/main/AndroidManifest.xml+++ b/core/testing/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/core/ui/src/main/AndroidManifest.xml b/core/ui/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/core/ui/src/main/AndroidManifest.xml+++ b/core/ui/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/feature/bookmarks/api/build.gradle.kts b/feature/bookmarks/api/build.gradle.ktsindex a51468615..2dc2a3f95 100644--- a/feature/bookmarks/api/build.gradle.kts+++ b/feature/bookmarks/api/build.gradle.kts@@ -20,4 +20,4 @@ plugins {android {namespace = "com.google.samples.apps.nowinandroid.feature.bookmarks.api"-}\ No newline at end of file+}diff --git a/feature/bookmarks/impl/src/main/AndroidManifest.xml b/feature/bookmarks/impl/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/feature/bookmarks/impl/src/main/AndroidManifest.xml+++ b/feature/bookmarks/impl/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/feature/foryou/api/src/main/AndroidManifest.xml b/feature/foryou/api/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/feature/foryou/api/src/main/AndroidManifest.xml+++ b/feature/foryou/api/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/feature/foryou/api/src/main/res/values/strings.xml b/feature/foryou/api/src/main/res/values/strings.xmlindex f0595944f..cb4297c35 100644--- a/feature/foryou/api/src/main/res/values/strings.xml+++ b/feature/foryou/api/src/main/res/values/strings.xml@@ -21,4 +21,4 @@<string name="feature_foryou_api_navigate_up">Navigate up</string><string name="feature_foryou_api_onboarding_guidance_title">What are you interested in?</string><string name="feature_foryou_api_onboarding_guidance_subtitle">Updates from topics you follow will appear here. Follow some things to get started.</string>-</resources>\ No newline at end of file+</resources>diff --git a/feature/foryou/impl/build.gradle.kts b/feature/foryou/impl/build.gradle.ktsindex 7964f8c4f..b8115d292 100644--- a/feature/foryou/impl/build.gradle.kts+++ b/feature/foryou/impl/build.gradle.kts@@ -40,4 +40,4 @@ dependencies {androidTestImplementation(libs.bundles.androidx.compose.ui.test)androidTestImplementation(projects.core.testing)-}\ No newline at end of file+}diff --git a/feature/interests/api/build.gradle.kts b/feature/interests/api/build.gradle.ktsindex 7a2dfd65e..19c5db14c 100644--- a/feature/interests/api/build.gradle.kts+++ b/feature/interests/api/build.gradle.kts@@ -20,4 +20,4 @@ plugins {android {namespace = "com.google.samples.apps.nowinandroid.feature.interests.api"-}\ No newline at end of file+}diff --git a/feature/interests/api/src/main/AndroidManifest.xml b/feature/interests/api/src/main/AndroidManifest.xmlindex 51d0cfc2e..27a3ea8b0 100644--- a/feature/interests/api/src/main/AndroidManifest.xml+++ b/feature/interests/api/src/main/AndroidManifest.xml@@ -14,4 +14,4 @@See the License for the specific language governing permissions andlimitations under the License.-->-<manifest />\ No newline at end of file+<manifest />diff --git a/feature/interests/api/src/main/res/drawable/feature_interests_api_ic_detail_placeholder.xml b/feature/interests/api/src/main/res/drawable/feature_interests_api_ic_detail_placeholder.xmlindex 2789b54e6..0518401da 100644--- a/feature/interests/api/src/main/res/drawable/feature_interests_api_ic_detail_placeholder.xml+++ b/feature/interests/api/src/main/res/drawable/feature_interests_api_ic_detail_placeholder.xml@@ -52,4 +52,4 @@android:strokeColor="#8C4190"android:strokeLineCap="round"android:strokeWidth="2" />-</vector>\ No newline at end of file+</vector>diff --git a/feature/search/api/build.gradle.kts b/feature/search/api/build.gradle.ktsindex d7ea6fc5f..a46189b1e 100644--- a/feature/search/api/build.gradle.kts+++ b/feature/search/api/build.gradle.kts@@ -25,4 +25,3 @@ android {dependencies {implementation(projects.core.domain)}-diff --git a/feature/search/impl/build.gradle.kts b/feature/search/impl/build.gradle.ktsindex 8425b29f3..a33b941c4 100644--- a/feature/search/impl/build.gradle.kts+++ b/feature/search/impl/build.gradle.kts@@ -34,4 +34,4 @@ dependencies {androidTestImplementation(libs.bundles.androidx.compose.ui.test)androidTestImplementation(projects.core.testing)-}\ No newline at end of file+}diff --git a/feature/topic/api/build.gradle.kts b/feature/topic/api/build.gradle.ktsindex 923a9b38b..97bed820a 100644--- a/feature/topic/api/build.gradle.kts+++ b/feature/topic/api/build.gradle.kts@@ -22,4 +22,4 @@ plugins {android {namespace = "com.google.samples.apps.nowinandroid.feature.topic.api"-}\ No newline at end of file+}diff --git a/feature/topic/impl/build.gradle.kts b/feature/topic/impl/build.gradle.ktsindex fdf37c32e..0e895722a 100644--- a/feature/topic/impl/build.gradle.kts+++ b/feature/topic/impl/build.gradle.kts@@ -35,4 +35,4 @@ dependencies {androidTestImplementation(libs.bundles.androidx.compose.ui.test)androidTestImplementation(projects.core.testing)-}\ No newline at end of file+}diff --git a/gradle/init.gradle.kts b/gradle/init.gradle.ktsdeleted file mode 100644index 44dc41200..000000000--- a/gradle/init.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.- */--val ktlintVersion = "1.4.0"--initscript {- val spotlessVersion = "6.25.0"-- repositories {- mavenCentral()- }-- dependencies {- classpath("com.diffplug.spotless:spotless-plugin-gradle:$spotlessVersion")- }-}--rootProject {- subprojects {- apply<com.diffplug.gradle.spotless.SpotlessPlugin>()- extensions.configure<com.diffplug.gradle.spotless.SpotlessExtension> {- kotlin {- target("**/*.kt")- targetExclude("**/build/**/*.kt")- ktlint(ktlintVersion).editorConfigOverride(- 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"), "(<[^!?])")- }- }- }-}diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex f6dd9379d..fbe070c1a 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -51,6 +51,7 @@ kotlinxCoroutines = "1.10.1"kotlinxDatetime = "0.6.1"kotlinxSerializationJson = "1.8.0"ksp = "2.3.4"+ktlint = "1.4.0"okhttp = "4.12.0"protobuf = "4.29.2"protobufPlugin = "0.9.6"@@ -59,6 +60,7 @@ retrofitKotlinxSerializationJson = "1.0.0"robolectric = "4.16"roborazzi = "1.56.0"room = "2.8.3"+spotless = "8.2.1"truth = "1.4.4"turbine = "1.2.0"uiTestJunit4 = "1.9.0-rc01"@@ -171,6 +173,7 @@ kotlin-gradlePlugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plksp-gradlePlugin = { group = "com.google.devtools.ksp", name = "com.google.devtools.ksp.gradle.plugin", version.ref = "ksp" }room-gradlePlugin = { group = "androidx.room", name = "room-gradle-plugin", version.ref = "room" }androidx-compose-ui-test-junit4 = { group = "androidx.compose.ui", name = "ui-test-junit4", version.ref = "uiTestJunit4" }+spotless-gradlePlugin = { group = "com.diffplug.spotless", name = "spotless-plugin-gradle", version.ref = "spotless" }[plugins]android-application = { id = "com.android.application", version.ref = "androidGradlePlugin" }@@ -191,6 +194,7 @@ google-osslicenses = { id = "com.google.android.gms.oss-licenses-plugin", versioprotobuf = { id = "com.google.protobuf", version.ref = "protobufPlugin" }roborazzi = { id = "io.github.takahirom.roborazzi", version.ref = "roborazzi" }room = { id = "androidx.room", version.ref = "room" }+spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }# Plugins defined by this projectnowinandroid-android-application = { id = "nowinandroid.android.application" }diff --git a/tools/pre-push b/tools/pre-pushindex 81157f9ca..5d340b635 100644--- a/tools/pre-push+++ b/tools/pre-push@@ -88,7 +88,7 @@ doneif [[ -n "$run_checks" ]]; then# pre-push usually executes in the repository root, but just to be safe...cd "$(git rev-parse --show-toplevel)"- ./gradlew --init-script gradle/init.gradle.kts --no-configuration-cache check+ ./gradlew checkexit $?fidiff --git a/ui-test-hilt-manifest/src/main/AndroidManifest.xml b/ui-test-hilt-manifest/src/main/AndroidManifest.xmlindex d35bfe1e2..effeb7305 100644--- a/ui-test-hilt-manifest/src/main/AndroidManifest.xml+++ b/ui-test-hilt-manifest/src/main/AndroidManifest.xml@@ -27,4 +27,4 @@/></application>-</manifest>\ No newline at end of file+</manifest>