Or, asked another way, is there a reference projec...
# tornadofx
g
Or, asked another way, is there a reference project, gradle based, that has the most up-to-date open JDK+JFX+Tornado?
a
You can use my demo-project: https://github.com/altavir/fx-demo. It is not the most up to date, but it works both for JVM 8 and JVM 9+. Sadly, as always with openjfx plugin, it will work only on the same platform you build it on.
👍 1
m
I didn't know you could do conditional plugins
Copy code
if(JavaVersion.current().isJava11Compatible) {
        id("org.openjfx.javafxplugin") version "0.0.8"
    }
I was wondering how you dealt with FX not included in Java 9+
a
You just download it from maven. The problem is the postfix should be chosen based on the target platform, not the one you develop in. The solution is to use compile-only dependency an then create a start-script that downlowads necessary jmods. Sadly, I hata bash and never got to actually writing it.
m
I meant, for JDK8 you don't use that plugin and you don't specify "openjfx" section among others but in your build you use conditionals to handle it
a
yep.
openjfx won't work for Java8. More importantly, it will crush the build
m
I did run across a gradle plugin that will bootstrap JDK, download the JDK version and everything by creating custom gradlew files
a
I do not think it makes and sense. I was talking about application start scripts. We can manage to create development environment, but user environment on the target machine is a different topic.
m
I use the "badass runtime" plugin that downloads the jdk for each target platform and creates a zip that packages the runtime and your app for each platform, it only works with JDK9+ though
a
It won't help you with javafx, because you need custom jafaFX jmods as well.
m
for distributing to users I've started using jpackage and building on each platform which works the best in my opinion
it works fine with javafx
I build mac and windows builds for my coworkers from my linux machine
a
I mean you still need to build on each platform
m
not if you do the runtime zip
a
It has some kind of customization for openjfx? Because otherwise, only JVM itself will be platform-specific
m
you can specify javafx platform in dependencies:
Copy code
// Include java fx libraries for each platform
    runtimeOnly 'org.openjfx:javafx-graphics:$javafx.version:linux'
    runtimeOnly 'org.openjfx:javafx-graphics:$javafx.version:win'
    runtimeOnly 'org.openjfx:javafx-graphics:$javafx.version:mac'
I haven't looked to see if the badass runtime plugin only includes the target platform when it creates the runtime zip
Looks like it includes a number of platform specific files
Looks like he specifies the platform javafx files like this:
Copy code
JavaFXPlatform.values().forEach {platform ->
        val cfg = configurations.create("javafx_" + platform.classifier)
        JavaFXModule.getJavaFXModules(javaFXOptions.modules).forEach { m ->
            project.getDependencies().add(cfg.name,
                    String.format("org.openjfx:%s:%s:%s", m.getArtifactName(), javaFXOptions.version, platform.classifier));
        }
    }
s
@geepawhill I have this I use: https://github.com/SKeeneCode/TornadoFX-Template Javafx 15, Kotlin 1.4.10, gradle 6.6.1, TornadoFX 2.0 Snapshot and 0.0.9 plugin... haven't looked at in a month so might need something changed.
g
Oh, that's nice! That will catch me up quite well. Thanks, Sam, I'll give it a try in the next few days and get back to you.