A collection of Gradle plugins for building applications and libraries using Kotlin.
These plugins all target Kotlin 2.3.10 and Java 17 (for Kotlin/JVM libraries and Gradle plugins) or Java 21 (for Kotlin/JVM apps). The plugins require Gradle 9.0 or later and Java 17 or later.
net.rubygrapefruit.kotlin-baseA settings plugin that must be applied to the settings of any build that uses these plugins.
net.rubygrapefruit.native.desktop-libBuilds a library implemented in Kotlin multiplatform that targets native desktop platforms.
unixMain and unixTest source sets for Kotlin code that is shared by macOS and Linux targets.library { } block.net.rubygrapefruit.native.cli-appBuilds a command-line application implemented in Kotlin multiplatform that targets native desktop platforms.
unixMain and unixTest source sets for Kotlin code that is shared by macOS and Linux targets.application { } block, see below for the available settings.dist and install tasks.This uses the net.rubygrapefruit.native.base-cli-app plugin and adds the targets.
net.rubygrapefruit.native.ui-appBuilds a UI application implemented in Kotlin multiplatform that targets native desktop platforms.
application { } block, see below for the available settings.dist task.net.rubygrapefruit.native.base-cli-appBuilds a command-line application implemented in Kotlin multiplatform. Does not define any targets, these have to be explicitly defined.
net.rubygrapefruit.kmp.libBuilds a library implemented in Kotlin multiplatform that targets the JVM, browser and native desktop platforms.
library { } block, see below for the available settings.unixMain and unixTest source sets for Kotlin code that is shared by macOS and Linux targets.desktopMain and desktopTest source sets for Kotlin code that is shared by JVM, macOS, Linux and Windows targets.module-info for the JVM target.This uses the net.rubygrapefruit.kmp.base-lib plugin and adds the targets.
net.rubygrapefruit.kmp.base-libBuilds a library implemented in Kotlin multiplatform. Does not define any targets, these have to be explicitly defined.
net.rubygrapefruit.jvm.libBuilds a library implemented using Kotlin/JVM.
library { } block, see below for the available settings.module-info.net.rubygrapefruit.jvm.cli-appBuilds a command-line application implemented using Kotlin/JVM. Expects that the application uses the JVM module system.
$PATH, unless one of the plugin below is also used.$JVM_DEBUG is set to a non-empty stringapplication { } block, see below for the available settings.module-info.dist and install tasks.net.rubygrapefruit.jvm.embedded-jvmCan be applied with net.rubygrapefruit.jvm.cli-app to include a copy of the JVM in the application distribution.
The launcher script uses this embedded JVM. Uses jlink to create the JVM image.
net.rubygrapefruit.jvm.native-binaryCan be applied with net.rubygrapefruit.jvm.cli-app to create a native binary to use in the application distribution,
instead of using a launcher script. Uses graalvm to create the native binary.
net.rubygrapefruit.jvm.ui-appBuilds a desktop UI application implemented using Kotlin/JVM and that presents a Swing or JavaFX UI. Expects that the application uses the JVM module system.
src/main/Icon1024.pngapplication { } block, see below for the available settings.dist task to build the debug application bundle.net.rubygrapefruit.gradle-pluginA convention plugin for implementing Gradle plugins using Kotlin/JVM.
versions extensionpluginBundle { } block.application { } block
application.appName - the base name for the application, used for various default file names.application.distribution.imageDirectory - the directory to create the distribution image in.dist task to create a distribution image containing the app ready for installation.
By default, this is created in build/dist-imageapplication { } block
application.mainClass - defaults to main class determined by inspecting the bytecodeapplication.module.name - defaults to the application nameapplication.targetJvmVersion - defaults to 17application.dependencies { } - production dependenciesapplication.test { } - test dependencieslibrary { } block
library.module.name - defaults to the project namelibrary.module.exportslibrary.module.requires - calculated from compile (implementation) dependencieslibrary.module.requiresTransitive - calculated from the API dependencieslibrary.targetJvmVersion - defaults to 17library.dependencies { } - production dependencieslibrary.test { } - test dependenciesapplication { } block
application.common { } - production dependencies common to all targetsapplication.test { } - test dependencies common to all targetslibrary { } block
library.jvm { } - JVM target settings (same as JVM library above)library.common { } - production dependencies common to all targetslibrary.test { } - test dependencies common to all targetsSee ../test-apps for some samples.