Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp94831 committed Feb 28, 2024
1 parent 065826b commit d37ccc1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 48 deletions.
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,4 @@ A collection of small gradle plugin, mostly focused on deployment.
**Sonar** Some defaults for easy integration of sonar on multi-module projects
**Sonatype** is used for uploading to sonatype repos and ultimately publish to Maven Central

## Development

Snapshot versions of these plugins are published to Sonatype.
You can use them in your project by adding the following snippet to your `build.gradle.kts`

```
buildscript {
repositories {
maven {
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
}
}
dependencies {
classpath("com.bakdata.gradle:sonar:0.0.1-SNAPSHOT")
classpath("com.bakdata.gradle:sonatype:0.0.1-SNAPSHOT")
}
}
apply(plugin = "com.bakdata.sonar")
apply(plugin = "com.bakdata.sonatype")
```
59 changes: 31 additions & 28 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,6 @@ subprojects {
targetCompatibility = JavaVersion.VERSION_11
}

apply(plugin = "java-gradle-plugin")

// config for gradle plugin portal doesn't support snapshot, so we add config only if release version
if (!version.toString().endsWith("-SNAPSHOT")) {
apply(plugin = "com.gradle.plugin-publish")
}

// description is only ready after evaluation
afterEvaluate {
configure<GradlePluginDevelopmentExtension> {
plugins {
create("${project.name.capitalize()}Plugin") {
id = "com.bakdata.${project.name}"
implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin"
description = project.description
displayName = "Bakdata $name plugin"
}
}
}

extensions.findByType(com.gradle.publish.PluginBundleExtension::class)?.apply {
// actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet...
website = "https://github.com/bakdata/gradle-plugins"
vcsUrl = "https://github.com/bakdata/gradle-plugins"
tags = listOf("bakdata", name)
}
}

dependencies {
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.3.0")
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.3.0")
Expand All @@ -88,6 +60,37 @@ subprojects {
}
}

// config for gradle plugin portal
// doesn't support snapshot, so we add config only if release version
if (!version.toString().endsWith("-SNAPSHOT")) {
subprojects.forEach { project ->
with(project) {
// com.gradle.plugin-publish depends on java-gradle-plugin, but it screws a bit this project
apply(plugin = "java-gradle-plugin")
apply(plugin = "com.gradle.plugin-publish")
project.afterEvaluate {
// java-gradle-plugin requires this block, but we already added the definitions in META-INF for unit testing...
configure<GradlePluginDevelopmentExtension> {
plugins {
create("${project.name.capitalize()}Plugin") {
id = "com.bakdata.${project.name}"
implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin"
description = project.description
displayName = "Bakdata $name plugin"
}
}
}
// actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet...
configure<com.gradle.publish.PluginBundleExtension> {
website = "https://github.com/bakdata/gradle-plugins"
vcsUrl = "https://github.com/bakdata/gradle-plugins"
tags = listOf("bakdata", name)
}
}
}
}
}

release {
git {
requireBranch.set("master")
Expand Down

0 comments on commit d37ccc1

Please sign in to comment.