RFR: 8317620: Build JDK tools with ModuleMainClass attribute [v2]

Mandy Chung mchung at openjdk.org
Thu Nov 2 16:19:35 UTC 2023


> Tool modules can be created via `jmod --main-class` option such that `ModuleMainClass` attribute will be added in `module-info.class` and the module's main class can be launched via `java -m <module-name>` without specifying the name of the main class.
> 
> In addition, for modules with `ModuleMainClass` attribute, jlink will pre-resolve the module graph such that when such module is launched at runtime (without `--add-modules` or `--limit-modules` option), the runtime can skip the module resolution and speed up the startup time.
> 
> This PR extends the build system to allow a module to specify the main class under `make/modules/$MODULE/Jmod.gmk` file.    Also JDK tools with a single entry point (or a primary entry point) are candidates to add `ModuleMainClass` attribute in `module-info.class` to benefit from the jlink optimization.   For example, `java -m jdk.jpackage` will be launched using the pre-resolved module graph.
> 
> Verified manually by running `java -m $MODULE` on the modules with main class.

Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:

  review feedbacks

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/16463/files
  - new: https://git.openjdk.org/jdk/pull/16463/files/8fd31bd8..a0fa54bb

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=16463&range=01
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=16463&range=00-01

  Stats: 27 lines in 2 files changed: 0 ins; 26 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/16463.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/16463/head:pull/16463

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


More information about the build-dev mailing list