Code Monkey home page Code Monkey logo

cjfx-plugin's Introduction

Custom JavaFX Gradle Plugin

This plugin is used to manage and configure a JavaFX project quickly and reliably. In addition to supporting cross-platform compilation from the current platform.

Current version

cjfx-version = 1.1.0

How to use

It is currently only available for the Gradle build system. In order to use it, you must define the plugin within the project as follows:

Groovy DSL

plugins {
  id "io.github.uoxx3.cjfx" version "{cjfx-version}"
}

Kotlin DSL

plugins {
  id("io.github.uoxx3.cjfx") version "{cjfx-version}"
}

Plugin Settings

There are several ways to configure the plugin. The easiest way to do it is through the extension inside the "build.gradle" or "build.gradle.kts" file.

Groovy DSL

// Groovy & Kotlin DSL
Cjfx {
  version.set(/* Target JavaFX version */)
  platform.set(/* Target compilation platform */)
  architecture.set(/* Target compilation architecture */)

  modules.addAll(/* All javafx modules used */)
  dependencyConfigurations.addAll(/* All configurations where modules are used */)
}

Version configuration

Cjfx accepts both specific versions and dynamic versions. These dynamic versions are identified as they contain the '#' characters.

Custom version

// Groovy & Kotlin DSL
Cjfx {
  version.set("21")
}

Dynamic versions

// Groovy & Kotlin DSL
Cjfx {
  version.set("#latest#") // Get the latest stable version of JavaFX
}
// Groovy & Kotlin DSL
Cjfx {
  version.set("#early#") // Get the latest early access version of JavaFX
}
// Groovy & Kotlin DSL
Cjfx {
  version.set("#ea\\+\\d#") // You can also use regular expressions to determine the JavaFX version.
}

Platforms

By default, the plugin determines the current platform where the project is executed, but it is possible to specify the platform.

// Groovy & Kotlin DSL
Cjfx {
  platform.set(Uplatform.LINUX)
}

Architecture

By default, the plugin determines the current architecture where the project is executed, but it is possible to specify the architecture.

// Groovy & Kotlin DSL
Cjfx {
  architecture.set(UArchitecture.ARM)
}

Modules

By default, the plugin only includes the JavaFX Base module, and you need to specify the necessary modules.

// Groovy DSL
import uoxx3.cjfx.CjfxModule

Cjfx {
  var targetModules = [CjfxModule.CONTROLS, CjfxModule.FXML]
  modules.addAll(targetModules)
}
// Kotlin DSL
import uoxx3.cjfx.CjfxModule

Cjfx {
  val targetModules = listOf(CjfxModule.CONTROLS, CjfxModule.FXML)
  modules.addAll(targetModules)
}

If all modules are required, you can use the special option CjfxModule.ALL that uses all JavaFX modules.

CjfxModule.ALL == CjfxModule.[BASE, GRAPHICS, CONTROLS, FXML, MEDIA, SWING, WEB]

Dependency configurations

The dependency configuration determines where and how the JavaFX application or library will be compiled. By default, the plugin will assume that you are implementing the modules, but you can change this behavior easily:

// Groovy DSL
Cjfx {
  var configurations = ["compileOnly", "testCompileOnly"]

  dependencyConfiguration.clear()
  dependencyConfiguration.addAll(configurations)
}
// Kotlin DSL
Cjfx {
  val configurations = listOf("compileOnly", "testCompileOnly")

  dependencyConfiguration.clear()
  dependencyConfiguration.addAll(configurations)
}

Configuration using Gradle configuration

It can also be configured through the gradle.properties or cjfx.properties files as follows:

cjfx.configuration.version=#latest#
cjfx.configuration.platform=linux
cjfx.configuration.architecture=ARM
cjfx.configuration.modules=controls; graphics; fxml
cjfx.configuration.dependencyConfiguration=compileOnly; testCompileOnly; runtimeOnly

cjfx-plugin's People

Contributors

uoxx3 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.