Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add version catalog #69

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// 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 {
Expand All @@ -13,23 +13,24 @@ buildscript {
}
}
}
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
}
plugins {
alias libs.plugins.android.application apply(false)
alias libs.plugins.android.library apply(false)
alias libs.plugins.kotlin.android apply(false)
alias libs.plugins.sgp apply(false)
}

allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
}
}


task clean(type: Delete) {
delete rootProject.buildDir
}
22 changes: 22 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[versions]
appcompat= "1.4.2"
stdlib = "1.6.21"
material = "1.9.0"
agp = "7.2.1"
kotlin = "1.6.21"
secrets = "2.0.1"

[libraries]
androidx-appcompat = { module = "com.google.android.material:material",version.ref = "appcompat"}
material = { module = "com.google.android.material:material", version.ref = "material"}
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "stdlib"}

# Plugins
plugin-agp = { module = "com.android.tools.build:gradle", version.ref = "agp"}
plugin-kgp = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin"}

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
android-library = { id = "com.android.library", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
sgp = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "secrets"}
13 changes: 7 additions & 6 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@file:Suppress("DSL_SCOPE_VIOLATION")
// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,11 +14,11 @@
// limitations under the License.

plugins {
id("com.android.application")
id("kotlin-android")
alias(libs.plugins.android.application)
alias(libs.plugins.kotlin.android)

// 1. Include the plugin
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
alias(libs.plugins.sgp)
}

android {
Expand All @@ -38,9 +39,9 @@ android {
}

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.androidx.appcompat)
implementation(libs.kotlin.stdlib)
implementation(libs.material)
}

// 2. Optionally configure the plugin
Expand Down
10 changes: 6 additions & 4 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@
// See the License for the specific language governing permissions and
// limitations under the License.

include(":secrets-gradle-plugin")
include(":sample-app")

pluginManagement {
repositories {
mavenLocal()
maven(url = "./plugin/build/repository")
google()
mavenCentral()
gradlePluginPortal()
maven(url = "./plugin/build/repository")
}
}

include(":secrets-gradle-plugin")
include(":sample-app")