384 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
384 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
385 task.options.includePattern = Pattern.compile(arg); |
385 task.options.includePattern = Pattern.compile(arg); |
386 } |
386 } |
387 }, |
387 }, |
388 |
388 |
389 // Another alternative to list modules in --add-modules option |
|
390 new HiddenOption(true, "--include-system-modules") { |
|
391 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
|
392 task.options.includeSystemModulePattern = Pattern.compile(arg); |
|
393 } |
|
394 }, |
|
395 |
|
396 new Option(false, "-P", "-profile") { |
389 new Option(false, "-P", "-profile") { |
397 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
390 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
398 task.options.showProfile = true; |
391 task.options.showProfile = true; |
399 } |
392 } |
400 }, |
393 }, |
1019 // Filter specified by -filter, -package, -regex, and --require options |
1012 // Filter specified by -filter, -package, -regex, and --require options |
1020 JdepsFilter.Builder builder = new JdepsFilter.Builder(); |
1013 JdepsFilter.Builder builder = new JdepsFilter.Builder(); |
1021 |
1014 |
1022 // source filters |
1015 // source filters |
1023 builder.includePattern(options.includePattern); |
1016 builder.includePattern(options.includePattern); |
1024 builder.includeSystemModules(options.includeSystemModulePattern); |
1017 |
1025 |
1018 // target filters |
1026 builder.filter(options.filterSamePackage, options.filterSameArchive); |
1019 builder.filter(options.filterSamePackage, options.filterSameArchive); |
1027 builder.findJDKInternals(options.findJDKInternals); |
1020 builder.findJDKInternals(options.findJDKInternals); |
1028 |
1021 |
1029 // --require |
1022 // --require |
1030 if (!options.requires.isEmpty()) { |
1023 if (!options.requires.isEmpty()) { |
1041 if (!options.packageNames.isEmpty()) |
1034 if (!options.packageNames.isEmpty()) |
1042 builder.packages(options.packageNames); |
1035 builder.packages(options.packageNames); |
1043 // -filter |
1036 // -filter |
1044 if (options.filterRegex != null) |
1037 if (options.filterRegex != null) |
1045 builder.filter(options.filterRegex); |
1038 builder.filter(options.filterRegex); |
1046 |
|
1047 // check if system module is set |
|
1048 config.rootModules().stream() |
|
1049 .map(Module::name) |
|
1050 .forEach(builder::includeIfSystemModule); |
|
1051 |
1039 |
1052 return builder.build(); |
1040 return builder.build(); |
1053 } |
1041 } |
1054 |
1042 |
1055 public void handleOptions(String[] args) throws BadArgs { |
1043 public void handleOptions(String[] args) throws BadArgs { |
1160 int depth = 1; |
1148 int depth = 1; |
1161 Set<String> requires = new HashSet<>(); |
1149 Set<String> requires = new HashSet<>(); |
1162 Set<String> packageNames = new HashSet<>(); |
1150 Set<String> packageNames = new HashSet<>(); |
1163 Pattern regex; // apply to the dependences |
1151 Pattern regex; // apply to the dependences |
1164 Pattern includePattern; |
1152 Pattern includePattern; |
1165 Pattern includeSystemModulePattern; |
|
1166 boolean inverse = false; |
1153 boolean inverse = false; |
1167 boolean compileTimeView = false; |
1154 boolean compileTimeView = false; |
1168 String systemModulePath = System.getProperty("java.home"); |
1155 String systemModulePath = System.getProperty("java.home"); |
1169 String upgradeModulePath; |
1156 String upgradeModulePath; |
1170 String modulePath; |
1157 String modulePath; |
1171 String rootModule; |
1158 String rootModule; |
1172 Set<String> addmods = new HashSet<>(); |
1159 Set<String> addmods = new HashSet<>(); |
1173 Runtime.Version multiRelease; |
1160 Runtime.Version multiRelease; |
1174 |
1161 |
1175 boolean hasSourcePath() { |
1162 boolean hasSourcePath() { |
1176 return !addmods.isEmpty() || includePattern != null || |
1163 return !addmods.isEmpty() || includePattern != null; |
1177 includeSystemModulePattern != null; |
|
1178 } |
1164 } |
1179 |
1165 |
1180 boolean hasFilter() { |
1166 boolean hasFilter() { |
1181 return numFilters() > 0; |
1167 return numFilters() > 0; |
1182 } |
1168 } |