Skip to content

Commit 97d79a9

Browse files
committed
Migrate build to shared convention plugins setup
1 parent 4f455ac commit 97d79a9

File tree

14 files changed

+78
-225
lines changed

14 files changed

+78
-225
lines changed

.github/workflows/ci-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
distribution: 'temurin'
1717
java-version: 17
1818
- uses: gradle/actions/setup-gradle@v5
19-
- run: "./gradlew :test"
19+
- run: "./gradlew :qualityGate :test"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
build
66
.kotlin/
77

8+
# Ignore IntelliJ IDEA config directory
9+
.idea/
10+
811
# Used by takari-plugin-testing library used in MavenEndToEndFuncTest
912
# unfortunately this path is hard coded here https://github.com/takari/takari-plugin-testing-project/blob/04312cdd308b284ed8dfa9655174abc2efcbfe20/takari-plugin-testing/src/main/java/io/takari/maven/testing/executor/junit/MavenVersionResolver.java#L97
1013
# and can therefore not be changed to be inside the build directory.

build.gradle.kts

Lines changed: 25 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,7 @@
1-
plugins {
2-
id("groovy")
3-
id("java-gradle-plugin")
4-
id("java-test-fixtures")
5-
id("jvm-test-suite")
6-
id("org.asciidoctor.jvm.convert") version "4.0.5"
7-
id("org.gradlex.internal.plugin-publish-conventions") version "0.6"
8-
}
1+
plugins { id("java-test-fixtures") }
92

10-
group = "org.gradlex"
113
version = "1.0.3"
124

13-
java {
14-
toolchain.languageVersion = JavaLanguageVersion.of(17)
15-
}
16-
17-
tasks.compileJava {
18-
options.release = 8
19-
options.compilerArgs.add("-Werror")
20-
}
21-
22-
tasks.javadoc {
23-
// Enable all JavaDoc checks, but the one requiring JavaDoc everywhere
24-
(options as StandardJavadocDocletOptions).addStringOption("Xdoclint:all,-missing", "-Xwerror")
25-
}
26-
275
dependencies {
286
api(platform(libs.mavenPluginTools.bom)) {
297
because("the version for other dependencies in api would be missing otherwise")
@@ -33,33 +11,26 @@ dependencies {
3311
implementation(libs.mavenPluginTools.java)
3412
implementation(libs.mavenPluginTools.generators)
3513

36-
api(libs.mavenPlugin.annotations) {
37-
because("MavenMojo references types from this artifact")
38-
}
14+
api(libs.mavenPlugin.annotations) { because("MavenMojo references types from this artifact") }
3915
implementation(libs.mavenPlugin.api)
4016

41-
implementation(libs.sisu.injectPlexus) {
42-
because("it is needed to implement the plexus logging adapter")
43-
}
44-
implementation(libs.plexus.velocity) {
45-
because("it is needed to generate the help mojo")
46-
}
17+
implementation(libs.sisu.injectPlexus) { because("it is needed to implement the plexus logging adapter") }
18+
implementation(libs.plexus.velocity) { because("it is needed to generate the help mojo") }
4719
constraints {
48-
implementation(libs.qdox) {
49-
because("we need the fix for https://github.com/paul-hammant/qdox/issues/43")
50-
}
20+
implementation(libs.qdox) { because("we need the fix for https://github.com/paul-hammant/qdox/issues/43") }
5121
}
5222

5323
testFixturesImplementation(libs.junit4)
5424
testFixturesImplementation(libs.commonsLang)
5525
}
5626

57-
pluginPublishConventions {
58-
id("${project.group}.${project.name}")
59-
implementationClass("org.gradlex.maven.plugin.development.MavenPluginDevelopmentPlugin")
60-
displayName("Maven Plugin Development Gradle Plugin")
61-
description("Gradle plugin for developing Apache Maven plugins.")
62-
tags("gradlex", "maven", "mojo", "maven plugin")
27+
publishingConventions {
28+
pluginPortal("${project.group}.${project.name}") {
29+
implementationClass("org.gradlex.maven.plugin.development.MavenPluginDevelopmentPlugin")
30+
displayName("Maven Plugin Development Gradle Plugin")
31+
description("Gradle plugin for developing Apache Maven plugins.")
32+
tags("gradlex", "maven", "mojo", "maven plugin")
33+
}
6334
gitHub("https://github.com/gradlex-org/maven-plugin-development")
6435
website("https://gradlex.org/maven-plugin-development")
6536
developer {
@@ -69,71 +40,18 @@ pluginPublishConventions {
6940
}
7041
}
7142

72-
// Required to write localRepository property to src/test/resources/test.properties for takari-plugin-testing used in MavenEndToEndFuncTest
73-
tasks.processTestResources {
74-
expand("localRepository" to project.layout.buildDirectory.dir("mavenLocal").get().asFile)
75-
}
43+
// Required to write localRepository property to src/test/resources/test.properties for takari-plugin-testing used in
44+
// MavenEndToEndFuncTest
45+
tasks.processTestResources { expand("localRepository" to project.layout.buildDirectory.dir("mavenLocal").get().asFile) }
7646

77-
testing.suites.named<JvmTestSuite>("test") {
78-
useSpock()
79-
dependencies {
80-
implementation(libs.spock.core)
81-
implementation(libs.spock.junit4)
82-
implementation(libs.takariPluginTesting)
83-
implementation(project.dependencies.testFixtures(project))
84-
runtimeOnly(libs.junitVintageEngine)
85-
}
86-
targets.all {
87-
testTask.configure {
88-
maxParallelForks = 4
89-
}
90-
}
91-
}
92-
93-
testing.suites.register<JvmTestSuite>("testSamples") {
94-
useJUnit()
95-
dependencies {
96-
implementation(gradleTestKit())
97-
implementation(libs.exemplar.sampleCheck)
98-
}
99-
targets.all {
100-
testTask.configure {
101-
inputs.dir("src/docs/snippets")
102-
.withPathSensitivity(PathSensitivity.RELATIVE)
103-
.withPropertyName("snippets")
104-
}
105-
}
106-
}
47+
// === the following custom configuration should be removed once tests are migrated to Java
48+
apply(plugin = "groovy")
10749

108-
tasks {
109-
test {
110-
useJUnitPlatform()
111-
}
112-
jar {
113-
from(rootProject.file("LICENSE.txt")) {
114-
into("META-INF")
115-
}
116-
}
117-
asciidoctor {
118-
notCompatibleWithConfigurationCache("See https://github.com/asciidoctor/asciidoctor-gradle-plugin/issues/564")
119-
inputs.dir("src/docs/snippets")
120-
.withPathSensitivity(PathSensitivity.RELATIVE)
121-
.withPropertyName("snippets")
122-
outputOptions {
123-
separateOutputDirs = false
124-
}
125-
126-
attributes(mapOf(
127-
"docinfodir" to "src/docs/asciidoc",
128-
"docinfo" to "shared",
129-
"source-highlighter" to "prettify",
130-
"tabsize" to "4",
131-
"toc" to "left",
132-
"icons" to "font",
133-
"sectanchors" to true,
134-
"idprefix" to "",
135-
"idseparator" to "-",
136-
"snippets-path" to "$projectDir/src/docs/snippets"
137-
))
138-
}
139-
}
50+
dependencies {
51+
testImplementation(libs.spock.core)
52+
testImplementation(libs.spock.junit4)
53+
testImplementation(libs.takariPluginTesting)
54+
testImplementation(project.dependencies.testFixtures(project))
55+
testRuntimeOnly(libs.junitVintageEngine)
56+
} //
57+
// ====================================================================================

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
org.gradle.caching=true
22
org.gradle.configuration-cache=true
3-
org.gradle.parallel=true

gradle/checkstyle/checkstyle.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

gradle/checkstyle/header.txt

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
toolchainVersion=17

gradle/libs.versions.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,3 @@ junit4 = { module = "junit:junit", version = "4.13.2" }
1818
junitVintageEngine = { module = "org.junit.vintage:junit-vintage-engine", version = "6.0.0" }
1919
takariPluginTesting = { module = "io.takari.maven.plugins:takari-plugin-integration-testing", version = "3.1.1" }
2020
commonsLang = { module = "org.apache.commons:commons-lang3", version = "3.19.0" }
21-
exemplar-sampleCheck = { module = "org.gradle.exemplar:samples-check", version = "1.0.3" }

settings.gradle.kts

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,5 @@
1-
/*
2-
* Copyright the GradleX team.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
16-
plugins {
17-
id("com.gradle.develocity") version "4.2.2"
18-
id("com.gradle.common-custom-user-data-gradle-plugin") version "2.4.0"
19-
}
20-
21-
dependencyResolutionManagement {
22-
repositories {
23-
mavenCentral()
24-
}
25-
}
1+
plugins { id("org.gradlex.internal-build-conventions") version "0.8" }
262

273
rootProject.name = "maven-plugin-development"
284

295
includeBuild("sample/gradle-producer-build")
30-
31-
develocity {
32-
buildScan {
33-
termsOfUseUrl = "https://gradle.com/terms-of-service"
34-
termsOfUseAgree = "yes"
35-
publishing.onlyIf { !System.getenv("CI").isNullOrEmpty() }
36-
}
37-
}
Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,2 @@
1-
commands: [{
2-
execution-subdirectory: groovy
3-
executable: gradle
4-
args: tasks
5-
},{
6-
execution-subdirectory: kotlin
7-
executable: gradle
8-
args: tasks
9-
}]
1+
executable: gradlew
2+
args: tasks

0 commit comments

Comments
 (0)