RFR: 8370100: Redundant .png files in Linux app-image cause unnecessary bloat [v2]

Alexander Matveev almatvee at openjdk.org
Mon Oct 27 22:37:04 UTC 2025


On Sat, 25 Oct 2025 14:48:04 GMT, Alexey Semenyuk <asemenyuk at openjdk.org> wrote:

>> src/jdk.jpackage/linux/classes/jdk/jpackage/internal/LinuxPackagingPipeline.java line 62:
>> 
>>> 60:         pkg.ifPresent(_ -> {
>>> 61:             builder.task(LinuxAppImageTaskID.LAUNCHER_ICONS).noaction().add();
>>> 62:         });
>> 
>> 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?
>
> 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()`.

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()?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/27928#discussion_r2467274568


More information about the core-libs-dev mailing list