diff --git a/build.gradle b/build.gradle index fdd660b..eaaed91 100644 --- a/build.gradle +++ b/build.gradle @@ -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 { @@ -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 } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000..1f500c9 --- /dev/null +++ b/gradle/libs.versions.toml @@ -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"} \ No newline at end of file diff --git a/sample-app/build.gradle.kts b/sample-app/build.gradle.kts index 30628f8..a3c9455 100644 --- a/sample-app/build.gradle.kts +++ b/sample-app/build.gradle.kts @@ -1,3 +1,4 @@ +@file:Suppress("DSL_SCOPE_VIOLATION") // Copyright 2021 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -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 { @@ -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 diff --git a/settings.gradle.kts b/settings.gradle.kts index 86fc5b1..06bdd6b 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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")