11. Package the application - fakeivchenko/lwjwae GitHub Wiki
An executable is one file. People expect more: an entry in the menu of the system, with the icon, and an uninstaller. Build the installer of each platform around the executable.
-
In
build.gradle.kts, turn the packages on:lwjwae { displayName = "Notes" vendor = "Example <[email protected]>" packaging.all() } -
Build the packages that your operating system can make:
./gradlew packageAllThe plugin builds the native executable first, and puts the packages in
build/lwjwae/dist:On You get Linux notes_1.0.0_amd64.deb, which installs the executable, the menu entry, and the icon, and depends on the GTK and WebKitGTK packages.Linux notes-1.0.0-1-x86_64.pkg.tar.xz, whichpacman -Uinstalls on Arch Linux and the distributions based on it.Linux notes-1.0.0-x86_64.AppImage, one file that runs on any distribution with WebKitGTK.Windows notes-1.0.0.msi, which installs for the current user without administrator rights, adds a Start menu shortcut, and shows up in Settings > Apps with an uninstaller.macOS Notes.appandNotes-1.0.0.dmg.The first build on Linux downloads
appimagetoolinto the Gradle cache. The first build on Windows installs the WiX Toolset into it, which needs the .NET SDK. -
Install the package and find the application in the menu of the system:
sudo apt install ./build/lwjwae/dist/notes_1.0.0_amd64.debOn Windows, double-click the
.msifile.


To build only some of the formats, name them instead of all(), with the settings of each where
you have any:
lwjwae {
packaging {
homepage = "https://example.com"
deb()
msi { perUser = false }
}
}
perUser = false installs into Program Files for every user, and asks for administrator rights.
Each format also has its own task, such as packageDeb or packageMsi. See the
Gradle plugin for all of them, and the
Gradle plugin configuration for every setting of each format.
What's next
The guides go on from here, one feature at a time: objects through the bridge, several windows, menus, the clipboard, secrets, links of your own, updates, and a development server with hot reload, among others.
Previous: Build a native executable