Add screenshot generation
This commit is contained in:
38
build.gradle
38
build.gradle
@@ -16,7 +16,7 @@ buildscript {
|
||||
apply plugin: 'org.jetbrains.dokka'
|
||||
|
||||
project.ext {
|
||||
openrndrVersion = "0.3.41"
|
||||
openrndrVersion = "0.4.0-SNAPSHOT"
|
||||
kotlinVersion = "1.3.72"
|
||||
spekVersion = "2.0.10"
|
||||
libfreenectVersion = "0.5.7-1.5.3"
|
||||
@@ -62,6 +62,7 @@ allprojects {
|
||||
group 'org.openrndr.extra'
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
maven {
|
||||
@@ -124,4 +125,39 @@ allprojects {
|
||||
includeEngines 'spek2'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
task collectScreenshots(dependsOn: 'classes') {
|
||||
doFirst {
|
||||
for (sub in project.subprojects) {
|
||||
if (sub.sourceSets.hasProperty("demo")) {
|
||||
def set = sub.sourceSets.demo
|
||||
def ucl = new URLClassLoader(set.runtimeClasspath.collect { it.toURI().toURL() } as URL[])
|
||||
for (x in set.output) {
|
||||
if (x.exists()) {
|
||||
for (y in x.listFiles()) {
|
||||
def name = y.name
|
||||
if (!name.contains('$') && name.contains(".class")) {
|
||||
def klass = ucl.loadClass(y.name.replace(".class", ""))
|
||||
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"
|
||||
}
|
||||
} catch (e) {
|
||||
// skip?
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user