From e680c04fc86f7bc621ad3dec7d0b17ef4f1b16f1 Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Tue, 26 Jan 2021 10:18:19 -0800 Subject: [PATCH 1/4] Adding GitHub action test workflow. --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..7672d43 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +# Copyright 2021 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. + +# A workflow that runs tests on every new pull request +name: Tests + +on: + repository_dispatch: + types: [test] + pull_request: + branches: ['*'] + workflow_dispatch: + +jobs: + run-unit-test: + runs-on: ubuntu-latest + + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout Repo + uses: actions/checkout@v2 + + - name: Run tests + run: | + echo "Running unit tests" + ./gradlew check test -x lint --stacktrace diff --git a/README.md b/README.md index 7f0d61c..a5a9616 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ # Secrets Gradle Plugin for Android +![Tests](https://github.com/google/secrets-gradle-plugin/workflows/Tests/badge.svg) +![Apache-2.0](https://img.shields.io/badge/license-Apache-blue) A Gradle plugin for providing your secrets securely to your Android project. From a0dfd15b48655b4a3e08324233c469bc83255c04 Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Tue, 26 Jan 2021 10:25:43 -0800 Subject: [PATCH 2/4] Building plugin first. --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7672d43..adf98e0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,4 +34,4 @@ jobs: - name: Run tests run: | echo "Running unit tests" - ./gradlew check test -x lint --stacktrace + ./gradlew :plugin:build check test -x lint --stacktrace From 6f61c919d7dbaa19f8733376e36ec115bfabf380 Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Tue, 26 Jan 2021 10:42:09 -0800 Subject: [PATCH 3/4] Rename to secrets_gradle_plugin --- README.md | 4 ++-- plugin/build.gradle.kts | 10 +++++----- .../Extensions.kt | 2 +- .../SecretsPlugin.kt | 2 +- .../SecretsPluginExtension.kt | 2 +- .../SecretsPluginTest.kt | 4 ++-- sample-app/build.gradle.kts | 2 +- sample-app/src/main/AndroidManifest.xml | 2 +- .../sample/MainActivity.kt | 2 +- 9 files changed, 15 insertions(+), 15 deletions(-) rename plugin/src/main/java/com/google/{secrets_plugin => secrets_gradle_plugin}/Extensions.kt (98%) rename plugin/src/main/java/com/google/{secrets_plugin => secrets_gradle_plugin}/SecretsPlugin.kt (97%) rename plugin/src/main/java/com/google/{secrets_plugin => secrets_gradle_plugin}/SecretsPluginExtension.kt (96%) rename plugin/src/test/kotlin/com/google/{secrets_plugin => secrets_gradle_plugin}/SecretsPluginTest.kt (97%) rename sample-app/src/main/java/com/google/{secrets_plugin => secrets_gradle_plugin}/sample/MainActivity.kt (94%) diff --git a/README.md b/README.md index a5a9616..088afd5 100644 --- a/README.md +++ b/README.md @@ -18,14 +18,14 @@ In your app-level `build.gradle` file: Groovy: ```groovy plugins { - id 'com.google.secrets_plugin' version '0.1' + id 'com.google.secrets_gradle_plugin' version '0.1' } ``` Kotlin: ```groovy plugins { - id("com.google.secrets_plugin") version "0.1" + id("com.google.secrets_gradle_plugin") version "0.1" } ``` diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 014e8d2..6f92131 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -42,8 +42,8 @@ gradlePlugin { } pluginBundle { - website = "https://github.com/google/secrets-plugin" - vcsUrl = "https://github.com/google/secrets-plugin" + website = "https://github.com/google/secrets-gradle-plugin" + vcsUrl = "https://github.com/google/secrets-gradle-plugin" description = "A Gradle plugin for providing secrets securely to an Android project." version = PluginInfo.version @@ -70,8 +70,8 @@ publishing { object PluginInfo { const val group = "com.google" - const val artifactId = "secrets_plugin" - const val name = "secretsPlugin" + const val artifactId = "secrets_gradle_plugin" + const val name = "secretsGradlePlugin" const val version = "0.1" - const val implementationClass = "com.google.secrets_plugin.SecretsPlugin" + const val implementationClass = "com.google.secrets_gradle_plugin.SecretsPlugin" } \ No newline at end of file diff --git a/plugin/src/main/java/com/google/secrets_plugin/Extensions.kt b/plugin/src/main/java/com/google/secrets_gradle_plugin/Extensions.kt similarity index 98% rename from plugin/src/main/java/com/google/secrets_plugin/Extensions.kt rename to plugin/src/main/java/com/google/secrets_gradle_plugin/Extensions.kt index 1b839b8..b3a7310 100644 --- a/plugin/src/main/java/com/google/secrets_plugin/Extensions.kt +++ b/plugin/src/main/java/com/google/secrets_gradle_plugin/Extensions.kt @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.secrets_plugin +package com.google.secrets_gradle_plugin import com.android.build.gradle.AppExtension import com.android.build.gradle.api.ApplicationVariant diff --git a/plugin/src/main/java/com/google/secrets_plugin/SecretsPlugin.kt b/plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPlugin.kt similarity index 97% rename from plugin/src/main/java/com/google/secrets_plugin/SecretsPlugin.kt rename to plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPlugin.kt index 9212250..7756346 100644 --- a/plugin/src/main/java/com/google/secrets_plugin/SecretsPlugin.kt +++ b/plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPlugin.kt @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.secrets_plugin +package com.google.secrets_gradle_plugin import org.gradle.api.Plugin import org.gradle.api.Project diff --git a/plugin/src/main/java/com/google/secrets_plugin/SecretsPluginExtension.kt b/plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPluginExtension.kt similarity index 96% rename from plugin/src/main/java/com/google/secrets_plugin/SecretsPluginExtension.kt rename to plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPluginExtension.kt index 66e97b3..e3965fc 100644 --- a/plugin/src/main/java/com/google/secrets_plugin/SecretsPluginExtension.kt +++ b/plugin/src/main/java/com/google/secrets_gradle_plugin/SecretsPluginExtension.kt @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.secrets_plugin +package com.google.secrets_gradle_plugin /** * Configuration object for [SecretsPlugin]. diff --git a/plugin/src/test/kotlin/com/google/secrets_plugin/SecretsPluginTest.kt b/plugin/src/test/kotlin/com/google/secrets_gradle_plugin/SecretsPluginTest.kt similarity index 97% rename from plugin/src/test/kotlin/com/google/secrets_plugin/SecretsPluginTest.kt rename to plugin/src/test/kotlin/com/google/secrets_gradle_plugin/SecretsPluginTest.kt index 9da19b9..56834df 100644 --- a/plugin/src/test/kotlin/com/google/secrets_plugin/SecretsPluginTest.kt +++ b/plugin/src/test/kotlin/com/google/secrets_gradle_plugin/SecretsPluginTest.kt @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.secrets_plugin +package com.google.secrets_gradle_plugin import com.android.build.gradle.api.ApplicationVariant import com.android.build.gradle.internal.core.InternalBaseVariant @@ -58,7 +58,7 @@ class SecretsPluginTest { variant = mock() { on { mergedFlavor } doReturn flavor } - project.pluginManager.apply("com.google.secrets_plugin") + project.pluginManager.apply("com.google.secrets_gradle_plugin") } @Test(expected = ProjectConfigurationException::class) diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index 91a9440..f121fe4 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -17,7 +17,7 @@ plugins { id("kotlin-android") // 1. Include the plugin - id("com.google.secrets_plugin") version "0.1" + id("com.google.secrets_gradle_plugin") version "0.1" } android { diff --git a/sample-app/src/main/AndroidManifest.xml b/sample-app/src/main/AndroidManifest.xml index 51d03b7..fd57f06 100644 --- a/sample-app/src/main/AndroidManifest.xml +++ b/sample-app/src/main/AndroidManifest.xml @@ -29,7 +29,7 @@ android:name="com.google.android.geo.API_KEY" android:value="${gmpApiKey}" /> diff --git a/sample-app/src/main/java/com/google/secrets_plugin/sample/MainActivity.kt b/sample-app/src/main/java/com/google/secrets_gradle_plugin/sample/MainActivity.kt similarity index 94% rename from sample-app/src/main/java/com/google/secrets_plugin/sample/MainActivity.kt rename to sample-app/src/main/java/com/google/secrets_gradle_plugin/sample/MainActivity.kt index 9b07b2c..77e1165 100644 --- a/sample-app/src/main/java/com/google/secrets_plugin/sample/MainActivity.kt +++ b/sample-app/src/main/java/com/google/secrets_gradle_plugin/sample/MainActivity.kt @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.secrets_plugin.sample +package com.google.secrets_gradle_plugin.sample import androidx.appcompat.app.AppCompatActivity From d2834b1290ab290e26181b5aacc4349f7596597c Mon Sep 17 00:00:00 2001 From: Chris Arriola Date: Tue, 26 Jan 2021 10:54:50 -0800 Subject: [PATCH 4/4] Disable plugin in sample app for now. --- sample-app/build.gradle.kts | 20 ++++++++++---------- sample-app/src/main/AndroidManifest.xml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index f121fe4..bf494fb 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -17,7 +17,7 @@ plugins { id("kotlin-android") // 1. Include the plugin - id("com.google.secrets_gradle_plugin") version "0.1" +// id("com.google.secrets_gradle_plugin") version "0.1" } android { @@ -44,12 +44,12 @@ dependencies { } // 2. Optionally configure the plugin -secrets { - // Optionally specify a different file name containing your secrets. - // The plugin defaults to "local.properties" - propertiesFileName = "secrets.properties" - - // Add keys that the plugin should ignore from the properties file - ignoreList.add("keyToIgnore") - ignoreList.add("ignore*") -} +//secrets { +// // Optionally specify a different file name containing your secrets. +// // The plugin defaults to "local.properties" +// propertiesFileName = "secrets.properties" +// +// // Add keys that the plugin should ignore from the properties file +// ignoreList.add("keyToIgnore") +// ignoreList.add("ignore*") +//} diff --git a/sample-app/src/main/AndroidManifest.xml b/sample-app/src/main/AndroidManifest.xml index fd57f06..498749b 100644 --- a/sample-app/src/main/AndroidManifest.xml +++ b/sample-app/src/main/AndroidManifest.xml @@ -27,7 +27,7 @@ android:theme="@style/Theme.MyApplication"> + android:value="gmpApiKey" />