From 21b7ee3c2299e91f0cf7580853dc3631e80f2989 Mon Sep 17 00:00:00 2001 From: dkhawk <107309+dkhawk@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:27:03 -0700 Subject: [PATCH 1/3] feat: Add secrets plugin check to ApiDemos and Advanced samples --- .../ApiDemos/java-app/build.gradle.kts | 40 +++++++++++++++++++ .../ApiDemos/kotlin-app/build.gradle.kts | 40 +++++++++++++++++++ Maps3DSamples/advanced/app/build.gradle.kts | 40 +++++++++++++++++++ 3 files changed, 120 insertions(+) diff --git a/Maps3DSamples/ApiDemos/java-app/build.gradle.kts b/Maps3DSamples/ApiDemos/java-app/build.gradle.kts index 80ed69e..fb74142 100644 --- a/Maps3DSamples/ApiDemos/java-app/build.gradle.kts +++ b/Maps3DSamples/ApiDemos/java-app/build.gradle.kts @@ -1,3 +1,43 @@ +import org.gradle.api.GradleException +import java.io.File + +// Check for secrets.properties file before proceeding with build tasks. +val secretsFile = rootProject.file("secrets.properties") +if (!secretsFile.exists()) { + val requestedTasks = gradle.startParameter.taskNames + if (requestedTasks.isEmpty()) { + // It's likely an IDE sync if no tasks are specified, so just issue a warning. + println("Warning: secrets.properties not found. Gradle sync may succeed, but building/running the app will fail.") + } else { + val buildTaskKeywords = listOf("build", "install", "assemble") + val isBuildTask = requestedTasks.any { task -> + buildTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + val testTaskKeywords = listOf("test", "report", "lint") + val isTestTask = requestedTasks.any { task -> + testTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + if (isBuildTask && !isTestTask) { + val defaultsFile = rootProject.file("local.defaults.properties") + val requiredKeysMessage = if (defaultsFile.exists()) { + defaultsFile.readText() + } else { + "MAPS_API_KEY=" + } + + throw GradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n" + + "\n" + + requiredKeysMessage) + } + } +} + /* * Copyright 2025 Google LLC * diff --git a/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts b/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts index 32e03c6..bb1e497 100644 --- a/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts +++ b/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts @@ -1,3 +1,43 @@ +import org.gradle.api.GradleException +import java.io.File + +// Check for secrets.properties file before proceeding with build tasks. +val secretsFile = rootProject.file("secrets.properties") +if (!secretsFile.exists()) { + val requestedTasks = gradle.startParameter.taskNames + if (requestedTasks.isEmpty()) { + // It's likely an IDE sync if no tasks are specified, so just issue a warning. + println("Warning: secrets.properties not found. Gradle sync may succeed, but building/running the app will fail.") + } else { + val buildTaskKeywords = listOf("build", "install", "assemble") + val isBuildTask = requestedTasks.any { task -> + buildTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + val testTaskKeywords = listOf("test", "report", "lint") + val isTestTask = requestedTasks.any { task -> + testTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + if (isBuildTask && !isTestTask) { + val defaultsFile = rootProject.file("local.defaults.properties") + val requiredKeysMessage = if (defaultsFile.exists()) { + defaultsFile.readText() + } else { + "MAPS_API_KEY=" + } + + throw GradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n" + + "\n" + + requiredKeysMessage) + } + } +} + /* * Copyright 2025 Google LLC * diff --git a/Maps3DSamples/advanced/app/build.gradle.kts b/Maps3DSamples/advanced/app/build.gradle.kts index c6da53d..db5773e 100644 --- a/Maps3DSamples/advanced/app/build.gradle.kts +++ b/Maps3DSamples/advanced/app/build.gradle.kts @@ -1,3 +1,43 @@ +import org.gradle.api.GradleException +import java.io.File + +// Check for secrets.properties file before proceeding with build tasks. +val secretsFile = rootProject.file("secrets.properties") +if (!secretsFile.exists()) { + val requestedTasks = gradle.startParameter.taskNames + if (requestedTasks.isEmpty()) { + // It's likely an IDE sync if no tasks are specified, so just issue a warning. + println("Warning: secrets.properties not found. Gradle sync may succeed, but building/running the app will fail.") + } else { + val buildTaskKeywords = listOf("build", "install", "assemble") + val isBuildTask = requestedTasks.any { task -> + buildTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + val testTaskKeywords = listOf("test", "report", "lint") + val isTestTask = requestedTasks.any { task -> + testTaskKeywords.any { keyword -> + task.contains(keyword, ignoreCase = true) + } + } + + if (isBuildTask && !isTestTask) { + val defaultsFile = rootProject.file("local.defaults.properties") + val requiredKeysMessage = if (defaultsFile.exists()) { + defaultsFile.readText() + } else { + "MAPS_API_KEY=" + } + + throw GradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n" + + "\n" + + requiredKeysMessage) + } + } +} + /* * Copyright 2025 Google LLC * From ef635556a2e2657105ef29dbbf5265330b1901dc Mon Sep 17 00:00:00 2001 From: dkhawk <107309+dkhawk@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:31:30 -0700 Subject: [PATCH 2/3] fix: Move copyright header to top of build.gradle.kts files --- .../ApiDemos/java-app/build.gradle.kts | 32 +++++++++---------- .../ApiDemos/kotlin-app/build.gradle.kts | 32 +++++++++---------- Maps3DSamples/advanced/app/build.gradle.kts | 32 +++++++++---------- 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/Maps3DSamples/ApiDemos/java-app/build.gradle.kts b/Maps3DSamples/ApiDemos/java-app/build.gradle.kts index fb74142..a8989c5 100644 --- a/Maps3DSamples/ApiDemos/java-app/build.gradle.kts +++ b/Maps3DSamples/ApiDemos/java-app/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * Copyright 2025 Google LLC + * + * 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 + * + * http://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 org.gradle.api.GradleException import java.io.File @@ -38,22 +54,6 @@ if (!secretsFile.exists()) { } } -/* - * Copyright 2025 Google LLC - * - * 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 - * - * http://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 { alias(libs.plugins.android.application) alias(libs.plugins.secrets.gradle.plugin) diff --git a/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts b/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts index bb1e497..ac36d7e 100644 --- a/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts +++ b/Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * Copyright 2025 Google LLC + * + * 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 + * + * http://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 org.gradle.api.GradleException import java.io.File @@ -38,22 +54,6 @@ if (!secretsFile.exists()) { } } -/* - * Copyright 2025 Google LLC - * - * 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 - * - * http://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 { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) diff --git a/Maps3DSamples/advanced/app/build.gradle.kts b/Maps3DSamples/advanced/app/build.gradle.kts index db5773e..54b12c7 100644 --- a/Maps3DSamples/advanced/app/build.gradle.kts +++ b/Maps3DSamples/advanced/app/build.gradle.kts @@ -1,3 +1,19 @@ +/* + * Copyright 2025 Google LLC + * + * 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 + * + * http://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 org.gradle.api.GradleException import java.io.File @@ -38,22 +54,6 @@ if (!secretsFile.exists()) { } } -/* - * Copyright 2025 Google LLC - * - * 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 - * - * http://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 { alias(libs.plugins.android.application) alias(libs.plugins.kotlin.android) From 52708b2363ae3ea10023c7e6bc383e84f4f30635 Mon Sep 17 00:00:00 2001 From: dkhawk <107309+dkhawk@users.noreply.github.com> Date: Tue, 6 Jan 2026 17:43:17 -0700 Subject: [PATCH 3/3] chore: Update AGP to 8.13.2 --- Maps3DSamples/ApiDemos/gradle/libs.versions.toml | 2 +- Maps3DSamples/advanced/gradle/libs.versions.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Maps3DSamples/ApiDemos/gradle/libs.versions.toml b/Maps3DSamples/ApiDemos/gradle/libs.versions.toml index 4fd5de6..58fdaee 100644 --- a/Maps3DSamples/ApiDemos/gradle/libs.versions.toml +++ b/Maps3DSamples/ApiDemos/gradle/libs.versions.toml @@ -4,7 +4,7 @@ minSdk = "26" targetSdk = "36" activityCompose = "1.11.0" -agp = "8.13.0" +agp = "8.13.2" appcompat = "1.7.1" composeBom = "2025.09.00" coreKtx = "1.17.0" diff --git a/Maps3DSamples/advanced/gradle/libs.versions.toml b/Maps3DSamples/advanced/gradle/libs.versions.toml index 34fd25f..521629c 100644 --- a/Maps3DSamples/advanced/gradle/libs.versions.toml +++ b/Maps3DSamples/advanced/gradle/libs.versions.toml @@ -3,7 +3,7 @@ compileSdk = "36" minSdk = "26" targetSdk = "36" -agp = "8.13.0" +agp = "8.13.2" kotlin = "2.2.20" kotlinxDatetime = "0.7.1" coreKtx = "1.17.0"