Move publishing logic to conventions
This commit is contained in:
176
build.gradle
176
build.gradle
@@ -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 {
|
||||
|
||||
@@ -1,18 +1,28 @@
|
||||
package org.openrndr.extra.convention
|
||||
|
||||
import gradle.kotlin.dsl.accessors._e1ec756838cb41004a28483270a62877.publishing
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.net.URI
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
val shouldPublish = project.name !in setOf("openrndr-demos")
|
||||
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("maven-publish")
|
||||
`maven-publish` apply false
|
||||
id("org.openrndr.extra.convention.component-metadata-rule")
|
||||
id("org.openrndr.extra.convention.dokka")
|
||||
signing
|
||||
}
|
||||
if (shouldPublish) {
|
||||
apply(plugin = "maven-publish")
|
||||
}
|
||||
|
||||
//apply(plugin = "nebula.release")
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
@@ -59,4 +69,55 @@ tasks {
|
||||
kotlinOptions.apiVersion = libs.versions.kotlinApi.get()
|
||||
kotlinOptions.languageVersion = libs.versions.kotlinLanguage.get()
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
val isReleaseVersion = !(version.toString()).endsWith("SNAPSHOT")
|
||||
|
||||
if (shouldPublish) {
|
||||
publishing {
|
||||
publications {
|
||||
create<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
groupId = "org.openrndr.extra"
|
||||
artifactId = project.name
|
||||
description = project.name
|
||||
pom {
|
||||
name.set("$project.name")
|
||||
description.set("$project.name")
|
||||
url.set("https://openrndr.org")
|
||||
developers {
|
||||
developer {
|
||||
id.set("edwinjakobs")
|
||||
name.set("Edwin Jakobs")
|
||||
email.set("edwin@openrndr.org")
|
||||
}
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("BSD-2-Clause")
|
||||
url.set("https://github.com/openrndr/orx/blob/master/LICENSE")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection.set("scm:git:git@github.com:openrndr/orx.git")
|
||||
developerConnection.set("scm:git:ssh://github.com/openrndr/orx.git")
|
||||
url.set("https://github.com/openrndr/orx")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
setRequired({ isReleaseVersion && gradle.taskGraph.hasTask("publish") })
|
||||
sign(publishing.publications)
|
||||
}
|
||||
}
|
||||
@@ -4,14 +4,21 @@ import CollectScreenshotsTask
|
||||
import org.gradle.accessors.dm.LibrariesForLibs
|
||||
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||
import java.net.URI
|
||||
|
||||
val libs = the<LibrariesForLibs>()
|
||||
|
||||
val shouldPublish = project.name !in setOf("openrndr-demos")
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform")
|
||||
id("maven-publish")
|
||||
`maven-publish` apply false
|
||||
id("org.openrndr.extra.convention.component-metadata-rule")
|
||||
id("org.openrndr.extra.convention.dokka")
|
||||
signing
|
||||
}
|
||||
if (shouldPublish) {
|
||||
apply(plugin = "maven-publish")
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -87,4 +94,59 @@ kotlin {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val isReleaseVersion = !(version.toString()).endsWith("SNAPSHOT")
|
||||
|
||||
if (shouldPublish) {
|
||||
publishing {
|
||||
publications {
|
||||
val fjdj = tasks.create("fakeJavaDocJar", Jar::class) {
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
matching { it.name == "jvm" }.forEach { p ->
|
||||
p as MavenPublication
|
||||
p.artifact(fjdj)
|
||||
}
|
||||
all {
|
||||
this as MavenPublication
|
||||
versionMapping {
|
||||
allVariants {
|
||||
fromResolutionOf("allSourceSetsRuntimeDependenciesMetadata")
|
||||
}
|
||||
}
|
||||
pom {
|
||||
name.set("$project.name")
|
||||
description.set("$project.name")
|
||||
url.set("https://openrndr.org")
|
||||
developers {
|
||||
developer {
|
||||
id.set("edwinjakobs")
|
||||
name.set("Edwin Jakobs")
|
||||
email.set("edwin@openrndr.org")
|
||||
}
|
||||
}
|
||||
|
||||
licenses {
|
||||
license {
|
||||
name.set("BSD-2-Clause")
|
||||
url.set("https://github.com/openrndr/orx/blob/master/LICENSE")
|
||||
distribution.set("repo")
|
||||
}
|
||||
}
|
||||
|
||||
scm {
|
||||
connection.set("scm:git:git@github.com:openrndr/orx.git")
|
||||
developerConnection.set("scm:git:ssh://github.com/openrndr/orx.git")
|
||||
url.set("https://github.com/openrndr/orx")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
setRequired({ isReleaseVersion && gradle.taskGraph.hasTask("publish") })
|
||||
sign(publishing.publications)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user