Summary
Add ToolProvider support for Java Packager.
Problem
Currently, in order to use Java Packager from the code users need to import some packages (like com.oracle.tools.packager.*) and use it via non-standard API. We can simplify it by adding a ToolProvider support.
Solution
Introduce the ToolProvider support. Add a new class in jdk.packager.internal.Main(JavaPackagerToolProvider) that implements java.util.spi.ToolProvider. Add "provides java.util.spi.ToolProvider with ..." in module-info.java for jdk.packager module.
Specification
The changes for jdk.packager module \ module-info.java:
provides java.util.spi.ToolProvider with jdk.packager.internal.Main.JavaPackagerToolProvider;
The following definition will be added in the module-info.java for jdk.packager:
/**
* Defines the Java packager tool, javapackager.
* The javapackager is a tool for generating bundles for self-contained applications.
* It can be located under the name {@code "javapackager"} using the {@link ToolProvider}, for example:
* <pre>{@code
* ToolProvider javaPackager = ToolProvider.findFirst("javapackager").orElseThrow(...);
* javaPackager.run(...);
* }</pre>
*/
- csr of
-
JDK-8191515 Add ToolProvider support for Java Packager
- Resolved