Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Maps3DSamples/ApiDemos/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
40 changes: 40 additions & 0 deletions Maps3DSamples/ApiDemos/java-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,46 @@
* limitations under the License.
*/

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=<YOUR_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)
}
}
}

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.secrets.gradle.plugin)
Expand Down
40 changes: 40 additions & 0 deletions Maps3DSamples/ApiDemos/kotlin-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,46 @@
* limitations under the License.
*/

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=<YOUR_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)
}
}
}

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand Down
40 changes: 40 additions & 0 deletions Maps3DSamples/advanced/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,46 @@
* limitations under the License.
*/

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=<YOUR_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)
}
}
}

plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)
Expand Down
2 changes: 1 addition & 1 deletion Maps3DSamples/advanced/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading