AndroidDev-social / DodoForMastodon

๐Ÿ˜ Mastodon client for Android, iOS and Desktop (JVM)
GNU General Public License v3.0
384 stars 29 forks source link

Use JavaFX official Gradle Plugin #98

Closed mboukadir closed 1 year ago

mboukadir commented 1 year ago

๐Ÿ“‘ What does this PR do?

We use JavaFX Desktop WebView in the user login Path. The integration of JavaFX is done with the official Gradle plugin. However, we can't use it in the same module as the Android Library plugin.

Firstly, We have put a workaround that consists of manually adding the necessary JavaFX dependencies depending on the machine running the build. Besides, normally the plugin official does the same things.

val fxSuffix = when (osdetector.classifier) {
    "linux-x86_64" -> "linux"
    "linux-aarch_64" -> "linux-aarch64"
    "windows-x86_64" -> "win"
    "osx-x86_64" -> "mac"
    "osx-aarch_64" -> "mac-aarch64"
    else -> throw IllegalStateException("Unknown OS: ${osdetector.classifier}")
}

implementation("org.openjfx:javafx-base:19:${fxSuffix}")
implementation("org.openjfx:javafx-graphics:19:${fxSuffix}")
implementation("org.openjfx:javafx-controls:19:${fxSuffix}")
implementation("org.openjfx:javafx-web:19:${fxSuffix}")
implementation("org.openjfx:javafx-swing:19:${fxSuffix}")
implementation("org.openjfx:javafx-media:19:${fxSuffix}")

So now, in this PR, to use the official JavaFX Gradle plugin, I created a new pure JVM module with a composable Webview based on the JavaFX Webview.

โœ… Checklist

๐Ÿงช How can this PR been tested?

๐Ÿงพ Tasks Remaining: (List of tasks remaining to be implemented)

๐Ÿ–ผ๏ธ Screenshots (if applicable):