Skip to content

Commit 3b41adb

Browse files
authored
Merge pull request #85 from openapi-processor/kotlin
migrate to kotlin
2 parents c7a53e3 + 4115b1e commit 3b41adb

File tree

74 files changed

+1329
-1429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1329
-1429
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ jobs:
2727
distribution: 'temurin'
2828
java-version: |
2929
17
30-
11
3130
3231
- name: build & publish (sonatype)
3332
env:
@@ -38,6 +37,6 @@ jobs:
3837
ORG_GRADLE_PROJECT_signPwd: ${{ secrets.SIGN_PWD }}
3938
PUBLISH_USER: ${{ secrets.PUBLISH_USER }}
4039
PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }}
41-
run: ./gradlew build publishToSonatype -s
40+
run: ./gradlew build publishToMavenCentral --stacktrace
4241

4342
# -i -d

build.gradle.kts

Lines changed: 28 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,27 @@
11
plugins {
22
`kotlin-dsl`
3-
id("signing")
4-
id("openapiprocessor.version")
5-
id("openapiprocessor.publish")
3+
`maven-publish`
4+
signing
5+
alias(libs.plugins.pubplug)
66
alias(libs.plugins.publish)
7-
alias(libs.plugins.nexus)
87
alias(libs.plugins.versions)
8+
id("compile")
99
}
1010

11-
group = projectGroupId()
12-
version = projectVersion()
13-
extra["api"] = libs.versions.api.get()
11+
group = "io.openapiprocessor"
12+
version = libs.versions.project.get()
1413

15-
allprojects {
16-
apply(plugin = "groovy")
17-
18-
repositories {
19-
mavenCentral()
20-
21-
maven {
22-
url = uri("https://oss.sonatype.org/content/repositories/snapshots")
23-
content {
24-
includeGroup("io.openapiprocessor")
25-
}
26-
mavenContent {
27-
snapshotsOnly()
28-
}
29-
}
30-
31-
java {
32-
toolchain {
33-
languageVersion.set(JavaLanguageVersion.of(11))
34-
}
35-
}
36-
}
14+
versions {
15+
packageName = "io.openapiprocessor.gradle"
16+
entries = mapOf(
17+
"version" to libs.versions.project.get(),
18+
"api" to libs.versions.api.get()
19+
)
20+
}
3721

38-
dependencies {
39-
compileOnly(rootProject.libs.openapi.processor.api)
40-
implementation(localGroovy())
22+
java {
23+
toolchain {
24+
languageVersion.set(JavaLanguageVersion.of(17))
4125
}
4226
}
4327

@@ -46,7 +30,6 @@ java {
4630
withSourcesJar()
4731
}
4832

49-
@Suppress("UnstableApiUsage")
5033
testing {
5134
suites {
5235
val test by getting(JvmTestSuite::class) {
@@ -75,9 +58,14 @@ testing {
7558
}
7659
}
7760

78-
//tasks.updateDaemonJvm {
79-
// jvmVersion = JavaVersion.VERSION_17
80-
//}
61+
// compile groovy before kotlin
62+
tasks.compileGroovy {
63+
classpath = sourceSets.main.get().compileClasspath
64+
}
65+
66+
tasks.compileKotlin {
67+
libraries.from(sourceSets.main.get().groovy.classesDirectory)
68+
}
8169

8270
tasks.named<Test>("testInt") {
8371
shouldRunAfter(tasks.named("test"))
@@ -107,18 +95,14 @@ gradlePlugin {
10795
create("processorPlugin") {
10896
id = "io.openapiprocessor.openapi-processor"
10997
displayName = "Gradle openapi-processor plugin"
110-
description = "plugin to run openapi-processor-*, e.g. openapi-processor-spring (requires gradle 7.0+, with gradle 5.5+ use 2021.3)"
98+
description = "plugin to run openapi-processor-*, e.g. openapi-processor-spring (requires gradle 7.2+)"
11199
tags.set(listOf("openapi", "openapi-processor"))
112100
implementationClass = "io.openapiprocessor.gradle.OpenApiProcessorPlugin"
113101
}
114102
}
115103
}
116104

117-
nexusPublishing {
118-
repositories {
119-
sonatype {
120-
username = getPublishUser()
121-
password = getPublishKey()
122-
}
123-
}
105+
publishingCentral {
106+
deploymentName = "gradle"
107+
waitFor = "VALIDATED"
124108
}

buildSrc/build.gradle.kts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,7 @@ plugins {
22
`kotlin-dsl`
33
}
44

5-
repositories {
6-
mavenCentral()
7-
maven {
8-
url = uri("https://plugins.gradle.org/m2/")
9-
}
10-
}
11-
125
dependencies {
136
// catalog hack: https://github.com/gradle/gradle/issues/15383#issuecomment-779893192
147
// compileOnly(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
158
}
16-
17-
gradlePlugin {
18-
plugins {
19-
create("VersionPlugin") {
20-
id = "openapiprocessor.version"
21-
implementationClass = "VersionPlugin"
22-
}
23-
}
24-
}
25-

buildSrc/settings.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,29 @@
1+
rootProject.name = "buildSrc"
2+
3+
pluginManagement {
4+
repositories {
5+
gradlePluginPortal()
6+
mavenCentral()
7+
// maven {
8+
// url = uri("https://central.sonatype.com/repository/maven-snapshots")
9+
// }
10+
}
11+
}
12+
113
dependencyResolutionManagement {
214
versionCatalogs {
315
create("libs") {
416
from(files("../gradle/libs.versions.toml"))
517
}
618
}
19+
20+
repositories {
21+
mavenCentral()
22+
// maven {
23+
// url = uri("https://central.sonatype.com/repository/maven-snapshots")
24+
// }
25+
// maven {
26+
// url = uri("https://plugins.gradle.org/m2/")
27+
// }
28+
}
729
}

buildSrc/src/main/kotlin/Project.kt

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

buildSrc/src/main/kotlin/VersionPlugin.kt

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

buildSrc/src/main/kotlin/VersionTask.kt

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// basic compile settings for project and subprojects
2+
3+
plugins {
4+
groovy
5+
}
6+
7+
dependencies {
8+
compileOnly("io.openapiprocessor:openapi-processor-api:2024.2")
9+
implementation(localGroovy())
10+
}

0 commit comments

Comments
 (0)