mill icon indicating copy to clipboard operation
mill copied to clipboard

[WIP] Experiment with jpackage to create executable binaries

Open lefou opened this issue 1 year ago • 1 comments

Still in experimenting phase

Created a new module JpackageModule, which wraps around the jpackage tool, that's part of newer JDK releases and is used to produced native executables and distributable packages.

Although, there are some configuration points, in most cases, it should be as easy usable as assembly.

> mill show foo.jpackage
[1/1] show > [93/93] foo.jpackageAppImage 
".../out/foo/jpackageAppImage.dest/out/foo/bin/foo"

> file out/foo/jpackageAppImage.dest/image/foo/bin/foo
out/foo/jpackageAppImage.dest/out/foo/bin/foo: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, not stripped

lefou avatar Jun 06 '24 21:06 lefou

Based on https://dotnet.social/@fornever/112560707798240443, which points to https://fornever.me/en/posts/2024-06-05.scala-jpackage-publishing.html, I tried to implement a generic jpackage target that can produce self-contained executables for any JavaModule (or ScalaModule). This is a WIP PR just to see what works.

lefou avatar Jun 06 '24 21:06 lefou

Merged as part of https://github.com/com-lihaoyi/mill/pull/4038

lefou avatar Jan 05 '25 22:01 lefou