346 lines
11 KiB
Groovy
346 lines
11 KiB
Groovy
// root build.gradle
|
|
buildscript {
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
|
|
classpath "com.netflix.nebula:nebula-release-plugin:16.0.0"
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
// remember to update all the versions here when upgrading kotlin version
|
|
id 'org.jetbrains.kotlin.jvm' apply false
|
|
id 'org.jetbrains.kotlin.multiplatform' apply false
|
|
id "io.github.gradle-nexus.publish-plugin" version "1.1.0"
|
|
}
|
|
|
|
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-no-clear",
|
|
"orx-noise",
|
|
"orx-parameters",
|
|
"orx-shade-styles",
|
|
"orx-shader-phrases",
|
|
"orx-shapes",
|
|
"orx-quadtree",
|
|
"orx-hash-grid"
|
|
|
|
]
|
|
|
|
def doNotPublish = ["openrndr-demos"]
|
|
|
|
apply plugin: 'org.jetbrains.dokka'
|
|
|
|
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
|
|
|
|
def openrndrUseSnapshot = isReleaseVersion
|
|
|
|
allprojects {
|
|
group 'org.openrndr.extra'
|
|
repositories {
|
|
mavenCentral()
|
|
if (openrndrUseSnapshot) {
|
|
mavenLocal()
|
|
}
|
|
maven {
|
|
url = "https://maven.openrndr.org"
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
dokka {
|
|
moduleName = "$rootProject.name"
|
|
outputDirectory = "$buildDir/docs"
|
|
outputFormat = "html"
|
|
includes = ['Module.md']
|
|
sourceDirs = files(subprojects.collect { p -> new File(p.projectDir, "/src/main/kotlin") })
|
|
}
|
|
|
|
task buildMainReadme {
|
|
doFirst {
|
|
def subProjects = project.subprojects
|
|
//.findAll { !it.name.contains("kinect-common") && !it.name.contains
|
|
// ("kinect-v1-") }
|
|
|
|
// Load README.md and find [begin, end] section to replace
|
|
def mainReadme = file("README.md")
|
|
def lines = mainReadme.readLines()
|
|
|
|
def begin = lines.findIndexOf { it == "<!-- __orxListBegin__ -->" }
|
|
def end = lines.findIndexOf { it == "<!-- __orxListEnd__ -->" }
|
|
if (begin == -1 || end == -1) {
|
|
println("Comments for orx list generation not found in README.md!")
|
|
return
|
|
}
|
|
|
|
def header = lines.subList(0, begin + 1)
|
|
def footer = lines.subList(end, lines.size())
|
|
|
|
def newReadme = []
|
|
for (line in header) {
|
|
newReadme.add(line)
|
|
}
|
|
|
|
// Search for the description at the top of the readme.
|
|
// Skip the hash character from the headline, then start
|
|
// on the next line and continue until the next empty line.
|
|
// Don't fall into Windows line breaks.
|
|
def descriptionRx = ~/(?s)\#.*?\n(.+?)\n\r?\n/
|
|
// Note: the readme needs an empty line after the description
|
|
|
|
def orxMultiplatform = []
|
|
def orxJVMOnly = []
|
|
|
|
// Build orx list
|
|
for (sub in subProjects) {
|
|
def orxReadmeFile = sub.file("README.md")
|
|
if (orxReadmeFile.exists()) {
|
|
def orxReadmeText = orxReadmeFile.getText()
|
|
orxReadmeText.find(descriptionRx) {
|
|
description ->
|
|
def trimmedDescription = description[1].trim() //.strip() supports unicode, java11 only
|
|
.replace("\n", " ").replace("\r", "")
|
|
def path = sub.path.substring(1).replace(":", "/")
|
|
if (path.startsWith("orx-jvm")) {
|
|
orxJVMOnly.add("| [`${sub.name}`]($path/) " +
|
|
"| $trimmedDescription |")
|
|
} else {
|
|
orxMultiplatform.add("| [`${sub.name}`]($path/) " +
|
|
"| $trimmedDescription |")
|
|
}
|
|
}
|
|
|
|
} else {
|
|
println("${sub.name}/README.md not found!")
|
|
}
|
|
}
|
|
|
|
newReadme.add("\n## Multiplatform\n")
|
|
newReadme.add("| name" + " " * 36 + " | description |")
|
|
newReadme.add("| --- | --- |")
|
|
newReadme.addAll(orxMultiplatform)
|
|
|
|
newReadme.add("\n## JVM only\n")
|
|
newReadme.add("| name" + " " * 36 + " | description |")
|
|
newReadme.add("| --- | --- |")
|
|
newReadme.addAll(orxJVMOnly)
|
|
|
|
for (line in footer) {
|
|
newReadme.add(line)
|
|
}
|
|
|
|
// Write result
|
|
if (mainReadme.exists()) {
|
|
mainReadme.delete()
|
|
}
|
|
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 {
|
|
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/openrndr/blob/master/LICENSE'
|
|
distribution = 'repo'
|
|
}
|
|
}
|
|
}
|
|
scm {
|
|
connection = "scm:git:git@github.com:openrndr/openrndr.git"
|
|
developerConnection = "scm:git:ssh://github.com/openrndr/openrndr.git"
|
|
url = "https://github.com/openrndr/openrndr"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
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: 'idea'
|
|
apply plugin: 'java'
|
|
apply plugin: 'kotlin'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'nebula.release'
|
|
apply plugin: 'signing'
|
|
|
|
def proj = it
|
|
println proj
|
|
java {
|
|
withJavadocJar()
|
|
withSourcesJar()
|
|
}
|
|
publishing {
|
|
publications {
|
|
maven(MavenPublication) {
|
|
from components.java
|
|
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
|
|
}
|
|
|
|
dependencies {
|
|
implementation libs.kotlin.logging
|
|
implementation libs.kotlin.coroutines
|
|
implementation libs.kotlin.stdlib
|
|
implementation libs.openrndr.application
|
|
implementation libs.openrndr.math
|
|
testImplementation libs.spek.dsl
|
|
testImplementation libs.kluent
|
|
testImplementation libs.kotlin.test
|
|
testRuntimeOnly libs.spek.junit5
|
|
testRuntimeOnly libs.kotlin.reflect
|
|
}
|
|
|
|
|
|
test {
|
|
useJUnitPlatform {
|
|
includeEngines 'spek2'
|
|
}
|
|
}
|
|
|
|
java {
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
}
|
|
|
|
javadoc {
|
|
options.addBooleanOption 'Xdoclint:none', true
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all {
|
|
kotlinOptions.freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.InternalCoroutinesApi"]
|
|
}
|
|
}
|
|
|
|
group = "org.openrndr"
|
|
nexusPublishing {
|
|
repositories {
|
|
sonatype {
|
|
username.set( findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME"))
|
|
password.set(findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD"))
|
|
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
|
|
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots"))
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
//configure(allprojects.findAll { it.name != "openrndr-demos" }) {
|
|
// apply plugin: 'maven-publish'
|
|
// apply plugin: 'nebula.release'
|
|
//}
|
|
|
|
|
|
//collectScreenshots.dependsOn {
|
|
// project.subprojects.findAll { it.sourceSets.hasProperty("demo") }.collect { it.tasks.demoClasses }
|
|
//}
|