Open Sporking opened 5 years ago
Any update on this yet? The usage under Kotlin DSL is very unclear!
This is a community project. If you want to add functionality or documentation, you are very welcome to create a PR so that others can review it, and improve the project.
While writing the last post I hadn't figured it out yet.
But here it is:
This should be closed I guess?
Although I am unable to use it like that:
* What went wrong:
Script compilation errors:
Line 17: javafx {
^ Unresolved reference: javafx
Line 18: modules("javafx.controls", "javafx.fxml")
^ Unresolved reference: modules
This works
println(project.extensions.get("javafx"))
And prints javafx extension.
But I cannot import org.openjfx.gradle.JavaFXPlugin according to https://github.com/openjfx/javafx-gradle-plugin/blob/master/src/main/java/org/openjfx/gradle/JavaFXPlugin.java...
This is the only way I got it to work for now:
val jfx = project.extensions.get("javafx")
jfx::class.functions.first { it.name.endsWith("modules") }.call(jfx, arrayOf("javafx.base", "javafx.controls"))
Additionally, the current README says multiple configurations in Kotlin are set like this
configurations("implementation", "testImplementation")
But you have to do this instead:
configurations = arrayOf("implementation", "testImplementation")
The Kotlin DSL for Gradle has been fairly recently introduced. Nonetheless, it is already the default syntax for use for Android development. Having to translate example code from Groovy syntax to Kotlin syntax causes potential users of your plugin to have one additional potential source of errors and misunderstandings when trying to use the plugin.
Please provide each Gradle code samples in both syntaxes, to make it unnecessary for a potential user to have to translate one syntax to the other.
See this JavaFX bug report for more context on this request.