Files
orx/build.gradle
2020-04-27 16:11:14 +02:00

193 lines
6.6 KiB
Groovy

buildscript {
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
classpath "com.netflix.nebula:nebula-kotlin-plugin:1.3.72"
classpath "com.netflix.nebula:nebula-publishing-plugin:17.0.5"
classpath "com.netflix.nebula:nebula-release-plugin:14.1.0"
classpath "com.netflix.nebula:nebula-bintray-plugin:8.3.0"
classpath "com.github.ben-manes:gradle-versions-plugin:0.28.0"
}
}
apply plugin: 'org.jetbrains.dokka'
project.ext {
openrndrVersion = "0.3.42-rc.1"
kotlinVersion = "1.3.72"
spekVersion = "2.0.10"
libfreenectVersion = "0.5.7-1.5.3"
gsonVersion = "2.8.6"
antlrVersion = "4.8-1"
}
switch (org.gradle.internal.os.OperatingSystem.current()) {
case org.gradle.internal.os.OperatingSystem.WINDOWS:
project.ext.openrndrOS = "windows"
break
case org.gradle.internal.os.OperatingSystem.LINUX:
project.ext.openrndrOS = "linux-x64"
break
case org.gradle.internal.os.OperatingSystem.MAC_OS:
project.ext.openrndrOS = "macos"
break
}
dokka {
moduleName = "$rootProject.name"
outputDirectory = "$buildDir/docs"
outputFormat = "html"
includes = ['Module.md']
sourceDirs = files(subprojects.collect { p -> new File(p.projectDir, "/src/main/kotlin") })
}
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'nebula.kotlin'
apply plugin: 'nebula.contacts'
apply plugin: 'nebula.info'
apply plugin: 'nebula.release'
apply plugin: 'nebula.maven-publish'
apply plugin: 'nebula.source-jar'
apply plugin: 'nebula.javadoc-jar'
apply plugin: 'nebula.nebula-bintray-publishing'
apply plugin: "com.github.ben-manes.versions"
group 'org.openrndr.extra'
repositories {
mavenCentral()
jcenter()
maven {
url = "https://dl.bintray.com/openrndr/openrndr"
}
maven {
url "https://dl.bintray.com/spekframework/spek"
}
}
dependencies {
implementation 'io.github.microutils:kotlin-logging:1.7.9'
implementation "org.openrndr:openrndr-core:$openrndrVersion"
implementation "org.openrndr:openrndr-filter:$openrndrVersion"
implementation "org.openrndr:openrndr-shape:$openrndrVersion"
implementation group: 'org.jetbrains.kotlinx', name: 'kotlinx-coroutines-core', version: '1.3.5'
testImplementation "org.spekframework.spek2:spek-dsl-jvm:$spekVersion"
testImplementation "org.amshove.kluent:kluent:1.60"
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
testRuntimeOnly "org.spekframework.spek2:spek-runner-junit5:$spekVersion"
testRuntimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
runtimeOnly "org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
javadoc {
options.addBooleanOption 'Xdoclint:none', true
}
contacts {
'edwin@openrndr.org' {
moniker 'Edwin Jakobs'
github 'edwinRNDR'
}
}
bintray {
user = findProperty('bintrayUser') ?: System.getenv('BINTRAY_USER')
apiKey = findProperty('bintrayKey') ?: System.getenv('BINTRAY_KEY')
userOrg = 'openrndr'
repo = 'openrndr'
pkgName = 'orx'
gppSign = false
syncToMavenCentral = false
licenses = ['BSD-2-Clause']
vcsUrl = 'https://github.com/openrndr/orx.git'
websiteUrl = 'https://www.openrndr.org'
issueTrackerUrl = 'https://github.com/openrndr/orx/issues'
labels = ['creative-coding', 'realtime-rendering', 'opengl']
}
test {
useJUnitPlatform {
includeEngines 'spek2'
}
}
}
task collectScreenshots {
doFirst {
def demoProjects = project.subprojects.findAll { it.sourceSets.hasProperty("demo") }
for (sub in demoProjects) {
if (sub.name == "orx-rabbit-control")
continue
if (sub.name == "orx-runway")
continue
def set = sub.sourceSets.demo
def ucl = new URLClassLoader(set.runtimeClasspath.collect { it.toURI().toURL() } as URL[])
def runDemos = []
for (x in set.output) {
if (x.exists()) {
for (y in x.listFiles()) {
def name = y.name
if (!name.contains('$') && name.contains(".class")) {
def klassName = y.name.replace(".class", "")
def klass = ucl.loadClass(klassName)
try {
def mainMethod = klass.getMethod("main")
javaexec {
classpath set.runtimeClasspath
def className = y.name.replace(".class", "")
main = className
jvmArgs += "-DtakeScreenshot=true"
jvmArgs += "-DscreenshotPath=${sub.name}/images/${className}.png"
jvmArgs += "-Dorg.openrndr.exceptions=JVM"
executable = "./build-tools/xvfb-java.sh"
}
runDemos.add(klassName)
} catch (e) {
// skip?
}
}
}
}
}
runDemos = runDemos.sort()
def readme = sub.file("README.md")
if (readme.exists()) {
def lines = readme.readLines()
def screenshotsLine = lines.findIndexOf { it == "<!-- __demos__ -->" }
if (screenshotsLine != -1) {
lines = lines.subList(0, screenshotsLine)
}
lines.add("<!-- __demos__ -->")
lines.add("## Demos")
for (demo in runDemos) {
lines.add("[${demo}](src/demo/kotlin/${demo}.kt)")
lines.add("![${demo}](https://raw.githubusercontent.com/openrndr/orx/media/${sub.name}/images/${demo}.png)")
}
readme.delete()
readme.write(lines.join("\n"))
}
}
}
}
collectScreenshots.dependsOn {
project.subprojects.findAll { it.sourceSets.hasProperty("demo") }.collect { it.tasks.demoClasses }
}