diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b4aedea..5bb0c11 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" 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..22d955f --- /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.layout.buildDirectory) +} 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..12a3223 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -21,26 +21,30 @@ 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" } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } kotlinOptions { - jvmTarget = "1.8" + jvmTarget = "17" } + 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. --> - +