maciejwalkowiak / just

Magical 🪄 command line toolkit for developing 🍃 Spring Boot apps
312 stars 6 forks source link

Build as statically linked executable to enable using on older versions of Linux #10

Open maciejwalkowiak opened 1 year ago

maciejwalkowiak commented 1 year ago

When running on Linux, Just requires gclib 2.34 - which comes with Ubuntu 22.04 but not with 18.x or 20.x.

There is a way to build a static native executable that comes with bundled gclib:

https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/

jvalkeal commented 1 year ago

You're probably building on gh-actions, which should give you relatively easy way to use musl like we've done in spring-shell sample app for e2e tests https://github.com/spring-projects/spring-shell/blob/main/.github/workflows/e2e.yml. You just need to massage build(assume you're on gradle) as things go south if given to win/macos build. graalvm/setup-graalvm makes it relatively easy to do musl compile.

If you do things from gradle then it's something like https://github.com/spring-projects/spring-shell/blob/206da7463b0d7911ec802246f1f516779502d2d9/spring-shell-samples/spring-shell-samples.gradle#L27-L39 to conditionally add flags.

Just wanted to throw out these tips!

maciejwalkowiak commented 1 year ago

Thanks a lot @jvalkeal. I'll give it a deeper look after holidays!