11plugins {
2- id ' jacoco'
3- id ' groovy'
4- id ' java-library'
5- id ' maven-publish'
6- id ' signing'
7- alias(libs. plugins. kotlin)
8- alias(libs. plugins. sonar)
9- alias(libs. plugins. nexus)
2+ `java- library`
3+ groovy
4+ kotlin
5+ jacoco
106 alias(libs.plugins.versions)
7+ alias(libs.plugins.sonar)
8+ alias(libs.plugins.updates)
9+ id(" openapiprocessor.test" )
10+ id(" openapiprocessor.testInt" )
11+ id(" openapiprocessor.publish" )
12+ id(" jacoco-report-aggregation" )
1113}
1214
13- group projectGroupId
14- version projectVersion
15-
16- repositories {
17- mavenLocal ()
18- mavenCentral ()
19- maven {
20- url = " https://central.sonatype.com/repository/maven-snapshots"
21- }
22- }
23-
24- testing {
25- suites {
26- test {
27- useJUnitJupiter(libs. versions. junit. get())
28- }
29-
30- testInt(JvmTestSuite ) {
31- useJUnitJupiter(libs. versions. junit. get())
32-
33- dependencies {
34- implementation(project())
35- }
36-
37- sources {
38- java {
39- srcDirs = [' src/testInt/kotlin' ]
40- }
41- }
42-
43- targets {
44- all {
45- testTask. configure {
46- shouldRunAfter(test)
47- }
48- }
49- }
50- }
51- }
52- }
53-
54- tasks. named(' check' ) {
55- dependsOn(testing. suites. testInt)
56- }
15+ group = " io.openapiprocessor"
16+ version = libs.versions.processor.get()
17+ println (" version: $version " )
5718
58- sourceSets {
59- main {
60- java {
61- srcDirs " ${ buildDir} /version"
62- }
63- }
19+ versions {
20+ packageName = " io.openapiprocessor.micronaut"
21+ entries.putAll(mapOf (
22+ " version" to libs.versions.processor.get()
23+ ))
6424}
6525
6626java {
@@ -69,28 +29,18 @@ java {
6929}
7030
7131kotlin {
72- jvmToolchain(libs. versions. build. jdk. get() as Integer )
73- }
32+ jvmToolchain(libs.versions.build.jdk.get().toInt())
7433
75- compileKotlin. dependsOn " generateVersion"
76-
77- compileTestGroovy {
78- dependsOn ' compileKotlin'
79- classpath + = files(compileKotlin. destinationDirectory)
80- }
81-
82- kotlin {
83- jvmToolchain {
84- jvmToolchain(libs. versions. build. jdk. get() as Integer )
34+ compilerOptions {
35+ freeCompilerArgs.add(" -Xannotation-default-target=param-property" )
8536 }
8637}
8738
88- tasks. named(' compileKotlin' ) {
89- dependsOn ' generateVersion'
90- }
9139
92- tasks. named(' sourcesJar' ) {
93- dependsOn ' generateVersion'
40+ tasks.compileTestGroovy {
41+ classpath + = sourceSets.main.get().compileClasspath
42+ classpath + = files(tasks.compileKotlin.get().destinationDirectory)
43+ classpath + = files(tasks.compileTestKotlin.get().destinationDirectory)
9444}
9545
9646dependencies {
@@ -109,7 +59,7 @@ dependencies {
10959 testImplementation (libs.openapi.processor.parser.api)
11060 testImplementation (libs.openapi.processor.parser.swagger)
11161 testImplementation (libs.openapi.processor.parser.openapi4j)
112- testImplementation platform(libs. groovy. bom)
62+ testImplementation ( platform(libs.groovy.bom) )
11363 testImplementation (" org.apache.groovy:groovy" )
11464 testImplementation (" org.apache.groovy:groovy-nio" )
11565 testImplementation (libs.spock)
@@ -127,7 +77,7 @@ dependencies {
12777 testIntImplementation (libs.openapi.processor.parser.api)
12878 testIntImplementation (libs.openapi.processor.parser.swagger)
12979 testIntImplementation (libs.openapi.processor.parser.openapi4j)
130- testIntImplementation platform(libs. groovy. bom)
80+ testIntImplementation ( platform(libs.groovy.bom) )
13181 testIntImplementation (" org.apache.groovy:groovy" )
13282 testIntImplementation (" org.apache.groovy:groovy-nio" )
13383 testIntImplementation (libs.spock)
@@ -141,55 +91,54 @@ dependencies {
14191 testIntImplementation (libs.micronaut.data)
14292}
14393
144- tasks. named(" dependencyUpdates" ). configure {
145- rejectVersionIf {
146- String v = it. candidate. version
147- println " candidate: $v "
148- return v. endsWith (" -M1" ) || v. contains (" alpha" ) || v. contains (" beta" )
149- }
150- }
94+ // tasks.named("dependencyUpdates").configure {
95+ // rejectVersionIf {
96+ // String v = it.candidate.version
97+ // println "candidate: $v"
98+ // return v.endsWith ("-M1") || v.contains ("alpha") || v.contains ("beta")
99+ // }
100+ // }
151101
152- tasks. withType( Test ). configureEach {
153- jvmArgs(
102+ tasks.withType< Test >( ).configureEach {
103+ jvmArgs(listOf (
154104 " --add-exports" , " jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED" ,
155105 " --add-exports" , " jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED" ,
156106 " --add-exports" , " jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED" ,
157107 " --add-exports" , " jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED" ,
158108 " --add-exports" , " jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED" ,
159109 " --add-exports" , " jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
160- )
110+ ))
161111
162112 javaLauncher.set(javaToolchains.launcherFor {
163113 languageVersion.set(JavaLanguageVersion .of(libs.versions.test.jdk.get()))
164114 })
165115
166- finalizedBy jacocoTestReport
116+ finalizedBy(tasks.named( " jacocoTestReport" ))
167117}
168118
169-
170119jacoco {
171120 toolVersion = libs.versions.jacoco.get()
172121}
173122
174- jacocoTestReport {
123+ tasks.jacocoTestReport {
124+ executionData.from(tasks.named<Test >(" test" ).map<File > {
125+ it.extensions.getByType(JacocoTaskExtension ::class .java).destinationFile as File
126+ })
127+ executionData.from(tasks.named<Test >(" testInt" ).map<File > {
128+ it.extensions.getByType(JacocoTaskExtension ::class .java).destinationFile as File
129+ })
130+
175131 reports {
176132 xml.required = true
177- html. required = false
178- csv. required = false
133+ html.required = true
179134 }
180-
181- getExecutionData(). setFrom(fileTree(buildDir). include(" /jacoco/*.exec" ))
182135}
183136
184137sonarqube {
185138 properties {
186- property " sonar.projectKey" , " openapi-processor_openapi-processor-micronaut"
187- property " sonar.organization" , " openapi-processor"
188- property " sonar.host.url" , " https://sonarcloud.io"
189- property " sonar.coverage.jacoco.xmlReportPaths" , " $b uildDir / reports/jacoco/test/jacocoTestReport.xml"
139+ property( " sonar.projectKey" , " openapi-processor_openapi-processor-micronaut" )
140+ property( " sonar.organization" , " openapi-processor" )
141+ property( " sonar.host.url" , " https://sonarcloud.io" )
142+ property( " sonar.coverage.jacoco.xmlReportPaths" , layout.buildDirectory.dir( " reports/jacoco/test/jacocoTestReport.xml" ).get().toString())
190143 }
191144}
192-
193- apply plugin : VersionPlugin
194- apply from : " ${ rootProject.rootDir} /gradle/publishing.gradle"
195- apply from : " ${ rootProject.rootDir} /gradle/publishing.tasks.gradle.kts"
0 commit comments