[orx-poisson-fill] Fix demos, attempt 2

This commit is contained in:
Edwin Jakobs
2022-01-21 21:25:32 +01:00
parent 65cc33acda
commit df1b7acd46
4 changed files with 16 additions and 11 deletions

View File

@@ -51,6 +51,7 @@ project.ext {
jsoupVersion = '1.14.3'
kotestVersion = '5.0.1'
junitJupiterVersion = '5.7.1'
slf4jVersion = '1.7.33'
}

View File

@@ -44,8 +44,9 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
}
inputChanges.getFileChanges(inputDir).forEach { change ->
println(change)
if (change.fileType == FileType.DIRECTORY) return@forEach
if (change.file.extension == "class" && !(change.file.name.contains("$"))) {
if (change.file.extension == "class") {
val klassName = change.file.nameWithoutExtension
if (klassName.dropLast(2) in ignore.get())
return@forEach
@@ -59,14 +60,17 @@ abstract class CollectScreenshotsTask @Inject constructor() : DefaultTask() {
val klass = ucl.loadClass(klassName)
println("Collecting screenshot for ${klassName} ${klass}")
val mainMethod = klass.getMethod("main")
println(mainMethod)
project.javaexec {
this.classpath += project.files(inputDir.get().asFile, preloadClass)
this.classpath += runtimeDependencies.get()
this.mainClass.set(klassName)
this.workingDir(project.rootProject.projectDir)
jvmArgs("-DtakeScreenshot=true", "-DscreenshotPath=${outputDir.get().asFile}/$klassName.png")
try {
val mainMethod = klass.getMethod("main")
project.javaexec {
this.classpath += project.files(inputDir.get().asFile, preloadClass)
this.classpath += runtimeDependencies.get()
this.mainClass.set(klassName)
this.workingDir(project.rootProject.projectDir)
jvmArgs("-DtakeScreenshot=true", "-DscreenshotPath=${outputDir.get().asFile}/$klassName.png")
}
} catch (e: NoSuchMethodException) {
// silently ignore
}
}
}

View File

@@ -14,6 +14,7 @@ sourceSets {
val openrndrVersion: String by rootProject.extra
val openrndrOS: String by rootProject.extra
val slf4jVersion:String by rootProject.extra
val demoImplementation by configurations.getting {}
val demoRuntimeOnly by configurations.getting {}
@@ -24,6 +25,7 @@ dependencies {
implementation("org.openrndr:openrndr-filter:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-application:$openrndrVersion")
demoImplementation("org.openrndr:openrndr-extensions:$openrndrVersion")
demoRuntimeOnly("org.slf4j:slf4j-simple:$slf4jVersion")
demoRuntimeOnly("org.openrndr:openrndr-gl3:$openrndrVersion")
demoRuntimeOnly("org.openrndr:openrndr-gl3-natives-$openrndrOS:$openrndrVersion")
demoImplementation(sourceSets.getByName("main").output)

View File

@@ -19,8 +19,6 @@ import kotlin.math.sin
fun main() {
data class Thing(val color: ColorRGBa, var pos: Polar, val speed: Polar)
application {
program {
val dry = renderTarget(width, height) {