RFR: 8378876: jpackage: facilitate testing with mocks

Alexey Semenyuk asemenyuk at openjdk.org
Fri Feb 27 22:23:46 UTC 2026


- Decouple jpackage implementation and test helpers from the current OS: replace OperatingSystem.current() calls with parameters and/or fields of type jdk.internal.util.OperatingSystem where feasible.
 - Support running jpackage without making it run actual packaging. jpackage will exit after it parses the command line, validates the options, and builds a model.

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

Commit messages:
 - Update copyright year
 - MacDmgSystemEnvironment: support mock testing
 - ToolValidator: remove adding "--version" option by default on Linux platform as it interferes with mock testing
 - PackageBuilder: don't assume install directory of a non-standard package should be absolute
 - TKit: support switching the current OS.
 - unbind from the OperatingSystem.current()
 - StandardOption: add "EXIT_AFTER_CONFIGURATION_PHASE" internal debug option. If in the list of options, jpackage will exit after configuration phase is over and will not run packaging pipeline.

Changes: https://git.openjdk.org/jdk/pull/29908/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=29908&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8378876
  Stats: 179 lines in 22 files changed: 97 ins; 28 del; 54 mod
  Patch: https://git.openjdk.org/jdk/pull/29908.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/29908/head:pull/29908

PR: https://git.openjdk.org/jdk/pull/29908


More information about the core-libs-dev mailing list