From 018b1c448b7fc98a3e649d211b2b07944f594d9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Wed, 12 Jun 2024 15:24:02 +0200 Subject: [PATCH 1/6] chore: migrated to KTS and Version Catalogue --- build.gradle | 35 ----------------- build.gradle.kts | 48 ++++++++++++++++++++++++ gradle.properties | 3 ++ gradle/libs.versions.toml | 21 +++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- sample-app/build.gradle.kts | 12 +++--- sample-app/src/main/AndroidManifest.xml | 3 +- secrets-gradle-plugin/build.gradle.kts | 10 ++--- 8 files changed, 85 insertions(+), 49 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts create mode 100644 gradle/libs.versions.toml diff --git a/build.gradle b/build.gradle deleted file mode 100644 index fdd660b..0000000 --- a/build.gradle +++ /dev/null @@ -1,35 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - ext.kotlin_version = "1.6.21" - repositories { - mavenLocal() - google() - mavenCentral() - maven { - url = uri("https://maven.pkg.github.com/google/secrets-gradle-plugin") - credentials { - username = project.findProperty("ghGprUser") ?: System.getenv("ghGprUser") - password = project.findProperty("ghGprToken") ?: System.getenv("ghGprToken") - } - } - } - dependencies { - classpath "com.android.tools.build:gradle:7.2.1" - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1" - - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files - } -} - -allprojects { - repositories { - google() - mavenCentral() - } -} - -task clean(type: Delete) { - delete rootProject.buildDir -} diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..6b8faae --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,48 @@ +// Copyright 2024 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. +buildscript { + + repositories { + mavenLocal() + google() + mavenCentral() + maven { + url = uri("https://maven.pkg.github.com/google/secrets-gradle-plugin") + credentials { + username = project.findProperty("ghGprUser") as String? ?: System.getenv("ghGprUser") + password = project.findProperty("ghGprToken") as String? ?: System.getenv("ghGprToken") + } + } + } + + dependencies { + classpath(libs.gradle.v842) + classpath(libs.kotlin.gradle.plugin) + classpath(libs.secrets.gradle.plugin) + + // NOTE: Do not place your application dependencies here; they belong + // in the individual module build.gradle.kts files + } +} + +allprojects { + repositories { + google() + mavenCentral() + } +} + +tasks.register("clean") { + delete(rootProject.buildDir) +} diff --git a/gradle.properties b/gradle.properties index 69c420d..a51e19e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -25,3 +25,6 @@ gradle.publish.secret= ghGprUser= ghGprToken= +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..f411814 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,21 @@ +[versions] +gradle = "7.0.4" +gradleVersion = "8.4.2" +junit = "4.13.2" +kotlin = "1.9.24" +kotlinGradlePlugin = "2.0.0" +material = "1.12.0" +appcompat = "1.7.0" +mockitoKotlin = "2.2.0" +secretsGradlePlugin = "2.0.1" + +[libraries] +gradle = { module = "com.android.tools.build:gradle", version.ref = "gradle" } +gradle-v842 = { module = "com.android.tools.build:gradle", version.ref = "gradleVersion" } +junit = { module = "junit:junit", version.ref = "junit" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlinGradlePlugin" } +kotlin-stdlib = { group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version.ref = "kotlin" } +material = { group = "com.google.android.material", name = "material", version.ref = "material" } +appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "appcompat" } +mockito-kotlin = { module = "com.nhaarman.mockitokotlin2:mockito-kotlin", version.ref = "mockitoKotlin" } +secrets-gradle-plugin = { module = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin", version.ref = "secretsGradlePlugin" } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b5e9cdc..cf2c0ce 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Thu Nov 26 22:14:52 PST 2020 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index 30628f8..6f36e1e 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -21,13 +21,12 @@ plugins { } android { - compileSdk = 32 - buildToolsVersion = "30.0.3" + compileSdk = 34 defaultConfig { applicationId = "com.google.secrets_plugin.sample" minSdk = 21 - targetSdk = 32 + targetSdk = 34 versionCode = 1 versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -35,12 +34,13 @@ android { kotlinOptions { jvmTarget = "1.8" } + namespace = "com.google.secrets_plugin.sample" } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.21") - implementation("com.google.android.material:material:1.6.1") - implementation("androidx.appcompat:appcompat:1.4.2") + implementation(libs.kotlin.stdlib) + implementation(libs.material) + implementation(libs.appcompat) } // 2. Optionally configure the plugin diff --git a/sample-app/src/main/AndroidManifest.xml b/sample-app/src/main/AndroidManifest.xml index 7009999..a770b94 100644 --- a/sample-app/src/main/AndroidManifest.xml +++ b/sample-app/src/main/AndroidManifest.xml @@ -15,8 +15,7 @@ limitations under the License. --> - + Date: Wed, 12 Jun 2024 15:25:07 +0200 Subject: [PATCH 2/6] chore: fixed deprecation --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 6b8faae..22d955f 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -44,5 +44,5 @@ allprojects { } tasks.register("clean") { - delete(rootProject.buildDir) + delete(rootProject.layout.buildDirectory) } From c1229b7d163a87d0e5b0b11f50a145b89b522a7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Wed, 12 Jun 2024 23:33:38 +0200 Subject: [PATCH 3/6] chore: upgraded Java version --- .github/workflows/release.yml | 6 ++++++ .github/workflows/test.yml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4aedea..e0007d3 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,6 +24,12 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Set up JDK 17 + uses: actions/setup-java@v4.2.1 + with: + java-version: '17' + distribution: 'temurin' + - name: Copy secrets to gradle.properties run: | sed -i -e "s,gradle.publish.key=,gradle.publish.key=$GRADLE_PUBLISH_KEY,g" gradle.properties diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1847326..d5c2d94 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,6 +31,12 @@ jobs: - name: Checkout Repo uses: actions/checkout@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v4.2.1 + with: + java-version: '17' + distribution: 'temurin' + - name: Run tests run: | echo "Running unit tests" From fb32ee1d7c56a7db5f5312028ba192ae169461ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Wed, 12 Jun 2024 23:56:05 +0200 Subject: [PATCH 4/6] chore: upgraded Java version --- .github/workflows/release.yml | 2 +- sample-app/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e0007d3..5bb0c11 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,7 +29,7 @@ jobs: with: java-version: '17' distribution: 'temurin' - + - name: Copy secrets to gradle.properties run: | sed -i -e "s,gradle.publish.key=,gradle.publish.key=$GRADLE_PUBLISH_KEY,g" gradle.properties diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index 6f36e1e..fc9f7fa 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -32,7 +32,7 @@ android { testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "17" } namespace = "com.google.secrets_plugin.sample" } From 6f04ebae0f3ed8f8203f678f579178486c88d0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Thu, 13 Jun 2024 00:01:48 +0200 Subject: [PATCH 5/6] chore: upgraded Java version --- sample-app/build.gradle.kts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index fc9f7fa..12a3223 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -31,6 +31,10 @@ android { versionName = "1.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } kotlinOptions { jvmTarget = "17" } From b0bd127340431c6c78a5d93b965d0b6b53cb21b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrique=20Lo=CC=81pez=20Man=CC=83as?= Date: Thu, 13 Jun 2024 00:03:48 +0200 Subject: [PATCH 6/6] chore: upgraded Java version --- secrets-gradle-plugin/build.gradle.kts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/secrets-gradle-plugin/build.gradle.kts b/secrets-gradle-plugin/build.gradle.kts index 2a3e808..1266e69 100644 --- a/secrets-gradle-plugin/build.gradle.kts +++ b/secrets-gradle-plugin/build.gradle.kts @@ -19,8 +19,8 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } dependencies {