From df1b7acd46ca633389c5cbc0a2cd071df2b3788a Mon Sep 17 00:00:00 2001 From: Edwin Jakobs Date: Fri, 21 Jan 2022 21:25:32 +0100 Subject: [PATCH] [orx-poisson-fill] Fix demos, attempt 2 --- build.gradle | 1 + .../src/main/kotlin/CollectScreenShots.kt | 22 +++++++++++-------- orx-jvm/orx-poisson-fill/build.gradle.kts | 2 ++ .../src/demo/kotlin/DemoPoissonFill01.kt | 2 -- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/build.gradle b/build.gradle index 1ee976424..cc230406d 100644 --- a/build.gradle +++ b/build.gradle @@ -51,6 +51,7 @@ project.ext { jsoupVersion = '1.14.3' kotestVersion = '5.0.1' junitJupiterVersion = '5.7.1' + slf4jVersion = '1.7.33' } diff --git a/buildSrc/src/main/kotlin/CollectScreenShots.kt b/buildSrc/src/main/kotlin/CollectScreenShots.kt index c2c7ea804..d3d55c25b 100644 --- a/buildSrc/src/main/kotlin/CollectScreenShots.kt +++ b/buildSrc/src/main/kotlin/CollectScreenShots.kt @@ -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 } } } diff --git a/orx-jvm/orx-poisson-fill/build.gradle.kts b/orx-jvm/orx-poisson-fill/build.gradle.kts index 87d155661..db3b769b2 100644 --- a/orx-jvm/orx-poisson-fill/build.gradle.kts +++ b/orx-jvm/orx-poisson-fill/build.gradle.kts @@ -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) diff --git a/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill01.kt b/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill01.kt index 1ccb87013..5aa598744 100644 --- a/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill01.kt +++ b/orx-jvm/orx-poisson-fill/src/demo/kotlin/DemoPoissonFill01.kt @@ -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) {