148 new Option(false, "-h", "-?", "-help", "--help") { |
148 new Option(false, "-h", "-?", "-help", "--help") { |
149 void process(JdepsTask task, String opt, String arg) { |
149 void process(JdepsTask task, String opt, String arg) { |
150 task.options.help = true; |
150 task.options.help = true; |
151 } |
151 } |
152 }, |
152 }, |
153 new Option(true, "-dotoutput") { |
153 new Option(true, "-dotoutput", "--dot-output") { |
154 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
154 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
155 Path p = Paths.get(arg); |
155 Path p = Paths.get(arg); |
156 if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { |
156 if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { |
157 throw new BadArgs("err.invalid.path", arg); |
157 throw new BadArgs("err.invalid.path", arg); |
158 } |
158 } |
189 default: |
189 default: |
190 throw new BadArgs("err.invalid.arg.for.option", opt); |
190 throw new BadArgs("err.invalid.arg.for.option", opt); |
191 } |
191 } |
192 } |
192 } |
193 }, |
193 }, |
194 new Option(false, "-apionly") { |
194 new Option(false, "-apionly", "--api-only") { |
195 void process(JdepsTask task, String opt, String arg) { |
195 void process(JdepsTask task, String opt, String arg) { |
196 task.options.apiOnly = true; |
196 task.options.apiOnly = true; |
197 } |
197 } |
198 }, |
198 }, |
199 new Option(true, "--check") { |
199 new Option(true, "--check") { |
201 Set<String> mods = Set.of(arg.split(",")); |
201 Set<String> mods = Set.of(arg.split(",")); |
202 task.options.checkModuleDeps = mods; |
202 task.options.checkModuleDeps = mods; |
203 task.options.addmods.addAll(mods); |
203 task.options.addmods.addAll(mods); |
204 } |
204 } |
205 }, |
205 }, |
206 new Option(true, "--gen-module-info") { |
206 new Option(true, "--generate-module-info") { |
207 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
207 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
208 Path p = Paths.get(arg); |
208 Path p = Paths.get(arg); |
209 if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { |
209 if (Files.exists(p) && (!Files.isDirectory(p) || !Files.isWritable(p))) { |
210 throw new BadArgs("err.invalid.path", arg); |
210 throw new BadArgs("err.invalid.path", arg); |
211 } |
211 } |
212 task.options.genModuleInfo = Paths.get(arg); |
212 task.options.genModuleInfo = Paths.get(arg); |
213 } |
213 } |
214 }, |
214 }, |
215 new Option(false, "-jdkinternals") { |
215 new Option(false, "-jdkinternals", "--jdk-internals") { |
216 void process(JdepsTask task, String opt, String arg) { |
216 void process(JdepsTask task, String opt, String arg) { |
217 task.options.findJDKInternals = true; |
217 task.options.findJDKInternals = true; |
218 task.options.verbose = CLASS; |
218 task.options.verbose = CLASS; |
219 if (task.options.includePattern == null) { |
219 if (task.options.includePattern == null) { |
220 task.options.includePattern = Pattern.compile(".*"); |
220 task.options.includePattern = Pattern.compile(".*"); |
261 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
261 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
262 task.options.rootModule = arg; |
262 task.options.rootModule = arg; |
263 task.options.addmods.add(arg); |
263 task.options.addmods.add(arg); |
264 } |
264 } |
265 }, |
265 }, |
|
266 new Option(true, "--multi-release") { |
|
267 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
|
268 if (arg.equalsIgnoreCase("base")) { |
|
269 task.options.multiRelease = JarFile.baseVersion(); |
|
270 } else { |
|
271 try { |
|
272 int v = Integer.parseInt(arg); |
|
273 if (v < 9) { |
|
274 throw new BadArgs("err.invalid.arg.for.option", arg); |
|
275 } |
|
276 } catch (NumberFormatException x) { |
|
277 throw new BadArgs("err.invalid.arg.for.option", arg); |
|
278 } |
|
279 task.options.multiRelease = Runtime.Version.parse(arg); |
|
280 } |
|
281 } |
|
282 }, |
266 |
283 |
267 // ---- Target filtering options ---- |
284 // ---- Target filtering options ---- |
268 new Option(true, "-p", "-package") { |
285 new Option(true, "-p", "-package", "--package") { |
269 void process(JdepsTask task, String opt, String arg) { |
286 void process(JdepsTask task, String opt, String arg) { |
270 task.options.packageNames.add(arg); |
287 task.options.packageNames.add(arg); |
271 } |
288 } |
272 }, |
289 }, |
273 new Option(true, "-e", "-regex") { |
290 new Option(true, "-e", "-regex", "--regex") { |
274 void process(JdepsTask task, String opt, String arg) { |
291 void process(JdepsTask task, String opt, String arg) { |
275 task.options.regex = Pattern.compile(arg); |
292 task.options.regex = Pattern.compile(arg); |
276 } |
293 } |
277 }, |
294 }, |
278 new Option(true, "-requires") { |
295 new Option(true, "--require") { |
279 void process(JdepsTask task, String opt, String arg) { |
296 void process(JdepsTask task, String opt, String arg) { |
280 task.options.requires.add(arg); |
297 task.options.requires.add(arg); |
281 } |
298 } |
282 }, |
299 }, |
283 new Option(true, "-f", "-filter") { |
300 new Option(true, "-f", "-filter") { |
334 task.options.filterSameArchive = false; |
351 task.options.filterSameArchive = false; |
335 task.options.filterSamePackage = false; |
352 task.options.filterSamePackage = false; |
336 } |
353 } |
337 }, |
354 }, |
338 |
355 |
339 new Option(false, "-I", "-inverse") { |
356 new Option(false, "-I", "--inverse") { |
340 void process(JdepsTask task, String opt, String arg) { |
357 void process(JdepsTask task, String opt, String arg) { |
341 task.options.inverse = true; |
358 task.options.inverse = true; |
342 // equivalent to the inverse of compile-time view analysis |
359 // equivalent to the inverse of compile-time view analysis |
343 task.options.compileTimeView = true; |
360 task.options.compileTimeView = true; |
344 task.options.filterSamePackage = true; |
361 task.options.filterSamePackage = true; |
359 void process(JdepsTask task, String opt, String arg) { |
376 void process(JdepsTask task, String opt, String arg) { |
360 task.options.nowarning = true; |
377 task.options.nowarning = true; |
361 } |
378 } |
362 }, |
379 }, |
363 |
380 |
364 new Option(false, "-version") { |
381 new Option(false, "-version", "--version") { |
365 void process(JdepsTask task, String opt, String arg) { |
382 void process(JdepsTask task, String opt, String arg) { |
366 task.options.version = true; |
383 task.options.version = true; |
367 } |
384 } |
368 }, |
385 }, |
369 new HiddenOption(false, "-fullversion") { |
386 new HiddenOption(false, "-fullversion") { |
385 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
402 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
386 try { |
403 try { |
387 task.options.depth = Integer.parseInt(arg); |
404 task.options.depth = Integer.parseInt(arg); |
388 } catch (NumberFormatException e) { |
405 } catch (NumberFormatException e) { |
389 throw new BadArgs("err.invalid.arg.for.option", opt); |
406 throw new BadArgs("err.invalid.arg.for.option", opt); |
390 } |
|
391 } |
|
392 }, |
|
393 new Option(true, "--multi-release") { |
|
394 void process(JdepsTask task, String opt, String arg) throws BadArgs { |
|
395 if (arg.equalsIgnoreCase("base")) { |
|
396 task.options.multiRelease = JarFile.baseVersion(); |
|
397 } else { |
|
398 try { |
|
399 int v = Integer.parseInt(arg); |
|
400 if (v < 9) { |
|
401 throw new BadArgs("err.invalid.arg.for.option", arg); |
|
402 } |
|
403 } catch (NumberFormatException x) { |
|
404 throw new BadArgs("err.invalid.arg.for.option", arg); |
|
405 } |
|
406 task.options.multiRelease = Runtime.Version.parse(arg); |
|
407 } |
407 } |
408 } |
408 } |
409 }, |
409 }, |
410 }; |
410 }; |
411 |
411 |