11@file:Suppress(" UnstableApiUsage" )
22
3- import org.gradle.plugins.ide.idea.model.IdeaModule
43import kotlin.reflect.full.memberFunctions
4+ import org.gradle.plugins.ide.idea.model.IdeaModule
55
66group = " org.jboss.gm"
77
8- // According to https://plugins.gradle.org/docs/publish-plugin the simplifications in plugin publishing requires
8+ // According to https://plugins.gradle.org/docs/publish-plugin the simplifications in plugin
9+ // publishing requires
910// Gradle 7.6 or later. Therefore use reflection here.
1011gradlePlugin {
1112 if (GradleVersion .current() >= GradleVersion .version(" 7.6" )) {
12- var pluginPublishMethod = GradlePluginDevelopmentExtension ::class .memberFunctions.find{it.name == " getWebsite" }
13+ var pluginPublishMethod =
14+ GradlePluginDevelopmentExtension ::class .memberFunctions.find { it.name == " getWebsite" }
1315 @Suppress(" UNCHECKED_CAST" )
1416 var wProperty: Property <String > = pluginPublishMethod?.call(this ) as Property <String >
1517 wProperty.set(" https://project-ncl.github.io/gradle-manipulator" )
16- pluginPublishMethod = GradlePluginDevelopmentExtension ::class .memberFunctions.find{ it.name == " getVcsUrl" }
18+ pluginPublishMethod = GradlePluginDevelopmentExtension ::class .memberFunctions.find { it.name == " getVcsUrl" }
1719 @Suppress(" UNCHECKED_CAST" )
1820 wProperty = pluginPublishMethod?.call(this ) as Property <String >
1921 wProperty.set(" https://github.com/project-ncl/gradle-manipulator.git" )
@@ -28,8 +30,7 @@ gradlePlugin {
2830
2931 if (GradleVersion .current() >= GradleVersion .version(" 7.6" )) {
3032 var getTagsMethod = PluginDeclaration ::class .memberFunctions.find { it.name == " getTags" }
31- @Suppress(" UNCHECKED_CAST" )
32- var sProperty = getTagsMethod?.call(this ) as SetProperty <String >
33+ @Suppress(" UNCHECKED_CAST" ) var sProperty = getTagsMethod?.call(this ) as SetProperty <String >
3334 sProperty.set(listOf (" versions" , " alignment" ))
3435 }
3536 }
@@ -38,7 +39,8 @@ gradlePlugin {
3839
3940dependencies {
4041 implementation(project(" :common" ))
41- // The shadow configuration is used in order to avoid adding gradle and groovy stuff to the shadowed jar
42+ // The shadow configuration is used in order to avoid adding gradle and groovy stuff to the
43+ // shadowed jar
4244 shadow(localGroovy())
4345 shadow(gradleApi())
4446
@@ -50,20 +52,19 @@ dependencies {
5052 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-core" )
5153 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-annotations" )
5254 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-databind" )
53- }
55+ }
5456
5557 implementation(" org.commonjava.maven.ext:pom-manipulation-io:${project.extra.get(" pmeVersion" )} " ) {
5658 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-core" )
5759 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-annotations" )
5860 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-databind" )
59- }
61+ }
6062
6163 implementation(" org.commonjava.maven.ext:pom-manipulation-common:${project.extra.get(" pmeVersion" )} " ) {
6264 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-core" )
6365 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-annotations" )
6466 exclude(group = " com.fasterxml.jackson.core" , module = " jackson-databind" )
65- }
66-
67+ }
6768
6869 implementation(" org.commonjava.maven.atlas:atlas-identities:${project.extra.get(" atlasVersion" )} " )
6970
@@ -88,46 +89,42 @@ dependencies {
8889 testImplementation(" uk.org.webcompere:system-stubs-junit4:${project.extra.get(" systemStubsVersion" )} " )
8990 testImplementation(" org.assertj:assertj-core:${project.extra.get(" assertjVersion" )} " )
9091 testImplementation(" org.jboss.byteman:byteman-bmunit:${project.extra.get(" bytemanVersion" )} " )
91- testImplementation(files (" ${System .getProperty(" java.home" )} /../lib/tools.jar" ) )
92+ testImplementation(files(" ${System .getProperty(" java.home" )} /../lib/tools.jar" ))
9293 testImplementation(" org.mockito:mockito-core:2.27.0" )
9394 testImplementation(" com.github.tomakehurst:wiremock-jre8:2.26.3" )
9495 testImplementation(gradleKotlinDsl())
9596 testImplementation(" org.eclipse.jgit:org.eclipse.jgit:${project.extra.get(" jgitVersion" )} " )
9697 testImplementation(" pl.pragmatists:JUnitParams:1.1.1" )
9798}
9899
99- tasks.withType<Test >().configureEach {
100- systemProperties[" jdk.attach.allowAttachSelf" ] = " true"
101- }
100+ tasks.withType<Test >().configureEach { systemProperties[" jdk.attach.allowAttachSelf" ] = " true" }
102101
103102// Separate source set and task for functional tests
104- val functionalTestSourceSet = sourceSets.create(" functionalTest" ) {
105- java.srcDir(" src/functTest/java" )
106- resources.srcDir(" src/functTest/resources" )
107- compileClasspath + = sourceSets[" main" ].output
108- runtimeClasspath + = output + compileClasspath
109- }
103+ val functionalTestSourceSet =
104+ sourceSets.create(" functionalTest" ) {
105+ java.srcDir(" src/functTest/java" )
106+ resources.srcDir(" src/functTest/resources" )
107+ compileClasspath + = sourceSets[" main" ].output
108+ runtimeClasspath + = output + compileClasspath
109+ }
110110
111- configurations.getByName(" functionalTestImplementation" ) {
112- extendsFrom(configurations[" testImplementation" ])
113- }
111+ configurations.getByName(" functionalTestImplementation" ) { extendsFrom(configurations[" testImplementation" ]) }
114112
115- configurations.getByName(" functionalTestRuntimeOnly" ) {
116- extendsFrom(configurations[" testRuntimeOnly" ])
117- }
113+ configurations.getByName(" functionalTestRuntimeOnly" ) { extendsFrom(configurations[" testRuntimeOnly" ]) }
118114
119- // Previously had to force the addition of the plugin-under-test-metadata.properties but this seems to solve it.
115+ // Previously had to force the addition of the plugin-under-test-metadata.properties but this seems
116+ // to solve it.
120117gradlePlugin.testSourceSets(functionalTestSourceSet)
121118
122119idea.module {
123120 // testSources / testResources only available from 7.4 and greater so can't just do:
124121 // testSources.from(sourceSets["functionalTest"].java.srcDirs)
125122 // Not bothering to handle other versions as we're developing on later Gradle now.
126123 if (GradleVersion .current() >= GradleVersion .version(" 7.4" )) {
127- var rTestSources = IdeaModule ::class .memberFunctions.find{ it.name == " getTestSources" }
124+ var rTestSources = IdeaModule ::class .memberFunctions.find { it.name == " getTestSources" }
128125 var fileCollection = rTestSources?.call(this ) as ConfigurableFileCollection
129126 fileCollection.from(sourceSets[" functionalTest" ].java.srcDirs)
130- var rTestResources = IdeaModule ::class .memberFunctions.find{ it.name == " getTestResources" }
127+ var rTestResources = IdeaModule ::class .memberFunctions.find { it.name == " getTestResources" }
131128 fileCollection = rTestResources?.call(this ) as ConfigurableFileCollection
132129 fileCollection.from(sourceSets[" functionalTest" ].resources.srcDirs)
133130 }
@@ -139,45 +136,45 @@ tasks.register<Test>("functionalTest") {
139136 testClassesDirs = sourceSets[" functionalTest" ].output.classesDirs
140137 classpath = sourceSets[" functionalTest" ].runtimeClasspath
141138 mustRunAfter(tasks[" test" ])
142- // This will be used in the Wiremock tests - the port needs to match what Wiremock is set up to use
139+ // This will be used in the Wiremock tests - the port needs to match what Wiremock is set up to
140+ // use
143141 environment(" DA_ENDPOINT_URL" , " http://localhost:8089/da/rest/v-1" )
144142 systemProperties[" jdk.attach.allowAttachSelf" ] = " true"
145143}
146144
147- val testJar by tasks.registering(Jar ::class ) {
148- mustRunAfter(tasks[" functionalTest" ])
149- archiveClassifier.set(" tests" )
150- from(sourceSets[" functionalTest" ].output)
151- from(sourceSets[" test" ].output)
152- }
145+ val testJar by
146+ tasks.registering(Jar ::class ) {
147+ mustRunAfter(tasks[" functionalTest" ])
148+ archiveClassifier.set(" tests" )
149+ from(sourceSets[" functionalTest" ].output)
150+ from(sourceSets[" test" ].output)
151+ }
153152
154153// Publish test source jar so it can be reused by manipulator-groovy-examples.
155- val testSourcesJar by tasks.registering(Jar ::class ) {
156- archiveClassifier.set(" test-sources" )
157- from(sourceSets[" test" ].allSource)
158- from(sourceSets[" functionalTest" ].java.srcDirs)
159- }
154+ val testSourcesJar by
155+ tasks.registering(Jar ::class ) {
156+ archiveClassifier.set(" test-sources" )
157+ from(sourceSets[" test" ].allSource)
158+ from(sourceSets[" functionalTest" ].java.srcDirs)
159+ }
160160
161161tasks {
162162 // This is done in order to use the proper version in the init gradle files
163163 " processResources" (ProcessResources ::class ) {
164- filesMatching(" gme.gradle" ) {
165- expand(project.properties)
166- }
167- filesMatching(" analyzer-init.gradle" ) {
168- expand(project.properties)
169- }
164+ filesMatching(" gme.gradle" ) { expand(project.properties) }
165+ filesMatching(" analyzer-init.gradle" ) { expand(project.properties) }
170166 }
171167}
172168
173169// We publish the init gradle file to make it easy for tools that use the plugin to set it up
174170// without having to create their own init gradle file.
175171val analyzerFile = layout.buildDirectory.file(" resources/main/analyzer-init.gradle" )
176- val prepareAnalyzerInit = artifacts.add(" default" , analyzerFile.get().asFile) {
177- classifier = " init"
178- extension = " gradle"
179- builtBy(" processResources" )
180- }
172+ val prepareAnalyzerInit =
173+ artifacts.add(" default" , analyzerFile.get().asFile) {
174+ classifier = " init"
175+ extension = " gradle"
176+ builtBy(" processResources" )
177+ }
181178
182179// Using afterEvaluate : https://github.com/GradleUp/shadow/issues/1748
183180afterEvaluate {
0 commit comments