ci(java): try to use publications

This commit is contained in:
zaaarf 2024-10-16 01:07:34 +02:00
parent 2e583028a6
commit 5dcfd341d3
No known key found for this signature in database
GPG key ID: C91CFF9E2262BBA1
2 changed files with 42 additions and 8 deletions

1
.gitignore vendored
View file

@ -28,6 +28,7 @@ dist/java/.gradle/
dist/java/.project
dist/java/.settings/
dist/java/bin/
dist/java/artifacts/
# intellij insists on creating the wrapper every time even if it's not strictly necessary
dist/java/gradle/

View file

@ -52,6 +52,16 @@ tasks.register('linuxJar', Jar) {
}
}
tasks.register('multiplatformJar', Jar) {
outputs.upToDateWhen { false }
archiveClassifier = 'all'
from sourceSets.main.runtimeClasspath
from('artifacts') {
include('*')
into('natives/')
}
}
configurations {
windowsJar {
canBeConsumed = true
@ -68,15 +78,27 @@ configurations {
canBeResolved = false
extendsFrom implementation, runtimeOnly
}
multiplatformJar {
canBeConsumed = true
canBeResolved = false
extendsFrom implementation, runtimeOnly
}
}
java {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_11
withSourcesJar()
withJavadocJar()
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
windowsJar(windowsJar)
macosJar(macosJar)
linuxJar(linuxJar)
}
multiplatformJar(multiplatformJar)
}
repositories {
@ -116,14 +138,25 @@ tasks.register('nativeBuild', Jar) {
}
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact sourcesJar
artifact javadocJar
artifact windowsJar
artifact linuxJar
artifact macosJar
artifact multiplatformJar
}
}
}
import com.vanniktech.maven.publish.SonatypeHost
import com.vanniktech.maven.publish.JavaLibrary
import com.vanniktech.maven.publish.JavadocJar
mavenPublishing {
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL) //, true) // TODO re-enable autopublish!
signAllPublications()
coordinates(project.group, rootProject.name, project.version)
configure(new JavaLibrary(new JavadocJar.Javadoc(), true))
pom {
name = rootProject.name