Skip to content

Commit d37ccc1

Browse files
committed
Update
1 parent 065826b commit d37ccc1

File tree

2 files changed

+31
-48
lines changed

2 files changed

+31
-48
lines changed

README.md

-20
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,4 @@ A collection of small gradle plugin, mostly focused on deployment.
1010
**Sonar** Some defaults for easy integration of sonar on multi-module projects
1111
**Sonatype** is used for uploading to sonatype repos and ultimately publish to Maven Central
1212

13-
## Development
1413

15-
Snapshot versions of these plugins are published to Sonatype.
16-
You can use them in your project by adding the following snippet to your `build.gradle.kts`
17-
18-
```
19-
buildscript {
20-
repositories {
21-
maven {
22-
url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots")
23-
}
24-
}
25-
dependencies {
26-
classpath("com.bakdata.gradle:sonar:0.0.1-SNAPSHOT")
27-
classpath("com.bakdata.gradle:sonatype:0.0.1-SNAPSHOT")
28-
}
29-
}
30-
31-
apply(plugin = "com.bakdata.sonar")
32-
apply(plugin = "com.bakdata.sonatype")
33-
```

build.gradle.kts

+31-28
Original file line numberDiff line numberDiff line change
@@ -52,34 +52,6 @@ subprojects {
5252
targetCompatibility = JavaVersion.VERSION_11
5353
}
5454

55-
apply(plugin = "java-gradle-plugin")
56-
57-
// config for gradle plugin portal doesn't support snapshot, so we add config only if release version
58-
if (!version.toString().endsWith("-SNAPSHOT")) {
59-
apply(plugin = "com.gradle.plugin-publish")
60-
}
61-
62-
// description is only ready after evaluation
63-
afterEvaluate {
64-
configure<GradlePluginDevelopmentExtension> {
65-
plugins {
66-
create("${project.name.capitalize()}Plugin") {
67-
id = "com.bakdata.${project.name}"
68-
implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin"
69-
description = project.description
70-
displayName = "Bakdata $name plugin"
71-
}
72-
}
73-
}
74-
75-
extensions.findByType(com.gradle.publish.PluginBundleExtension::class)?.apply {
76-
// actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet...
77-
website = "https://github.com/bakdata/gradle-plugins"
78-
vcsUrl = "https://github.com/bakdata/gradle-plugins"
79-
tags = listOf("bakdata", name)
80-
}
81-
}
82-
8355
dependencies {
8456
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.3.0")
8557
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.3.0")
@@ -88,6 +60,37 @@ subprojects {
8860
}
8961
}
9062

63+
// config for gradle plugin portal
64+
// doesn't support snapshot, so we add config only if release version
65+
if (!version.toString().endsWith("-SNAPSHOT")) {
66+
subprojects.forEach { project ->
67+
with(project) {
68+
// com.gradle.plugin-publish depends on java-gradle-plugin, but it screws a bit this project
69+
apply(plugin = "java-gradle-plugin")
70+
apply(plugin = "com.gradle.plugin-publish")
71+
project.afterEvaluate {
72+
// java-gradle-plugin requires this block, but we already added the definitions in META-INF for unit testing...
73+
configure<GradlePluginDevelopmentExtension> {
74+
plugins {
75+
create("${project.name.capitalize()}Plugin") {
76+
id = "com.bakdata.${project.name}"
77+
implementationClass = "com.bakdata.gradle.${project.name.capitalize()}Plugin"
78+
description = project.description
79+
displayName = "Bakdata $name plugin"
80+
}
81+
}
82+
}
83+
// actual block of plugin portal config, need to be done on each subproject as the plugin does not support multi-module projects yet...
84+
configure<com.gradle.publish.PluginBundleExtension> {
85+
website = "https://github.com/bakdata/gradle-plugins"
86+
vcsUrl = "https://github.com/bakdata/gradle-plugins"
87+
tags = listOf("bakdata", name)
88+
}
89+
}
90+
}
91+
}
92+
}
93+
9194
release {
9295
git {
9396
requireBranch.set("master")

0 commit comments

Comments
 (0)