Skip to content

Provide a hook between app-image creation and installer packaging (e.g. for JEP 514 AOT cache training) #135

Description

@koppor

Use case. JDK 25's AOT cache (JEP 514: Ahead-of-Time Command-Line Ergonomics, building on JEP 483) can cut JVM startup time by ~20–25%, but creating the cache requires executing the packaged launcher once ("training run") and placing the resulting .aot file plus a -XX:AOTCache=$APPDIR/... line in the launcher .cfg inside the app image — after jpackage has assembled the image, but before the installers are derived from it.

Problem. Jpackage#runJpackage performs app-image creation and installer packaging (--type deb/rpm/msi/dmg/pkg --app-image ...) within a single task action. There is no seam between the two steps: a doLast runs after the installers are already built, so any post-processing of the app image reaches only the app-image artifact, never the installers. Training a copy of the image is not viable either, since the AOT cache is validated against the exact runtime image it was trained on.

JabRef currently uses the doLast workaround for its app-image-only jabkit tool (JabRef/jabref#16791) but cannot extend it to the installer-shipping GUI application.

Proposal. An optional post-app-image step on the Jpackage task / javaModulePackaging extension, executed after performAppImageStep + copyAdditionalRessourcesToImageFolder and before installer packaging, receiving the app image directory. Possible shapes:

  • an Action<Directory>-style callback (simplest for consumers), or
  • splitting app-image creation and installer packaging into two wired tasks (cleaner, but a larger/breaking change).

Open questions. Interaction with singleStepPackaging = true (no intermediate app image when only installers are requested — the hook would either force two-step packaging or be documented as unsupported there); interaction with build/configuration caching (the hook mutates task output mid-action, so its inputs must participate in up-to-date checks).

I am happy to contribute a PR for whichever shape you prefer.


Generated with 🤖 Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions