On Wed, 1 Nov 2023 19:58:07 GMT, Mandy Chung <mch...@openjdk.org> wrote:
> 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. This pull request has now been integrated. Changeset: 008ca2a7 Author: Mandy Chung <mch...@openjdk.org> URL: https://git.openjdk.org/jdk/commit/008ca2a72587f1518199e81f6f7ec7fbdc258d99 Stats: 17 lines in 8 files changed: 6 ins; 0 del; 11 mod 8317620: Build JDK tools with ModuleMainClass attribute Reviewed-by: erikj, alanb ------------- PR: https://git.openjdk.org/jdk/pull/16463