Skip to content

Gradle build scripts for "empty" example application#311

Closed
chirontt wants to merge 1 commit into
HumbleUI:mainfrom
chirontt:empty_gradle_scripts
Closed

Gradle build scripts for "empty" example application#311
chirontt wants to merge 1 commit into
HumbleUI:mainfrom
chirontt:empty_gradle_scripts

Conversation

@chirontt

@chirontt chirontt commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

... especially to produce "empty" native image by GraalVM.

Caveat: I haven't tested it on Mac platforms. Please try it on a Mac to see if it works.

Below is the README.md text:

Gradle build scripts for empty example application

This directory contains Gradle scripts to build the empty example application, especially to produce a native image of the application using the GraalVM tool.

The scripts assume you already have the Gradle build tool installed and is available in the path. Standard Gradle commands can then be used to build the empty application, such as:

  • gradle run: compile and run the application
  • gradle jar: generate the application's jar file in build/libs/ directory
  • etc.

By default, the locally-compiled JWM classes are used as dependencies to compile the empty application. To use a published JWM version in Maven repository, specify the -PjwmVersion=... option in the Gradle commands, e.g.

  • gradle run -PjwmVersion=0.4.25: compile and run the application with JWM 0.4.25 version published in Maven repository
  • etc.

All of the above build commands would work on all platforms supported by JWM.

Especially the scripts make use of the latest Gradle native image plugin to generate the empty-native executable for current platform, as detailed below.

Building empty native image

Prerequisites

A GraalVM JDK 25+ distribution is required to be installed and is available in the system, e.g. from Oracle release, or from a GraalVM Community distribution or from a Liberica Native Image Kit release, with the JAVA_HOME environment variable pointing to the installation and its bin directory be added to the path. More detailed installing info for various OSes is here.

A C compiler for the current platform is also required to produce the native image executable. Detailed setup info is available here.

Building native image

First, the native image metadata for the empty application need be generated, by running the application with the -Pagent option:

gradle run -Pagent

Use and interact with the running empty application as per normal, then close it.

Then generate its native image with the command:

gradle nativeCompile

The resulting native image will be produced in the build/native/nativeCompile/ directory, and can be executed directly:

./build/native/nativeCompile/empty-native

or in Windows:

build\native\nativeCompile\empty-native.exe

Supported platforms

The empty native images can be produced on platforms supported by GraalVM, namely:

  • Linux x64/arm64,
  • MacOS x64/arm64 (but the x64 support is removed in GraalVM 25.0.2+),
  • Windows x64.

especially to produce "empty" native image by GraalVM.
@tonsky

tonsky commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

Thanks! macOS doesn't work but looks like for reasons unrelated to this change. Will investigate later. Windows did work for me!

@tonsky

tonsky commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

This is merged as ae145dc, not sure why Github didn't pick it up

@tonsky tonsky closed this Jun 28, 2026
@tonsky

tonsky commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Works after b6e8664

@chirontt
chirontt deleted the empty_gradle_scripts branch June 29, 2026 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants