Skip to content

Commit

Permalink
chore: migrated to KTX and version catalogue (#90)
Browse files Browse the repository at this point in the history
* chore: migrated to KTS and Version Catalogue

* chore: fixed deprecation

* chore: upgraded Java version

* chore: upgraded Java version

* chore: upgraded Java version

* chore: upgraded Java version
  • Loading branch information
kikoso authored Aug 27, 2024
1 parent a988fe0 commit 5c3b339
Show file tree
Hide file tree
Showing 10 changed files with 104 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/[email protected]
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
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Set up JDK 17
uses: actions/[email protected]
with:
java-version: '17'
distribution: 'temurin'

- name: Run tests
run: |
echo "Running unit tests"
Expand Down
35 changes: 0 additions & 35 deletions build.gradle

This file was deleted.

48 changes: 48 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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<Delete>("clean") {
delete(rootProject.layout.buildDirectory)
}
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ gradle.publish.secret=

ghGprUser=
ghGprToken=
android.defaults.buildfeatures.buildconfig=true
android.nonTransitiveRClass=false
android.nonFinalResIds=false
21 changes: 21 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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" }
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
18 changes: 11 additions & 7 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions sample-app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
limitations under the License.
-->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.google.secrets_plugin.sample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand Down
14 changes: 7 additions & 7 deletions secrets-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ plugins {
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}

dependencies {
compileOnly("com.android.tools.build:gradle:7.0.0")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10")
testImplementation("com.android.tools.build:gradle:7.0.0-beta04")
testImplementation("junit:junit:4.13.1")
testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0")
compileOnly(libs.gradle)
implementation(libs.kotlin.stdlib)
testImplementation(libs.gradle)
testImplementation(libs.junit)
testImplementation(libs.mockito.kotlin)
}

gradlePlugin {
Expand Down

0 comments on commit 5c3b339

Please sign in to comment.