Potential gradle publish fix

This commit is contained in:
PiggyPiglet
2026-01-19 16:36:34 +08:00
parent 8116cbb385
commit 9a677d46a1
2 changed files with 21 additions and 11 deletions

View File

@@ -83,21 +83,17 @@ tasks {
from(paper.output) from(paper.output)
} }
val sourcesJar by registering(Jar::class) { val combinedSourcesJar by registering(Jar::class) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
from(sourceSets.main.get().allSource) from(sourceSets.main.get().allSource)
from(paper.allSource) from(paper.allSource)
} }
withType<JavaCompile> { val combinedJavadoc by registering(Javadoc::class) {
options.encoding = "UTF-8"
options.release = 8
}
val javadocJar = withType<Javadoc> {
isFailOnError = false isFailOnError = false
source = sourceSets.main.get().allJava + paper.allJava source = sourceSets.main.get().allJava + paper.allJava
classpath = sourceSets.main.get().compileClasspath + paper.compileClasspath
with(options as StandardJavadocDocletOptions) { with(options as StandardJavadocDocletOptions) {
addStringOption("Xdoclint:none", "-quiet") addStringOption("Xdoclint:none", "-quiet")
@@ -106,6 +102,17 @@ tasks {
} }
} }
val combinedJavadocJar by registering(Jar::class) {
archiveClassifier.set("javadoc")
dependsOn(combinedJavadoc)
from(combinedJavadoc.get().destinationDir)
}
withType<JavaCompile> {
options.encoding = "UTF-8"
options.release = 8
}
withType<ShadowJar> { withType<ShadowJar> {
configurations = listOf(project.configurations.runtimeClasspath.get()) configurations = listOf(project.configurations.runtimeClasspath.get())
@@ -145,9 +152,12 @@ tasks {
builtBy(plainJar) builtBy(plainJar)
} }
artifacts { artifact(combinedSourcesJar) {
archives(sourcesJar) builtBy(combinedSourcesJar)
archives(javadocJar) }
artifact(combinedJavadocJar) {
builtBy(combinedJavadocJar)
} }
} }
} }

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists