Skip to content

[#502] - Add prefix to zip entries #503

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

YaSuenag
Copy link
Contributor

I would like to introduce zipDirPrefix to add prefix to zip entries. See #502 for details.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a GitHub issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a GitHub issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [#<num>] - Fixes bug in ApproximateQuantiles,
    where you replace #<num> with the appropriate GitHub issue. Best practice
    is to use the GitHub issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its clean verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

YaSuenag added a commit to YaSuenag/perfreader that referenced this pull request Feb 11, 2025
Requires maven-jlink-plugin 3.2.1-SNAPSHOT with apache/maven-jlink-plugin#503
@elharo elharo requested a review from bmarwell February 23, 2025 13:35
Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but is there any way you could add an integration test that actually runs a jlinked image with a prefix?

@YaSuenag
Copy link
Contributor Author

@elharo
Thanks for your review!

I updated testcase to extract ZIP which contains prefix, and execute the launcher. It works fine on Linux, but it might not work on Windows because the ZIP would be extracted by unzip utility. It might be better if we can run this test on Linux only, but I don't know how should I configure that.

@YaSuenag
Copy link
Contributor Author

All of tests on Windows were hanged due to new tests for this PR. I think the cause of the hang is unzip command is unavailable on Windows GHA runner or the test did not add extention (.bat) in Windows.

I tweaked a testcase in the latest commit, and it works fine on both Ubuntu 24 and Windows 11. Could you approve to run the workflow? I believe it works fine.

Copy link
Contributor

@bmarwell bmarwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except for docs, looks good to me.

@@ -368,6 +368,14 @@ public class JLinkMojo extends AbstractJLinkMojo {
@Parameter
private List<Resource> additionalResources;

/**
* Add prefix to all of zip entries. It would be treated as a directory if the prefix ends with "/".
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment needs clarification, as it goes into the docs (site).

  • If it does not end with /, what will happen?
  • Isn't the prefix always supposed to be a directory?
  • What does the default do (explain to users)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the prefix always supposed to be a directory?

Yes, I think so because if the prefix does not have "/" in its tail, it breaks JDK directory structure - it means any launcher and java command in bin directory would not work. I will fix, and clarify Javadoc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmarwell
I fixed docs, and always treats this value as a directory. Could you review again?

Comment on lines +20 to +21
module com.corporate.project {
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably doesn't matter, but maybe we can find another example module

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain details of your comment?

This testcase creates launcher as following:

<launcher>helloworld=com.corporate.project/com.corporate.project.HelloWorld</launcher>

I think the app should be modulalized for --launcher option in jlink. So I think module-info.java is necessary for this test.

@YaSuenag
Copy link
Contributor Author

Do you have any comments?
I believe this feature is useful for developers who want to package artifacts in jlink phase at once.

Comments are welcome. I can work for them if needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants