-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try native image then fallback to pure java version #717
Conversation
I like the fallback idea, though I wonder if we should move that fallback code directly into the |
A more complex fallback strategy sounds OK, we could define the rules clearly. And the main entrypoint well known is now |
Sounds good ! |
@gnodet do you mean add two new env:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd vote for evaluating the performance impact of wrapping mvnd
binary inside a shell script before merging this.
when change the native image names, the checking step of native can be replaced by a |
I wonder what is your goal here, @gzm55 ? You want to have single package installable and runnable on any host of any arch and OS combination? |
Goal:
|
I'd be fine with all of that as long as installing the native binary as the entry point stays possible. For performance reasons package managers like SDKMAN should still prefer doing that if a native client is available for the given platform. What do others think? |
we can use a env flag to force the entry script always use the native binary |
Hm... am I the only one thinking that the |
These changes seem to be addressing what I'd call install time concerns. Whether the given build of mvnd native executable can run on the current machine can be decided once at install time. Why do we need to run all those checks anew on every invocation of mvnd? |
Because we don't have any installer... ? In particular, people often just unzip the tarball / zip. |
how about we do a persist optimization at the real installing time for each package manager? almost every package manager has a post installing step, in which we can check via |
I think both proposals boil down to having a reusable piece of shell/PowerShell for linking/moving |
@ppalaga i add a post-install script |
1. rename native binary to 'mvnd-native-<os>-<arch>' 2. add environment switch MVND_ENTRY_FALLBACK, default 'true' enables the fallback logic, set to 'false' to force execute the native mvnd. 3. rename mvnd.sh to mvnd
@ppalaga I did some basic profiling, comparing to directly execute native binaries:
|
I'd dare to vote against making I'd be open to accepting the following alternatives that I think also satisfy the original original requirement of having a universal single entry mvnd:
What do others think? |
Hi @ppalaga , I would like to make this pr focus on the 1st point, implementing a proper fallback logic in the script entrypoint of the current file layout ( |
done in this pr
record in the issue #771 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks looks great! I left some minor comment text suggestions inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work, thanks a lot, @gzm55!
@@ -97,6 +97,7 @@ | |||
<include>mvnd</include> | |||
<include>mvnd.exe</include> | |||
</directory> | |||
<file touch="platform-${os.detected.name}-${os.detected.arch}"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the flag file is used to detect whether the bin/mvnd
is built for the current os and arch.
* Add script mvnd-auto to auto select native or pure java mvnd * Move fallback logic into main entry script 1. rename native binary to 'mvnd-native-<os>-<arch>' 2. add environment switch MVND_ENTRY_FALLBACK, default 'true' enables the fallback logic, set to 'false' to force execute the native mvnd. 3. rename mvnd.sh to mvnd * change entry name on windows * Add script mvnd-persist-native for moving the native image to the default entry path * improve platform detect * fix error on dash * rollback default entry to the native image * use MVND_CLIENT switch to control the selection of mvnd client * improve comment docs as suggestion
The new entry script does some light weight checking to select the first available one from:
To control the fallback logic, a new environment switch
MVND_CLIENT
is added. Defaultauto
enables the fallback logic, set tonative
orjvm
to force select the native image or pure java version.Checking of native image is mainly based on the file name, and on Linux, there is another
ldd
check to ensure glibc version is OK.