-
Couldn't load subscription status.
- Fork 6.1k
8370100: Redundant .png files in Linux app-image cause unnecessary bloat #27928
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
8370100: Redundant .png files in Linux app-image cause unnecessary bloat #27928
Conversation
|
👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into |
|
@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: 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 33 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 |
|
@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. |
e5c6ba4 to
e280bb5
Compare
|
@alexeysemenyukoracle this pull request can not be integrated into git checkout JDK-8370100
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 |
e280bb5 to
689f6d9
Compare
3e36592 to
074a42a
Compare
|
@sashamatveev PTAL |
Webrevs
|
… of the launcher icon; Before this change, the function getting a resource for an additional launcher icon took both the additional launcher and the main launcher as input. Now its result doesn't depend on the main launcher.
…Shortcuts() methods
15ef5d5 to
0ad210b
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. |
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 you update JBS description or this PR to describe additional changes? Based on JBS description: If --icon or --linux-shortcut options are not specified, jpackage should not add .png files to the app image.. Should it be like 2-3 lines fix?
|
|
||
| pkg.ifPresent(_ -> { | ||
| builder.task(LinuxAppImageTaskID.LAUNCHER_ICONS).noaction().add(); | ||
| }); |
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 you explain what this code do? We already have LAUNCHER_ICONS task at line 55. Why we need a second one and without action?
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 the same task but with a disabled action. Task graph doesn't allow multiple tasks with the same ID.
By default, the LAUNCHER_ICONS task copies launcher icon files to the app image. However, when bundling a native package, this action should not be executed because the DesktopIntegration class adds launcher icons to the package.
Before this change, jpackage copied launcher icon files twice when building a native package: in LAUNCHER_ICONS task and in DesktopIntegration class.
Function name add() is confusing. Should be apply() or commit().
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 for explanation. Make sense now. Should we do something like:
if (pkg.isEmpty()) {
.task(LinuxAppImageTaskID.LAUNCHER_ICONS)
.addDependent(BuildApplicationTaskID.CONTENT)
.applicationAction(LinuxPackagingPipeline::writeLauncherIcons).add();
}
Add task only for application image vs adding it always and then overwriting with noaction()?
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.
We can do this, but this will complicate building the task graph by making the set of nodes and edges conditional.
It is simpler to build the graph unconditionally, but configure actions for the nodes conditionally.
E.g.: mac packaging task graph is way more sophisticated in terms of branching, see - MacPackagingPipeline.build(). but its initialization is quite stratighforward.
| return this; | ||
| } | ||
|
|
||
| static <T extends Launcher> ApplicationLaunchers normalizeIcons( |
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 you explain why we need this code?
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.
Previously, ApplicationImageUtils.createLauncherIconResource() function required the Application instance to get the icon of a launcher because for additional launchers getting icon was a function taking the main launcher into account.
normalizeIcons() modifies application launchers so that they contain complete information about their icons.
The follow-up for this change, ApplicationImageUtils.createLauncherIconResource(), is modified to no longer require an Application instance.
There are other properties in additional launchers that depend on the main launcher: description, shortcuts. Each is calculated in a unique way.
Descripton:
| launcherParams.put(DESCRIPTION.getID(), DESCRIPTION.fetchFrom(mainParams)); |
Shortcuts:
| static Optional<LauncherShortcut> findLauncherShortcut( |
So we have three functions doing the same thing: they calculate the value of a property of an additionl launcher from the value in the property file of the additional launcher and the value of this property of the main launcher. The logic is the same in all these functions: if an additional launcher doesn't explicitly set the value of a property, it should be copied from the main launcher.
I moved this logic to a single function - ApplicationBuilder.normalizeLauncherProperty(). Currently, it is used for launcher icons only, but later will be used for other launcher poroperties.
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. Thanks for detailed explanation.
|
/integrate |
|
Going to push as commit 327b7c3.
Your commit was automatically rebased without conflicts. |
|
@alexeysemenyukoracle Pushed as commit 327b7c3. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
Don't put the default icon (.png) files in the app image on Linux.
A simple fix would be to add a condition to
LinuxPackagingPipeline.writeLauncherIcons()without changing interfaces in the model. However, this would leave unaddressed a long-standing issue withApplicationImageUtils.createLauncherIconResource()function that requires the main launcher to calculate an icon resource for an additional launcher. At the packaging phase, anyLauncherinstance should be self-sufficient. FixingApplicationImageUtils.createLauncherIconResource()required adding a new interfaceResourceDirLauncherIconto the model and changing the semantics of theDefaultLauncherIconinterface.A new
ApplicationBuilder.normalizeLauncherProperty()function has been added to calculate the value of an additional launcher's property from the value of this property in the main launcher. The function is supposed to calculate a description, shortcuts, an icon, and any future launcher property. For now, it is used to calculate the launcher icon.Progress
Issue
Reviewers
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27928/head:pull/27928$ git checkout pull/27928Update a local copy of the PR:
$ git checkout pull/27928$ git pull https://git.openjdk.org/jdk.git pull/27928/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 27928View PR using the GUI difftool:
$ git pr show -t 27928Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27928.diff
Using Webrev
Link to Webrev Comment