Move publishing logic to conventions

This commit is contained in:
Edwin Jakobs
2023-03-30 13:28:25 +02:00
parent 0a2b7a08e3
commit a6beabe517
3 changed files with 126 additions and 177 deletions

View File

@@ -1,5 +1,5 @@
plugins {
alias(libs.plugins.nebula.release) apply false
alias(libs.plugins.nebula.release)
alias(libs.plugins.gradle.nexus.publish)
id("org.openrndr.extra.convention.dokka")
}
@@ -8,37 +8,6 @@ repositories {
mavenCentral()
}
def multiplatformModules = [
"orx-camera",
"orx-color",
"orx-compositor",
"orx-compute-graph",
"orx-compute-graph-nodes",
"orx-easing",
"orx-fx",
"orx-gradient-descent",
"orx-image-fit",
"orx-jumpflood",
"orx-marching-squares",
"orx-no-clear",
"orx-noise",
"orx-parameters",
"orx-property-watchers",
"orx-shade-styles",
"orx-shader-phrases",
"orx-shapes",
"orx-quadtree",
"orx-hash-grid",
"orx-depth-camera",
"orx-triangulation",
"orx-view-box",
"orx-turtle"
]
def doNotPublish = ["openrndr-demos"]
def isReleaseVersion = !version.endsWith("SNAPSHOT")
task buildMainReadme {
doFirst {
def subProjects = project.subprojects
@@ -119,149 +88,6 @@ task buildMainReadme {
mainReadme.write(newReadme.join("\n"))
}
}
// publishable && multiplatform
configure(allprojects.findAll { !doNotPublish.contains(it.name) && (multiplatformModules.contains(it.name)) }) {
apply plugin: 'maven-publish'
apply plugin: 'signing'
def fjdj = tasks.create("fakeJavaDocJar", Jar) {
archiveClassifier = "javadoc"
}
publishing {
publications {
matching { it.name == "jvm" }.all { p ->
artifact(fjdj)
}
}
publications {
all {
versionMapping {
allVariants {
fromResolutionOf("allSourceSetsRuntimeDependenciesMetadata")
}
}
pom {
name = "$project.name"
description = "$project.name"
url = 'https://openrndr.org'
developers {
developer {
id = 'edwinjakobs'
name = 'Edwin Jakobs'
email = 'edwin@openrndr.org'
}
}
license {
licenses {
license {
name = 'BSD-2-Clause'
url = 'https://github.com/openrndr/orx/blob/master/LICENSE'
distribution = 'repo'
}
}
}
scm {
connection = "scm:git:git@github.com:openrndr/orx.git"
developerConnection = "scm:git:ssh://github.com/openrndr/orx.git"
url = "https://github.com/openrndr/orx"
}
}
}
}
repositories {
maven {
credentials {
username findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
password findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
}
if (!isReleaseVersion) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
}
}
}
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications
}
}
// publishable && JVM only
configure(allprojects.findAll { !doNotPublish.contains(it.name) && !multiplatformModules.contains(it.name) }) {
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'nebula.release'
apply plugin: 'signing'
java {
withJavadocJar()
withSourcesJar()
}
publishing {
publications {
maven(MavenPublication) {
from components.java
versionMapping {
allVariants {
fromResolutionResult()
}
}
groupId = "org.openrndr.extra"
artifactId = "$project.name"
description = "$project.name"
pom {
name = "$project.name"
description = "$project.name"
url = 'https://openrndr.org'
developers {
developer {
id = 'edwinjakobs'
name = 'Edwin Jakobs'
email = 'edwin@openrndr.org'
}
}
license {
licenses {
license {
name = 'BSD-2-Clause'
url = 'https://github.com/openrndr/orx/blob/master/LICENSE'
distribution = 'repo'
}
}
}
scm {
connection = "scm:git:git@github.com:openrndr/orx.git"
developerConnection = "scm:git:ssh://github.com/openrndr/orx.git"
url = "https://github.com/openrndr/orx"
}
}
}
}
repositories {
maven {
credentials {
username findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME")
password findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD")
}
if (!isReleaseVersion) {
url "https://s01.oss.sonatype.org/content/repositories/snapshots"
} else {
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2"
}
}
}
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("publish") }
sign publishing.publications
}
}
group = "org.openrndr.extra"
nexusPublishing {