chore: Using secrets-gradle-plugin (#432)

* chore: Using secrets-gradle-plugin

* Using secrets-gradle-plugin in all projects.

* Using 0.4 version of secrets-gradle-plugin
This commit is contained in:
Chris Arriola 2021-01-27 13:30:29 -08:00 committed by GitHub
parent 0514d79efa
commit 99da3d7c5f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 142 additions and 187 deletions

View File

@ -1,16 +1,10 @@
import org.apache.tools.ant.filters.ConcatFilter
apply plugin: 'com.android.application'
apply plugin: 'project-report'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'project-report'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@ -22,19 +16,6 @@ android {
versionCode 1
versionName "1.0"
multiDexEnabled true
// Inject the Maps API key into the manifest
manifestPlaceholders = [ mapsApiKey : mapsApiKey ]
// Reading the Maps API key into a BuildConfig value. This is only
// necessary so that the sample app can display a toast message if the
// API key was not set, otherwise, this can be skipped.
buildConfigField("String", "MAPS_API_KEY", "\"$mapsApiKey\"" )
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -100,3 +81,11 @@ task generateV3Layout(type: Copy) {
line.replace('com.google.android.gms.maps', 'com.google.android.libraries.maps')
}
}
secrets {
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
defaultPropertiesFileName 'local.defaults.properties'
}

View File

@ -58,7 +58,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${mapsApiKey}" />
android:value="${MAPS_API_KEY}" />
</application>

View File

@ -6,7 +6,7 @@ buildscript {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:56:43 PDT 2020
#Wed Jan 27 10:05:54 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,17 +1,11 @@
import org.apache.tools.ant.filters.ConcatFilter
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@ -23,19 +17,6 @@ android {
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
// Inject the Maps API key into the manifest
manifestPlaceholders = [ mapsApiKey : mapsApiKey ]
// Reading the Maps API key into a BuildConfig value. This is only
// necessary so that the sample app can display a toast message if the
// API key was not set, otherwise, this can be skipped.
buildConfigField("String", "MAPS_API_KEY", "\"$mapsApiKey\"" )
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -110,3 +91,11 @@ task generateV3Layout(type: Copy) {
line.replace('com.google.android.gms.maps', 'com.google.android.libraries.maps')
}
}
secrets {
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
defaultPropertiesFileName 'local.defaults.properties'
}

View File

@ -49,7 +49,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${mapsApiKey}" />
android:value="${MAPS_API_KEY}" />
</application>
</manifest>

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,13 +1,7 @@
apply plugin: 'com.android.application'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 30
@ -19,15 +13,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
debug {
@ -50,3 +35,11 @@ dependencies {
implementation 'com.google.android.libraries.places:places:2.4.0'
testImplementation'junit:junit:4.12'
}
secrets {
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
defaultPropertiesFileName 'local.defaults.properties'
}

View File

@ -35,7 +35,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name="com.example.currentplacedetailsonmap.MapsActivityCurrentPlace"

View File

@ -115,7 +115,7 @@ public class MapsActivityCurrentPlace extends AppCompatActivity
// [START_EXCLUDE silent]
// Construct a PlacesClient
Places.initialize(getApplicationContext(), getString(R.string.maps_api_key));
Places.initialize(getApplicationContext(), BuildConfig.MAPS_API_KEY);
placesClient = Places.createClient(this);
// Construct a FusedLocationProviderClient.

View File

@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:05:56 PDT 2020
#Wed Jan 27 11:30:57 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,13 +1,7 @@
apply plugin: 'com.android.application'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 29
@ -19,15 +13,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -49,3 +34,11 @@ dependencies {
// [END_EXCLUDE]
}
// [END maps_android_play_services_maps_dependency]
secrets {
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
defaultPropertiesFileName 'local.defaults.properties'
}

View File

@ -34,7 +34,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name=".MapsMarkerActivity"

View File

@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:05:56 PDT 2020
#Wed Jan 27 11:31:25 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1,9 @@
## This file must *NOT* be checked into Version Control Systems,
# as it contains information specific to your local configuration.
#
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Mon Apr 06 10:50:09 PDT 2020
sdk.dir=/Users/chrisarriola/Library/Android/sdk
MAPS_API_KEY=AIzaSyBri0nHwJxuIs8KgdsGXdJLFvg1vviUMfo

View File

@ -1,13 +1,7 @@
apply plugin: 'com.android.application'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 29
@ -19,15 +13,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -45,3 +30,11 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
secrets {
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
defaultPropertiesFileName 'local.defaults.properties'
}

View File

@ -34,7 +34,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name="com.example.polygons.PolyActivity"

View File

@ -6,7 +6,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:05:56 PDT 2020
#Wed Jan 27 11:34:55 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,15 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 29
@ -21,15 +15,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
debug {
@ -55,3 +40,12 @@ dependencies {
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
secrets {
defaultPropertiesFileName 'local.defaults.properties'
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}

View File

@ -35,7 +35,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name="com.example.currentplacedetailsonmap.MapsActivityCurrentPlace"

View File

@ -90,7 +90,7 @@ class MapsActivityCurrentPlace : AppCompatActivity(), OnMapReadyCallback {
// [START_EXCLUDE silent]
// Construct a PlacesClient
Places.initialize(applicationContext, getString(R.string.maps_api_key))
Places.initialize(applicationContext, BuildConfig.MAPS_API_KEY)
placesClient = Places.createClient(this)
// Construct a FusedLocationProviderClient.

View File

@ -7,7 +7,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.2'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:05:56 PDT 2020
#Wed Jan 27 11:35:42 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,15 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 29
@ -21,14 +15,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -50,3 +36,11 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
secrets {
defaultPropertiesFileName 'local.defaults.properties'
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}

View File

@ -34,7 +34,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name=".MapsMarkerActivity"

View File

@ -0,0 +1 @@
MAPS_API_KEY=""

View File

@ -1,15 +1,9 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-android'
// Set the properties within `local.properties` into a `Properties` class so
// that values within `local.properties` (e.g. Maps API key) are accessible in
// this file.
Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
properties.load(rootProject.file("local.properties").newDataInputStream())
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'com.google.secrets_gradle_plugin' version '0.4'
}
def mapsApiKey = properties.getProperty("MAPS_API_KEY", "")
android {
compileSdkVersion 29
@ -21,14 +15,6 @@ android {
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// Read the API key from local.properties into R.string.maps_api_key
resValue "string", "maps_api_key", mapsApiKey
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}
buildTypes {
release {
@ -48,3 +34,11 @@ dependencies {
implementation "androidx.core:core-ktx:1.3.2"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
secrets {
defaultPropertiesFileName 'local.defaults.properties'
// To add your Maps API key to this project:
// 1. Open the root project's local.properties file
// 2. Add this line, where YOUR_API_KEY is your API key:
// MAPS_API_KEY=YOUR_API_KEY
}

View File

@ -34,7 +34,7 @@
-->
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/maps_api_key" />
android:value="${MAPS_API_KEY}" />
<activity
android:name="com.example.polygons.PolyActivity"

View File

@ -7,7 +7,7 @@ buildscript {
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong

View File

@ -1,6 +1,6 @@
#Mon Jul 27 14:05:56 PDT 2020
#Wed Jan 27 11:41:00 PST 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip

View File

@ -0,0 +1 @@
MAPS_API_KEY=""