-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8237467: jlink plugin to save the argument files as input to jlink in the output image #10445
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
Conversation
|
👋 Welcome back dnsimon! A progress list of the required criteria for merging this PR into |
|
/reviewer @mlchung |
|
@dougxc Syntax:
|
0b1cecb to
583981a
Compare
Webrevs
|
| @@ -0,0 +1,171 @@ | |||
| /* | |||
| * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. | |||
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.
This is a new file and so I would just have the copyright start year.
| /** | ||
| * Various utility methods for processing Java tool command line arguments. | ||
| * | ||
| * <p><b>This is NOT part of any supported API. |
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.
This note was prior to module system. We could drop this comment since it's encapsulated and it's not an exported package.
| } | ||
| Path outputPath = null; | ||
| try { | ||
| try (InputStream savedOptions = JlinkTask.class.getModule().getResourceAsStream("jdk/tools/jlink/internal/options")) { |
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.
nit: wrap this long line that helps future side-by-side review.
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.
Nit: define a static variable for this resource file name jdk/tools/jlink/internal/options that the plugin can use.
| try { | ||
| try (InputStream savedOptions = JlinkTask.class.getModule().getResourceAsStream("jdk/tools/jlink/internal/options")) { | ||
| if (savedOptions != null) { | ||
| List<String> newArgs = new ArrayList<>(); |
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.
s/newArgs/prependArgs/ to make it clearer.
| @Override | ||
| public ResourcePool transform(ResourcePool in, ResourcePoolBuilder out) { | ||
| in.transformAndCopy(Function.identity(), out); | ||
| byte[] savedOptions = argfiles.stream(). |
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.
Formatting consistent with jlink files:
| byte[] savedOptions = argfiles.stream(). | |
| byte[] savedOptions = argfiles.stream() | |
| .collect(Collectors.joining("\n")) | |
| .getBytes(StandardCharsets.UTF_8); |
|
|
||
| // Check that the primary image creation ignored the saved args | ||
| oa.shouldHaveExitValue(0); | ||
| oa.shouldNotMatch("yzzy"); |
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.
Can this check for java.vendor.version = XyzzyVM 3.14.15, that will also help the reader to understand what the test tries to verify.
| launcher = image2.resolve(Path.of("bin", "java" + exe)); | ||
| oa = ProcessTools.executeProcess(launcher.toString(), "-XshowSettings:properties", "--version"); | ||
| oa.shouldHaveExitValue(0); | ||
| expectNMatchingLines(oa.getStdout(), "yzzy", 2); |
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.
Same for line 94-95: check for java.vendor.version = XyzzyVM 3.14.15 instead
|
/csr |
|
@mlchung has indicated that a compatibility and specification (CSR) request is needed for this pull request. @dougxc please create a CSR request for issue JDK-8237467 with the correct fix version. This pull request cannot be integrated until the CSR request is approved. |
|
@dougxc Please do not rebase or force-push to an active PR as it invalidates existing review comments. All changes will be squashed into a single commit automatically when integrating. See OpenJDK Developers’ Guide for more information. |
| throw new AssertionError(); | ||
|
|
||
| for (String argfile : v.split(File.pathSeparator)) { | ||
| argfiles.add(readArgfile(argfile)); |
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.
This plugin should validate if jdk.jlink is linked in the resulting image; if not, it should throw an exception.
Otherwise, looks good.
mlchung
left a comment
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.
Looks good.
|
@dougxc This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be: You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 68 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. ➡️ To integrate this PR with the above commit message to the |
|
/integrate |
|
Thanks for the reviews @mlchung ! |
|
Going to push as commit 4f44fd6.
Your commit was automatically rebased without conflicts. |
This PR adds a new jlink plugin (
--save-jlink-argfiles=<filenames>) to support persisting jlink options.Progress
Issues
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10445/head:pull/10445$ git checkout pull/10445Update a local copy of the PR:
$ git checkout pull/10445$ git pull https://git.openjdk.org/jdk pull/10445/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 10445View PR using the GUI difftool:
$ git pr show -t 10445Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10445.diff