openjfx / javafx-gradle-plugin

Gradle plugin that makes it easy to work with JavaFX 11+
https://openjfx.io/
BSD 3-Clause "New" or "Revised" License
349 stars 62 forks source link

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

Open Sporking opened 5 years ago

Sporking commented 5 years ago

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.

Jan5366x commented 5 years ago

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

johanvos commented 5 years ago

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.

Jan5366x commented 5 years ago

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

But here it is:

33

xeruf commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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