Skip to content

Commit a7ecf60

Browse files
committed
update build
1 parent f512c58 commit a7ecf60

File tree

17 files changed

+254
-310
lines changed

17 files changed

+254
-310
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
8181
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
8282
run: |
83-
./gradlew publishToSonatype --stacktrace
83+
./gradlew publishToMavenCentral --stacktrace
8484
8585
- name: archive test results
8686
uses: actions/upload-artifact@v4
Lines changed: 74 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,67 @@
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
6+
id("openapiprocessor.test")
7+
id("openapiprocessor.testInt")
8+
id("openapiprocessor.publish")
109
alias(libs.plugins.versions)
10+
//alias(libs.plugins.kotlin)
11+
alias(libs.plugins.sonar)
12+
id("jacoco-report-aggregation")
13+
id("com.github.ben-manes.versions")
1114
}
1215

13-
group = projectGroupId
14-
version = projectVersion
16+
group = "io.openapiprocessor"
17+
version = libs.versions.processor.get()
1518
println("version: $version")
1619

17-
repositories {
18-
mavenLocal()
19-
mavenCentral()
20-
maven {
21-
url = "https://central.sonatype.com/repository/maven-snapshots"
22-
}
20+
versions {
21+
packageName = "io.openapiprocessor.spring"
22+
entries.putAll(mapOf(
23+
"version" to libs.versions.processor.get()
24+
))
2325
}
2426

25-
testing {
26-
suites {
27-
test {
28-
useJUnitJupiter(libs.versions.junit.get())
29-
}
30-
31-
testInt(JvmTestSuite) {
32-
useJUnitJupiter(libs.versions.junit.get())
33-
34-
dependencies {
35-
implementation(project())
36-
}
37-
38-
sources {
39-
java {
40-
srcDirs = ['src/testInt/kotlin']
41-
}
42-
}
43-
44-
targets {
45-
configureEach {
46-
testTask.configure {
47-
shouldRunAfter(test)
48-
}
49-
}
50-
}
51-
}
52-
}
53-
}
54-
55-
tasks.named('check') {
56-
dependsOn(testing.suites.testInt)
57-
}
5827

59-
sourceSets {
60-
main {
61-
java {
62-
srcDirs "${buildDir}/version"
63-
}
64-
}
65-
}
28+
//testing {
29+
// }
30+
//
31+
// sources {
32+
// java {
33+
// srcDirs = ['src/testInt/kotlin']
34+
// }
35+
// }
36+
//
37+
// targets {
38+
// configureEach {
39+
// testTask.configure {
40+
// shouldRunAfter(test)
41+
// }
42+
// }
43+
// }
44+
// }
45+
// }
46+
//}
6647

6748
java {
6849
withJavadocJar ()
6950
withSourcesJar ()
7051
}
7152

7253
kotlin {
73-
jvmToolchain(libs.versions.build.jdk.get() as Integer)
74-
}
75-
54+
jvmToolchain(libs.versions.build.jdk.get().toInt())
7655

77-
compileKotlin.dependsOn "generateVersion"
78-
79-
compileTestGroovy {
80-
dependsOn 'compileKotlin'
81-
classpath += files(compileKotlin.destinationDirectory)
82-
}
83-
84-
85-
tasks.named('compileKotlin') {
86-
dependsOn 'generateVersion'
56+
compilerOptions {
57+
freeCompilerArgs.add("-Xannotation-default-target=param-property")
58+
}
8759
}
8860

89-
tasks.named('sourcesJar') {
90-
dependsOn 'generateVersion'
61+
tasks.compileTestGroovy {
62+
classpath += sourceSets.main.get().compileClasspath
63+
classpath += files(tasks.compileKotlin.get().destinationDirectory)
64+
classpath += files(tasks.compileTestKotlin.get().destinationDirectory)
9165
}
9266

9367
dependencies {
@@ -106,7 +80,7 @@ dependencies {
10680
testImplementation (libs.openapi.processor.parser.api)
10781
testImplementation (libs.openapi.processor.parser.swagger)
10882
testImplementation (libs.openapi.processor.parser.openapi4j)
109-
testImplementation platform(libs.groovy.bom)
83+
testImplementation (platform(libs.groovy.bom))
11084
testImplementation ("org.apache.groovy:groovy")
11185
testImplementation ("org.apache.groovy:groovy-nio")
11286
testImplementation (libs.spock)
@@ -124,7 +98,7 @@ dependencies {
12498
testIntImplementation (libs.openapi.processor.parser.api)
12599
testIntImplementation (libs.openapi.processor.parser.swagger)
126100
testIntImplementation (libs.openapi.processor.parser.openapi4j)
127-
testIntImplementation platform(libs.groovy.bom)
101+
testIntImplementation (platform(libs.groovy.bom))
128102
testIntImplementation ("org.apache.groovy:groovy")
129103
testIntImplementation ("org.apache.groovy:groovy-nio")
130104
testIntImplementation (libs.spock)
@@ -146,46 +120,56 @@ dependencies {
146120
// }
147121
//}
148122

149-
tasks.withType(Test).configureEach {
150-
jvmArgs(
123+
tasks.withType<Test>().configureEach {
124+
jvmArgs(listOf(
151125
"--add-exports", "jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
152126
"--add-exports", "jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
153127
"--add-exports", "jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
154128
"--add-exports", "jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
155129
"--add-exports", "jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
156130
"--add-exports", "jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED"
157-
)
131+
))
158132

159133
javaLauncher.set(javaToolchains.launcherFor {
160134
languageVersion.set(JavaLanguageVersion.of(libs.versions.test.jdk.get()))
161135
})
162136

163-
finalizedBy jacocoTestReport
137+
finalizedBy(tasks.named("jacocoTestReport"))
164138
}
165139

166140
jacoco {
167141
toolVersion = libs.versions.jacoco.get()
168142
}
169143

170-
jacocoTestReport {
144+
tasks.jacocoTestReport {
145+
executionData.from(tasks.named<Test>("test").map<File> {
146+
it.extensions.getByType(JacocoTaskExtension::class.java).destinationFile as File
147+
})
148+
executionData.from(tasks.named<Test>("testInt").map<File> {
149+
it.extensions.getByType(JacocoTaskExtension::class.java).destinationFile as File
150+
})
151+
171152
reports {
172153
xml.required = true
173-
html.required = false
174-
csv.required = false
154+
html.required = true
175155
}
176-
177-
getExecutionData().setFrom(fileTree(buildDir).include("/jacoco/*.exec"))
178156
}
179157

158+
//publishing {
159+
// publications {
160+
// named<MavenPublication>("openapiprocessor") {
161+
// pom {
162+
// description = "OpenAPI Processor Spring"
163+
// }
164+
// }
165+
// }
166+
//}
167+
180168
sonarqube {
181169
properties {
182-
property "sonar.projectKey", "openapi-processor_openapi-processor-spring"
183-
property "sonar.organization", "openapi-processor"
184-
property "sonar.host.url", "https://sonarcloud.io"
185-
property "sonar.coverage.jacoco.xmlReportPaths", "$buildDir/reports/jacoco/test/jacocoTestReport.xml"
170+
property("sonar.projectKey", "openapi-processor_openapi-processor-base-spring")
171+
property("sonar.organization", "openapi-processor")
172+
property("sonar.host.url", "https://sonarcloud.io")
173+
property("sonar.coverage.jacoco.xmlReportPaths", layout.buildDirectory.dir("reports/jacoco/test/jacocoTestReport.xml").get().toString())
186174
}
187175
}
188-
189-
apply plugin: VersionPlugin
190-
apply from: "${rootProject.rootDir}/gradle/publishing.gradle"
191-
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.

buildSrc/src/main/groovy/VersionTask.groovy

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

0 commit comments

Comments
 (0)