|
41 | 41 | import java.io.FileOutputStream; |
42 | 42 | import java.io.IOException; |
43 | 43 | import java.io.InputStream; |
| 44 | +import java.io.IOError; |
44 | 45 | import java.io.InputStreamReader; |
45 | 46 | import java.io.OutputStream; |
| 47 | +import java.nio.file.InvalidPathException; |
46 | 48 | import java.nio.file.Files; |
47 | 49 | import java.nio.file.Path; |
48 | 50 | import java.nio.file.Paths; |
@@ -357,7 +359,66 @@ else if (arg.equals("-cdr")) |
357 | 359 | { |
358 | 360 | cdr_version_ = CdrVersion.Select.V1; |
359 | 361 | } |
| 362 | +<<<<<<< HEAD |
360 | 363 | else if (cdr_version_str.equals(CdrVersion.v2_str)) |
| 364 | +======= |
| 365 | + } |
| 366 | + else |
| 367 | + { |
| 368 | + throw new BadArgumentException("No architecture speficied after " + specific_platform_arg + " argument"); |
| 369 | + } |
| 370 | + } |
| 371 | + else if (arg.equals(extra_template_arg)) |
| 372 | + { |
| 373 | + if (count + 1 < args.length) |
| 374 | + { |
| 375 | + m_customStgOutput.put(args[count++], args[count++]); |
| 376 | + } |
| 377 | + else |
| 378 | + { |
| 379 | + throw new BadArgumentException("Missing arguments for " + extra_template_arg); |
| 380 | + } |
| 381 | + } |
| 382 | + else if (arg.equals(flat_output_directory_arg)) |
| 383 | + { |
| 384 | + m_flat_output_dir = true; |
| 385 | + } |
| 386 | + else if (arg.equals(generate_api_arg)) |
| 387 | + { |
| 388 | + gen_api_ = true; |
| 389 | + } |
| 390 | + else if (arg.equals(help_arg)) |
| 391 | + { |
| 392 | + printHelp(); |
| 393 | + System.exit(0); |
| 394 | + } |
| 395 | + else if (arg.equals("-help+")) |
| 396 | + { |
| 397 | + printEnhacedHelp(); |
| 398 | + System.exit(0); |
| 399 | + } |
| 400 | + else if (arg.equals(include_path_arg)) |
| 401 | + { |
| 402 | + if (count < args.length) |
| 403 | + { |
| 404 | + String pathStr = args[count++]; |
| 405 | + if (!isIncludePathDuplicated(pathStr)) { |
| 406 | + m_includePaths.add(include_path_arg.concat(pathStr)); |
| 407 | + } |
| 408 | + } |
| 409 | + else |
| 410 | + { |
| 411 | + throw new BadArgumentException("No include directory specified after " + include_path_arg + " argument"); |
| 412 | + } |
| 413 | + } |
| 414 | + else if (arg.equals(language_arg)) |
| 415 | + { |
| 416 | + if (count < args.length) |
| 417 | + { |
| 418 | + String languageOption = args[count++]; |
| 419 | + |
| 420 | + if (languageOption.equalsIgnoreCase("c++")) |
| 421 | +>>>>>>> 5f95b79 (Avoid inclussion of duplicate included paths (#429)) |
361 | 422 | { |
362 | 423 | cdr_version_ = CdrVersion.Select.V2; |
363 | 424 | } |
@@ -551,6 +612,70 @@ private void showVersion() |
551 | 612 | System.out.println(m_appName + " version " + version); |
552 | 613 | } |
553 | 614 |
|
| 615 | +<<<<<<< HEAD |
| 616 | +======= |
| 617 | + private boolean isIncludePathDuplicated(String pathToCheck) { |
| 618 | + try { |
| 619 | + Path path = Paths.get(pathToCheck); |
| 620 | + String absPath = path.toAbsolutePath().toString(); |
| 621 | + boolean isDuplicateFound = false; |
| 622 | + for (String includePath : m_includePaths) { |
| 623 | + // include paths are prefixed with "-I" |
| 624 | + if (includePath.length() <= 2) { |
| 625 | + continue; |
| 626 | + } |
| 627 | + String absIncludePath = Paths.get(includePath.substring(2)).toAbsolutePath().toString(); |
| 628 | + if (absPath.toLowerCase().equals(absIncludePath.toLowerCase())) { |
| 629 | + isDuplicateFound = true; |
| 630 | + break; |
| 631 | + } |
| 632 | + } |
| 633 | + if (isDuplicateFound) { |
| 634 | + return true; |
| 635 | + } |
| 636 | + } catch (InvalidPathException | IOError | SecurityException ex) { |
| 637 | + // path operations failed, just returning false |
| 638 | + } |
| 639 | + return false; |
| 640 | + } |
| 641 | + |
| 642 | + /* |
| 643 | + * ---------------------------------------------------------------------------------------- |
| 644 | + * Arguments |
| 645 | + */ |
| 646 | + private static final String case_sensitive_arg = "-cs"; |
| 647 | + private static final String output_path_arg = "-d"; |
| 648 | + private static final String default_container_prealloc_size = "-default-container-prealloc-size"; |
| 649 | + private static final String default_extensibility_arg = "-default_extensibility"; |
| 650 | + private static final String default_extensibility_short_arg = "-de"; |
| 651 | + private static final String specific_platform_arg = "-example"; |
| 652 | + private static final String extra_template_arg = "-extrastg"; |
| 653 | + private static final String flat_output_directory_arg = "-flat-output-dir"; |
| 654 | + private static final String fusion_arg = "-fusion"; |
| 655 | + private static final String help_arg = "-help"; |
| 656 | + private static final String include_path_arg = "-I"; |
| 657 | + private static final String language_arg = "-language"; |
| 658 | + private static final String no_typesupport_arg = "-no-typesupport"; |
| 659 | + private static final String no_typeobjectsupport_arg = "-no-typeobjectsupport"; |
| 660 | + private static final String no_dependencies_arg = "-no-dependencies"; |
| 661 | + private static final String package_arg = "-package"; |
| 662 | + private static final String disable_preprocessor_arg = "-ppDisable"; |
| 663 | + private static final String preprocessor_path_arg = "-ppPath"; |
| 664 | + private static final String python_bindings_arg = "-python"; |
| 665 | + private static final String replace_arg = "-replace"; |
| 666 | + private static final String temp_dir_arg = "-t"; |
| 667 | + private static final String ros2_names_arg = "-typeros2"; |
| 668 | + private static final String cnames_arg = "-typesc"; |
| 669 | + private static final String version_arg = "-version"; |
| 670 | + |
| 671 | + /* |
| 672 | + * ---------------------------------------------------------------------------------------- |
| 673 | + * Developer Arguments |
| 674 | + */ |
| 675 | + private static final String generate_api_arg = "-genapi"; |
| 676 | + private static final String execute_test_arg = "-test"; |
| 677 | + |
| 678 | +>>>>>>> 5f95b79 (Avoid inclussion of duplicate included paths (#429)) |
554 | 679 | public static void printHelp() |
555 | 680 | { |
556 | 681 | System.out.println(m_appName + " usage:"); |
|
0 commit comments