Skip to content

Conversation

@alexeysemenyukoracle
Copy link
Member

@alexeysemenyukoracle alexeysemenyukoracle commented Jun 12, 2024

Refactor jpackage to separate the configuration and execution phases.
At the configuration phase, jpackage parses command-line arguments and validates them.
At the execution phase, jpackage builds a bundle based on data collected at the configuration phase.

There was no clear separation between these phases. Both used the same data type (Map<String, Object>), making it hard to understand and use properly.

This change introduces data model to jpackage (classes in "jdk.jpackage.internal.model" package). The output of the configuration phase is either an instance of jdk.jpackage.internal.model.Application interface for app image bundling or jdk.jpackage.internal.model.Package for native package bundling.

The execution phase has been reworked to get configuration properties from the new jdk.jpackage.internal.model.Application and jdk.jpackage.internal.model.Package interfaces instead of extracting data from Map<String, Object> "params".

Additionally, a notion of "packaging pipeline" (jdk.jpackage.internal.PackagingPipeline class) was added to configure packaging declaratively with more code sharing between bundlers.

jdk.jpackage module javadoc - https://alexeysemenyukoracle.github.io/jpackage-javadoc/jdk.jpackage/module-summary.html

Functional changes
jpackage behavior 99% remains the same, i.e., it produces the same bundles for the given parameters. This change affects only the implementation. Still, there are some changes in jpackage behavior. They are outlined below.

  • Minimize copying of the source app image when doing native packaging.

Before this change, native package bundlers made redundant copies of the source app image. E.g., msi and linux package bundlers copied the external app image (the one specified with --app-image parameter); linux package bundlers always transformed the source app image if the installation directory was in the "/usr" tree (--install-dir /usr). This change eliminates all redundant app image copy/transformations.

  • PKG bundler: change "preinstall" and "postinstall" scripts in app bundles.

post- and pre- install PKG scripts for SimplePackageTest package before and after the change:

Script New Old
preinstall
#!/usr/bin/env sh
if [ ! -d "/Applications/SimplePackageTest.app" ] then mkdir -p "/Applications/SimplePackageTest.app" fi
exit 0
#!/usr/bin/env sh
if [ ! -d "/Applications" ] then mkdir -p "/Applications" fi
exit 0
postinstall
#!/usr/bin/env sh
chown root:wheel "/Applications/SimplePackageTest.app" chmod a+rX "/Applications/SimplePackageTest.app" chmod +r "/Applications/SimplePackageTest.app/Contents/app/"*.jar
exit 0
#!/usr/bin/env sh
chown root:wheel "/Applications" chmod a+rX "/Applications" chmod +r "/Applications/SimplePackageTest.app/Contents/app/"*.jar
exit 0

This change relates to the JDK-8356047 issue. Although the scripts are different, they are functionally identical (they don't change anything in the system).

  • PKG bundler: no "postinstall" and "preinstall" scripts in runtime bundles.

jpackage will not create post- and pre- install scripts in runtime PKGs. This doesn't make a difference as runtime bundling on macOS is currently broken, see JDK-8351073 issue.

  • macOS signing.

Use java.security.cert.X509Certificate class to parse the signing certificates data instead of "/usr/bin/openssl" invocations.

To identify the certificate unambiguously, the certificate's SHA1 hash is passed as a value of the "-s" parameter for codesign instead of the certificate name.

Testing
With these significant code changes, ensuring that jpackage still produces packages with the same properties for the given input was essential.

jpackage uses external tools for building packages, supplying them with the configuration files. Assuming that a packaging tool would produce the same package for the given configuration files, these configuration files created by the "old" jpackage and the "new" jpackage in every jpackage test were examined and verified for no substantial differences. ConfigFilesStasher.java and clean_stashed_files.sh tools served this purpose. Thanks to this way to test jpackage, JDK-8356219 was uncovered.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8333664: Decouple command line parsing and package building in jpackage (Enhancement - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/19668/head:pull/19668
$ git checkout pull/19668

Update a local copy of the PR:
$ git checkout pull/19668
$ git pull https://git.openjdk.org/jdk.git pull/19668/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 19668

View PR using the GUI difftool:
$ git pr show -t 19668

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/19668.diff

Using Webrev

Link to Webrev Comment

@alexeysemenyukoracle alexeysemenyukoracle marked this pull request as draft June 12, 2024 01:37
@bridgekeeper
Copy link

bridgekeeper bot commented Jun 12, 2024

👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jun 12, 2024

@alexeysemenyukoracle 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:

8333664: Decouple command line parsing and package building in jpackage

Reviewed-by: almatvee

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 117 new commits pushed to the master branch:

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 master branch, type /integrate in a new comment.

@openjdk
Copy link

openjdk bot commented Jun 12, 2024

@alexeysemenyukoracle The following label will be automatically applied to this pull request:

  • core-libs

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.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jun 12, 2024
@openjdk
Copy link

openjdk bot commented Jun 13, 2024

@alexeysemenyukoracle this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8333664
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Jun 13, 2024
@openjdk
Copy link

openjdk bot commented Jun 28, 2024

⚠️ @alexeysemenyukoracle This pull request contains merges that bring in commits not present in the target repository. Since this is not a "merge style" pull request, these changes will be squashed when this pull request in integrated. If this is your intention, then please ignore this message. If you want to preserve the commit structure, you must change the title of this pull request to Merge <project>:<branch> where <project> is the name of another project in the OpenJDK organization (for example Merge jdk:master).

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 23, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@alexeysemenyukoracle
Copy link
Member Author

keep the PR open

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 18, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Oct 29, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

2 similar comments
@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 31, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 8 weeks and will be automatically closed if another 8 weeks passes without any activity. To avoid this, simply add a new comment to the pull request. Feel free to ask for assistance if you need help with progressing this pull request towards integration!

@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Nov 1, 2024
@openjdk openjdk bot added merge-conflict Pull request has merge conflict with target branch and removed merge-conflict Pull request has merge conflict with target branch labels Nov 19, 2024
@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Dec 5, 2024
@bridgekeeper
Copy link

bridgekeeper bot commented Dec 26, 2024

@alexeysemenyukoracle This pull request has been inactive for more than 16 weeks and will now be automatically closed. If you would like to continue working on this pull request in the future, feel free to reopen it! This can be done using the /open pull request command.

@bridgekeeper bridgekeeper bot closed this Dec 26, 2024
@alexeysemenyukoracle
Copy link
Member Author

keep it open

@alexeysemenyukoracle
Copy link
Member Author

/open

@openjdk openjdk bot reopened this Dec 27, 2024
@openjdk
Copy link

openjdk bot commented Dec 27, 2024

@alexeysemenyukoracle This pull request is now open

@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Dec 30, 2024
@openjdk openjdk bot added the rfr Pull request is ready for review label May 9, 2025
@alexeysemenyukoracle
Copy link
Member Author

@sashamatveev PTAL

@mlbridge
Copy link

mlbridge bot commented May 9, 2025

Webrevs

@openjdk
Copy link

openjdk bot commented May 9, 2025

@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.

@openjdk
Copy link

openjdk bot commented May 10, 2025

@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.

Copy link
Member

@sashamatveev sashamatveev left a comment

Choose a reason for hiding this comment

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

Looks good with minor comments.

@alexeysemenyukoracle
Copy link
Member Author

Thank you for the review! I'll address the findings.

@alexeysemenyukoracle
Copy link
Member Author

All findings fixed.

Copy link
Member

@sashamatveev sashamatveev left a comment

Choose a reason for hiding this comment

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

Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 17, 2025
@alexeysemenyukoracle
Copy link
Member Author

/integrate

@openjdk
Copy link

openjdk bot commented May 21, 2025

Going to push as commit 21c1282.
Since your change was applied there have been 174 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 21, 2025
@openjdk openjdk bot closed this May 21, 2025
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 21, 2025
@openjdk
Copy link

openjdk bot commented May 21, 2025

@alexeysemenyukoracle Pushed as commit 21c1282.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated

Development

Successfully merging this pull request may close these issues.

2 participants