You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* build: refactor into modules
* build: enhance API key validation and standardize installAndLaunch tasks
This commit introduces rigorous safety checks for API key loading across all sample applications and standardizes local shell deployments.
Validation Changes:
1. Regex Enforcement: Replaced naive substring equality checks with a strict ^AIza[a-zA-Z0-9_-]{35}$ Regex pattern to guarantee structural validity of the MAPS3D_API_KEY.
2. Graceful MAPS_API_KEY Handling: Downgraded the presence of MAPS_API_KEY from a hard build failure (GradleException) to a standard warning to prevent breaking unified workspaces.
3. Active Payload Parsing: Introduced java.util.Properties into the scripts to safely parse the properties file buffer.
4. Expanded Coverage: Integrated the complete secrets validation block dynamically into both Snippet build.gradle.kts files ensuring full modular parity.
Workflow Changes (installAndLaunch):
- Advanced App & Java ApiDemo: Added a brand new installAndLaunch task depending on installDebug to ADB intent the fully qualified main activity.
- Snippets (Java & Kotlin): Renamed existing installAndLaunchDebug tasks to installAndLaunch to guarantee exact parity across the workspace, attaching standard description and group metadata.
* build: enhance API key validation and standardize installAndLaunch tasks
This commit introduces rigorous safety checks for API key loading across all sample applications and standardizes local shell deployments.
Validation Changes:
1. Regex Enforcement: Replaced naive substring equality checks with a strict ^AIza[a-zA-Z0-9_-]{35}$ Regex pattern to guarantee structural validity of the MAPS3D_API_KEY.
2. Graceful MAPS_API_KEY Handling: Downgraded the presence of MAPS_API_KEY from a hard build failure (GradleException) to a standard warning to prevent breaking unified workspaces.
3. Active Payload Parsing: Introduced java.util.Properties into the scripts to safely parse the properties file buffer.
4. Expanded Coverage: Integrated the complete secrets validation block dynamically into both Snippet build.gradle.kts files ensuring full modular parity.
Workflow Changes (installAndLaunch):
- Advanced App & Java ApiDemo: Added a brand new installAndLaunch task depending on installDebug to ADB intent the fully qualified main activity.
- Snippets (Java & Kotlin): Renamed existing installAndLaunchDebug tasks to installAndLaunch to guarantee exact parity across the workspace, attaching standard description and group metadata.
---------
Co-authored-by: dkhawk <107309+dkhawk@users.noreply.github.com>
val defaultsFile = rootProject.file("local.defaults.properties")
47
50
val requiredKeysMessage =if (defaultsFile.exists()) {
48
51
defaultsFile.readText()
49
52
} else {
50
-
"MAPS_API_KEY=<YOUR_API_KEY>"
53
+
"MAPS3D_API_KEY=<YOUR_API_KEY>"
54
+
}
55
+
56
+
if (!secretsFile.exists()) {
57
+
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n\n$requiredKeysMessage")
51
58
}
52
59
53
-
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n"+
val defaultsFile = rootProject.file("local.defaults.properties")
50
51
val requiredKeysMessage =if (defaultsFile.exists()) {
51
52
defaultsFile.readText()
52
53
} else {
53
-
"MAPS_API_KEY=<YOUR_API_KEY>"
54
+
"MAPS3D_API_KEY=<YOUR_API_KEY>"
54
55
}
55
56
56
-
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n"+
57
-
"\n"+
58
-
requiredKeysMessage)
57
+
if (!secretsFile.exists()) {
58
+
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n\n$requiredKeysMessage")
val defaultsFile = rootProject.file("local.defaults.properties")
47
50
val requiredKeysMessage =if (defaultsFile.exists()) {
48
51
defaultsFile.readText()
49
52
} else {
50
-
"MAPS_API_KEY=<YOUR_API_KEY>"
53
+
"MAPS3D_API_KEY=<YOUR_API_KEY>"
54
+
}
55
+
56
+
if (!secretsFile.exists()) {
57
+
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n\n$requiredKeysMessage")
51
58
}
52
59
53
-
throwGradleException("secrets.properties file not found. Please create a 'secrets.properties' file in the root project directory with the following content:\n"+
0 commit comments