RFR: 8368030: Make package bundlers stateless

Alexey Semenyuk asemenyuk at openjdk.org
Thu Sep 18 23:01:21 UTC 2025


Introduce `jdk.jpackage.internal.SystemEnvironment` interface to describe system tools needed for building specific package bundles with three immediate subinterfaces: `WinSystemEnvironment`, `LinuxSystemEnvironment`, and `MacDmgSystemEnvironment`.

`LinuxSystemEnvironment` has two subinterfaces: `LinuxDebSystemEnvironment` and `LinuxRpmSystemEnvironment`.

There is no `MacSystemEnvironment` interface as pkg and dmg bundlers are unrelated, unlike rpm and deb bundlers, which share a fair amount of code.

There is no `MacPkgSystemEnvironment` interface because the pkg bundler doesn't validate tools.

Instances of these interfaces are created as member fields of the corresponding bundler classes, i.e., bundling system tools are validated only once when a specific bundler is instantiated.

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

Commit messages:
 - Remove redundant code
 - Fix compilation error
 - Remove redundant ToolValidator.setToolNotFoundErrorHandler() call
 - Remove redundant "throws IOException"
 - Allow tool validator not to run validated tool, just check if it exists. Fix tool validator and better test coverage.
 - New Result class: Option-like type with attached list of exceptions
 - Split Linux and Windows package bundlers into bundlers and packagers. Created SystemEnvironment interface to hold system properties - paths to build tools. Share a single instance of LinuxSystemEnvironment between BED and RPM bundlers. This is to make `dpkg -s coreutils` command run only once and not twice for each bundler

Changes: https://git.openjdk.org/jdk/pull/27377/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27377&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8368030
  Stats: 3887 lines in 33 files changed: 2331 ins; 1415 del; 141 mod
  Patch: https://git.openjdk.org/jdk/pull/27377.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27377/head:pull/27377

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


More information about the core-libs-dev mailing list