Skip to content

Commit f008258

Browse files
authored
fix: Add java components to publications (#873)
1 parent 3498868 commit f008258

File tree

7 files changed

+48
-1
lines changed

7 files changed

+48
-1
lines changed

kt/build-logic/convention/src/main/kotlin/publish/PublishToMavenCentralPlugin.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import com.vanniktech.maven.publish.MavenPublishPlugin
66
import com.vanniktech.maven.publish.SonatypeHost
77
import org.gradle.api.Plugin
88
import org.gradle.api.Project
9+
import org.gradle.api.plugins.JavaPluginExtension
910
import org.gradle.api.publish.PublishingExtension
1011
import org.gradle.api.publish.maven.MavenPublication
1112
import org.gradle.plugins.signing.Sign
@@ -16,6 +17,11 @@ class PublishToMavenCentralPlugin : Plugin<Project> {
1617
target.plugins.apply(org.gradle.api.publish.maven.plugins.MavenPublishPlugin::class.java)
1718

1819
target.afterEvaluate { evaluatedProject ->
20+
target.extensions.getByType(JavaPluginExtension::class.java).apply {
21+
withSourcesJar()
22+
withJavadocJar()
23+
}
24+
1925
val mavenCentralUser = target.propOrEnv("ORG_GRADLE_PROJECT_mavenCentralUsername") ?: target.propOrEnv("mavenCentralUsername")
2026
val mavenCentralPassword = target.propOrEnv("ORG_GRADLE_PROJECT_mavenCentralPassword") ?: target.propOrEnv("mavenCentralPassword")
2127
val gpgInMemoryKey = target.propOrEnv("ORG_GRADLE_PROJECT_signingInMemoryKey") ?: target.propOrEnv("signingInMemoryKey")
@@ -89,7 +95,6 @@ class PublishToMavenCentralPlugin : Plugin<Project> {
8995
}
9096
}
9197

92-
9398
if (canSign) {
9499
evaluatedProject.logger.info("Will sign artifact for project \"${evaluatedProject.name}\" and setup publishing")
95100

kt/godot-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ kotlin {
3030
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
3131
}
3232

33+
java {
34+
withSourcesJar()
35+
withJavadocJar()
36+
}
37+
3338
dependencies {
3439
// added here as a transitive dependency so the user can use reflection
3540
// we need to add it here so reflection is available where the code is loaded (Bootstrap.kt) otherwise it will not work
@@ -64,6 +69,8 @@ publishing {
6469
}
6570
artifactId = "godot-library-$targetSuffix"
6671
description = "A library allowing to define scripts for the Godot Engine."
72+
73+
from(components["java"])
6774
}
6875
}
6976
}

kt/godot-library/godot-api-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ kotlin {
1818
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
1919
}
2020

21+
java {
22+
withSourcesJar()
23+
withJavadocJar()
24+
}
25+
2126
dependencies {
2227
api("com.utopia-rise:common:$fullGodotKotlinJvmVersion")
2328
implementation(project(":godot-internal-library"))
@@ -47,6 +52,8 @@ publishing {
4752
}
4853
artifactId = "godot-api-library-$targetSuffix"
4954
description = "Contains godot generated api as kotlin classes and jvm cpp interaction code."
55+
56+
from(components["java"])
5057
}
5158
}
5259
}

kt/godot-library/godot-core-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ kotlin {
1818
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
1919
}
2020

21+
java {
22+
withSourcesJar()
23+
withJavadocJar()
24+
}
25+
2126
dependencies {
2227
api("com.utopia-rise:common:$fullGodotKotlinJvmVersion")
2328
implementation(project(":godot-internal-library"))
@@ -50,6 +55,8 @@ publishing {
5055
}
5156
artifactId = "godot-core-library-$targetSuffix"
5257
description = "Contains godot api as kotlin classes and jvm cpp interaction code."
58+
59+
from(components["java"])
5360
}
5461
}
5562
}

kt/godot-library/godot-coroutine-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ kotlin {
1818
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
1919
}
2020

21+
java {
22+
withSourcesJar()
23+
withJavadocJar()
24+
}
25+
2126
dependencies {
2227
api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${libs.versions.kotlinCoroutine.get()}")
2328
api("com.utopia-rise:common:$fullGodotKotlinJvmVersion")
@@ -51,6 +56,8 @@ publishing {
5156
}
5257
artifactId = "godot-coroutine-library-$targetSuffix"
5358
description = "Godot library extension allowing the use of coroutines in a Godot context."
59+
60+
from(components["java"])
5461
}
5562
}
5663
}

kt/godot-library/godot-extension-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ kotlin {
1919
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
2020
}
2121

22+
java {
23+
withSourcesJar()
24+
withJavadocJar()
25+
}
26+
2227
dependencies {
2328
api("com.utopia-rise:common:$fullGodotKotlinJvmVersion")
2429
implementation(project(":godot-internal-library"))
@@ -49,6 +54,8 @@ publishing {
4954
}
5055
artifactId = "godot-extension-library-$targetSuffix"
5156
description = "Godot library extension build on top of the base Godot API."
57+
58+
from(components["java"])
5259
}
5360
}
5461
}

kt/godot-library/godot-internal-library/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ kotlin {
1818
jvmToolchain(libs.versions.toolchain.jvm.get().toInt())
1919
}
2020

21+
java {
22+
withSourcesJar()
23+
withJavadocJar()
24+
}
25+
2126
dependencies {
2227
// added here as a transitive dependency so the user can use reflection
2328
// we need to add it here so reflection is available where the code is loaded (Bootstrap.kt) otherwise it will not work
@@ -36,6 +41,8 @@ publishing {
3641
}
3742
artifactId = "godot-internal-library-$targetSuffix"
3843
description = "Contains internal utilities for the Godot kotlin libraries"
44+
45+
from(components["java"])
3946
}
4047
}
4148
}

0 commit comments

Comments
 (0)