Skip to content

Commit

Permalink
Include build plugin project
Browse files Browse the repository at this point in the history
It would be easier to test the plugin logic in the sample App, we don't have to rely on the published version.
  • Loading branch information
Goooler committed Sep 5, 2024
1 parent 5c3b339 commit a118a40
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 46 deletions.
33 changes: 4 additions & 29 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,11 @@
// 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()
}
plugins {
alias(libs.plugins.android.application) apply false
alias(libs.plugins.kotlin.android) apply false
alias(libs.plugins.kotlin.jvm) apply false
}

tasks.register<Delete>("clean") {
Expand Down
10 changes: 6 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[versions]
gradle = "7.0.4"
gradleVersion = "8.4.2"
agp = "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" }

[plugins]
android-application = { id = "com.android.application", version.ref = "agp" }
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
6 changes: 2 additions & 4 deletions sample-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
// limitations under the License.

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

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

Expand Down
6 changes: 2 additions & 4 deletions secrets-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
plugins {
`java-gradle-plugin`
`maven-publish`
id("kotlin")
alias(libs.plugins.kotlin.jvm)
}

java {
Expand Down Expand Up @@ -91,9 +91,7 @@ publishing {
}
}

project(":secrets-gradle-plugin") {
version = PluginInfo.version
}
version = PluginInfo.version

object PluginInfo {
const val artifactId =
Expand Down
20 changes: 20 additions & 0 deletions secrets-gradle-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
dependencyResolutionManagement {
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}

rootProject.name = "secrets-gradle-plugin"
32 changes: 27 additions & 5 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,35 @@
// 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 {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
gradlePluginPortal()
}

includeBuild("secrets-gradle-plugin")
}

dependencyResolutionManagement {
repositories {
google {
mavenContent {
includeGroupAndSubgroups("androidx")
includeGroupAndSubgroups("com.android")
includeGroupAndSubgroups("com.google")
}
}
mavenCentral()
}
}

rootProject.name = "secrets-gradle-plugin-root"

include(":sample-app")

0 comments on commit a118a40

Please sign in to comment.