Skip to content

Commit 5d1ac8d

Browse files
committed
update build & dependencies
1 parent 04ebc07 commit 5d1ac8d

File tree

16 files changed

+271
-237
lines changed

16 files changed

+271
-237
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ jobs:
3333
distribution: 'temurin'
3434
java-version: |
3535
17
36-
11
3736
3837
- name: set up gradle
3938
uses: gradle/actions/setup-gradle@v4
@@ -67,14 +66,15 @@ jobs:
6766
distribution: 'temurin'
6867
java-version: |
6968
17
70-
11
7169
7270
- name: set up gradle
7371
uses: gradle/actions/setup-gradle@v4
7472

7573
- name: publish snapshot
7674
env:
7775
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76+
ORG_GRADLE_PROJECT_signKey: ${{ secrets.SIGN_KEY_ORG }}
77+
ORG_GRADLE_PROJECT_signPwd: ${{ secrets.SIGN_PWD }}
7878
SIGN_KEY: ${{ secrets.SIGN_KEY_ORG }}
7979
SIGN_PWD: ${{ secrets.SIGN_PWD }}
8080
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}

.github/workflows/release.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ jobs:
2121
distribution: 'temurin'
2222
java-version: |
2323
17
24-
11
2524
2625
- name: set up gradle
2726
uses: gradle/actions/setup-gradle@v4
@@ -30,6 +29,8 @@ jobs:
3029
env:
3130
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
3231
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
32+
ORG_GRADLE_PROJECT_signKey: ${{ secrets.SIGN_KEY_ORG }}
33+
ORG_GRADLE_PROJECT_signPwd: ${{ secrets.SIGN_PWD }}
3334
SIGN_KEY: ${{ secrets.SIGN_KEY_ORG }}
3435
SIGN_PWD: ${{ secrets.SIGN_PWD }}
3536
run: |
Lines changed: 51 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,26 @@
11
plugins {
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

6626
java {
@@ -69,28 +29,18 @@ java {
6929
}
7030

7131
kotlin {
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

9646
dependencies {
@@ -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-
170119
jacoco {
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

184137
sonarqube {
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", "$buildDir/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"

buildSrc/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
dependencies {
6+
// catalog hack: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
7+
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
8+
9+
implementation(libs.plugin.kotlin)
10+
// implementation(libs.plugin.checker)
11+
// implementation(libs.plugin.updates)
12+
implementation(libs.plugin.build)
13+
}

buildSrc/settings.gradle.kts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
@file:Suppress("UnstableApiUsage", "UNUSED_VARIABLE")
2+
3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
mavenCentral()
7+
}
8+
}
9+
10+
dependencyResolutionManagement {
11+
versionCatalogs {
12+
create("libs") {
13+
from(files("../gradle/libs.versions.toml"))
14+
}
15+
}
16+
17+
repositories {
18+
gradlePluginPortal()
19+
mavenCentral()
20+
maven {
21+
url = uri("https://central.sonatype.com/repository/maven-snapshots")
22+
mavenContent {
23+
snapshotsOnly()
24+
}
25+
}
26+
}
27+
}

buildSrc/src/main/groovy/VersionPlugin.groovy

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

0 commit comments

Comments
 (0)