-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8333727: Use JOpt in jpackage to parse command line #28163
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
base: master
Are you sure you want to change the base?
8333727: Use JOpt in jpackage to parse command line #28163
Conversation
…ix PackagingPipeline, *Bundler and StandardBundlerParam.getDefaultAppVersion accordingly
|
👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
e64de62 to
26b0758
Compare
|
@alexeysemenyukoracle The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
db70105 to
9dc9557
Compare
9dc9557 to
2d975de
Compare
|
@alexeysemenyukoracle Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
Webrevs
|
|
/issue add 8371384 |
|
@alexeysemenyukoracle |
|
@sashamatveev PTAL |
2d975de to
fde4f4b
Compare
|
@alexeysemenyukoracle Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
…ObjectMapper in tests. Change signature of AppImageFile.load(Path appImageDir, ApplicationLayout appLayout) to AppImageFile.load(ApplicationLayout appLayout), appImageDir parameter is redundant.
…Resources.properties: remove unused IDs
090a6d1 to
da39bcc
Compare
|
@alexeysemenyukoracle Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
…dd-launcher" option by OS
50fac77 to
cbf2f57
Compare
cbf2f57 to
0448168
Compare
|
@alexeysemenyukoracle Please do not rebase or force-push to an active PR as it invalidates existing review comments. Note for future reference, the bots always squash all changes into a single commit automatically as part of the integration. See OpenJDK Developers’ Guide for more information. |
sashamatveev
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 with some comments.
src/jdk.jpackage/macosx/classes/jdk/jpackage/internal/MacBundlingEnvironment.java
Show resolved
Hide resolved
src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/HelpFormatter.java
Outdated
Show resolved
Hide resolved
src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/JOptSimpleOptionsBuilder.java
Show resolved
Hide resolved
src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java
Outdated
Show resolved
Hide resolved
src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardOption.java
Outdated
Show resolved
Hide resolved
src/jdk.jpackage/share/classes/jdk/jpackage/internal/cli/StandardValidator.java
Outdated
Show resolved
Hide resolved
...dk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/StandardOptionTest.java
Outdated
Show resolved
Hide resolved
...dk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/StandardOptionTest.java
Outdated
Show resolved
Hide resolved
Can you explain more on this one? I did not figure out how synchronization issue was fixed and what was issue with original implementation. |
|
There were a few synchronization issues with jpackage. The major one was the use of static member fields throughout the codebase. Andy attempted to fix it with JDK-8223322, but due to other synchronization issues, the fix for JDK-8223322 #1829 was never integrated. Instead, he applied a smaller-scope fix JDK-8259238 that fixed the use of static member fields. However, the "synchronized" keyword in JPackageToolProvider.java was still in place. I don't know what the intent of this "synchronized" is. It doesn't apply to a global object but to the instance of the "jdk.jpackage.internal.JPackageToolProvider" class. Looks like the assumption was that the system would create only a single instance of a specific tool provider. There is no such guarantee, though. If multiple instances of the "jdk.jpackage.internal.JPackageToolProvider" class are created and used asynchronously, the "synchronized" keyword doesn't do what it is supposed to. The new tool provider implementation in the "jdk.jpackage.internal.cli.Main" class doesn't use "synchronized" keyword. Command-line parsing code doesn't use global variables; it is thread-safe by design, rather than having thread safety as a patch. |
|
Pushed commits addressing all findings in the review.
|
Use "JOpt Simple" from jdk.internal.joptsimple package to parse jpackage command line.
All command-line parsing code is placed in a new "jdk.jpackage.internal.cli" package with 92% unit test coverage.
Error reporting improved
Command line (Windows):
Old error output:
New error output:
Command line (Windows):
Old error output:
New error output:
Help output fixed
Options in the original help output were out of order. On macOS, options were placed in wrong sections. There were trailing whitespaces.
The old help output is captured in the cd7bca2 commit.
The reordered and filtered old help output is captured in the 10dc379 commit.
Help output in this PR is captured in the 58c2d94 commit. Use it to see the diff between the new and old filtered and reordered help output.
Functional changes
Old tool provider implementation jdk.jpackage.internal.JPackageToolProvider had lousy thread-safety protection that didn't work when multiple instances of jpackage tool provider are created and invoked asynchronously. This patch fixes this issue. It is safe to invoke the same jpackage tool provider instance asynchronously, and also safe to invoke multiple instances of jpackage tool provider.
Like other JDK tools, jpackage will print help output if the
-?option is specified on the command line.In addition to
--option-name <value>variant to set option value, supports--option-name=<value>,-option-name=<value>,-option-name <value>variants - courtesy of jdk.internal.joptsimple package.Misc
All "params"-specific code removed.
Replaced the checked PackagerException exception with the new unchecked JPackageException exception. Converted ConfigException to an unchecked exception.
The format of the
.jpackage.xmlfile has changed:@nameattribute of the/jpackage-state/main-launcherelement./jpackage-stateelement with the values of the main launcher properties are stored as child elements of the/jpackage-state/main-launcherelement./jpackage-state/add-launcher/serviceelement instead of the value of the/jpackage-state/add-launcher/@serviceattribute.Changes to the format of the
.jpackage.xmlfile are to simplify handling of properties of additional and the main launcher.Autogenerated summary of all recognized options (jdk/test/jdk/tools/jpackage/junit/share/jdk.jpackage/jdk/jpackage/internal/cli/jpackage-options.md).
Fixes JDK-8371384 as a side effect.
Testing
The same testing as in the #19668 PR. Additionally, verified no unexpected diffs in the test logs after running all jpackage tests.
Progress
Issues
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/28163/head:pull/28163$ git checkout pull/28163Update a local copy of the PR:
$ git checkout pull/28163$ git pull https://git.openjdk.org/jdk.git pull/28163/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 28163View PR using the GUI difftool:
$ git pr show -t 28163Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/28163.diff
Using Webrev
Link to Webrev Comment