javafx-gradle-plugin icon indicating copy to clipboard operation
javafx-gradle-plugin copied to clipboard

Please provide all Gradle scripts in both syntaxes (Groovy and Kotlin DSL)

Open Sporking opened this issue 6 years ago • 6 comments

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.

Sporking avatar Nov 30 '18 23:11 Sporking

Any update on this yet? The usage under Kotlin DSL is very unclear!

Jan5366x avatar Mar 10 '19 18:03 Jan5366x

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.

johanvos avatar Mar 10 '19 18:03 johanvos

While writing the last post I hadn't figured it out yet.

But here it is: #33

Jan5366x avatar Mar 10 '19 20:03 Jan5366x

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

xeruf avatar Feb 06 '23 22:02 xeruf

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...

xeruf avatar Feb 06 '23 23:02 xeruf

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"))

xeruf avatar Feb 06 '23 23:02 xeruf