On Sat, 25 Oct 2025 14:48:04 GMT, Alexey Semenyuk <[email protected]> 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

Reply via email to