This is an automated email from the ASF dual-hosted git repository.

vladimirsitnikov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 80616d2  Compile RenderInBrowser when javafx.application.Platform is 
present at the build time
80616d2 is described below

commit 80616d28bd4340cdd8ee8ecfe1c98d2687963d86
Author: Vladimir Sitnikov <[email protected]>
AuthorDate: Sat Oct 26 16:59:50 2019 +0300

    Compile RenderInBrowser when javafx.application.Platform is present at the 
build time
---
 src/components/build.gradle.kts | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/components/build.gradle.kts b/src/components/build.gradle.kts
index ec467a8..f54129b 100644
--- a/src/components/build.gradle.kts
+++ b/src/components/build.gradle.kts
@@ -82,12 +82,20 @@ fun String?.toBool(nullAs: Boolean, blankAs: Boolean, 
default: Boolean) =
         else -> equals("true", ignoreCase = true)
     }
 
+fun classExists(name: String) =
+    try {
+        Class.forName(name)
+        true
+    } catch(e: Throwable) {
+        false
+    }
+
 if (!(project.findProperty("enableJavaFx") as? String)
-        .toBool(nullAs = false, blankAs = true, default = false)
+        .toBool(nullAs = classExists("javafx.application.Platform"), blankAs = 
true, default = false)
 ) {
     // JavaFX is not present in Maven Central, so exclude the file unless 
explicitly asked by
     // -PenableJavaFx
-    logger.debug("RenderInBrowser is excluded from compilation. If you want to 
compile it, add -PenableJavaFx")
+    logger.lifecycle("RenderInBrowser is excluded from compilation. If you 
want to compile it, add -PenableJavaFx")
     sourceSets {
         main {
             java {

Reply via email to