35 import java.util.List;
36 import java.util.Map;
37 import java.util.Objects;
38 import java.util.Set;
39 import java.util.stream.Collectors;
40
41 /**
42 * A build tool to extend the module-info.java in the source tree for
43 * platform-specific exports, uses, and provides and write to the specified
44 * output file. Injecting platform-specific requires is not supported.
45 *
46 * The extra exports, uses, provides can be specified in module-info.java.extra
47 * files and GenModuleInfoSource will be invoked for each module that has
48 * module-info.java.extra in the source directory.
49 */
50 public class GenModuleInfoSource {
51 private final static String USAGE =
52 "Usage: GenModuleInfoSource [option] -o <output file> <module-info-java>\n" +
53 "Options are:\n" +
54 " -exports <package-name>\n" +
55 " -exports <package-name>/<module-name>\n" +
56 " -uses <service>\n" +
57 " -provides <service>/<provider-impl-classname>\n";
58
59 public static void main(String... args) throws Exception {
60 Path outfile = null;
61 Path moduleInfoJava = null;
62 GenModuleInfoSource genModuleInfo = new GenModuleInfoSource();
63
64 // validate input arguments
65 for (int i = 0; i < args.length; i++){
66 String option = args[i];
67 if (option.startsWith("-")) {
68 String arg = args[++i];
69 if (option.equals("-exports")) {
70 int index = arg.indexOf('/');
71 if (index > 0) {
72 String pn = arg.substring(0, index);
73 String mn = arg.substring(index + 1, arg.length());
74 genModuleInfo.exportTo(pn, mn);
75 } else {
|
35 import java.util.List;
36 import java.util.Map;
37 import java.util.Objects;
38 import java.util.Set;
39 import java.util.stream.Collectors;
40
41 /**
42 * A build tool to extend the module-info.java in the source tree for
43 * platform-specific exports, uses, and provides and write to the specified
44 * output file. Injecting platform-specific requires is not supported.
45 *
46 * The extra exports, uses, provides can be specified in module-info.java.extra
47 * files and GenModuleInfoSource will be invoked for each module that has
48 * module-info.java.extra in the source directory.
49 */
50 public class GenModuleInfoSource {
51 private final static String USAGE =
52 "Usage: GenModuleInfoSource [option] -o <output file> <module-info-java>\n" +
53 "Options are:\n" +
54 " -exports <package-name>\n" +
55 " -exports <package-name>[/<module-name>]\n" +
56 " -uses <service>\n" +
57 " -provides <service>/<provider-impl-classname>\n";
58
59 public static void main(String... args) throws Exception {
60 Path outfile = null;
61 Path moduleInfoJava = null;
62 GenModuleInfoSource genModuleInfo = new GenModuleInfoSource();
63
64 // validate input arguments
65 for (int i = 0; i < args.length; i++){
66 String option = args[i];
67 if (option.startsWith("-")) {
68 String arg = args[++i];
69 if (option.equals("-exports")) {
70 int index = arg.indexOf('/');
71 if (index > 0) {
72 String pn = arg.substring(0, index);
73 String mn = arg.substring(index + 1, arg.length());
74 genModuleInfo.exportTo(pn, mn);
75 } else {
|