A collection of Gradle plugins for building applications and libraries using Kotlin.
These plugins all target Kotlin 2.4.0 and Java 21 (for Kotlin libraries), Java 25 (for Kotlin apps) and Java 17 (for Gradle plugins). 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.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.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.Supports JVM versions 11-26.
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 25application.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.desktopNative() - adds Windows, Linux, and macOS as targetsapplication.macOS() - adds macOS as a targetapplication.common { } - production dependencies common to all targetsapplication.test { } - test dependencies common to all targetslibrary { } block
library.jvm { } - adds the JVM as a target with the given settings (same as JVM library above)library.desktopNative() - adds Windows, Linux, and macOS as targetslibrary.macOS() - adds macOS as a targetlibrary.browser() - adds the browser as a targetlibrary.common { } - production dependencies common to all targetslibrary.test { } - test dependencies common to all targets$APP_SIGNING_IDENTITY - signing certificate name in macOS keychain. Should reference a “Developer ID Application” certificate$APP_NOTARIZATION_PROFILE - notarization profile in macOS keychain.
xcrun notarytool store-credentials
notary.tool.saved-creds in keychain, the profile name is the last segment of the account nameSee ../test-apps for some samples.