|
40 | 40 | import java.io.FileOutputStream; |
41 | 41 | import java.io.IOException; |
42 | 42 | import java.io.InputStream; |
| 43 | +import java.io.IOError; |
43 | 44 | import java.io.InputStreamReader; |
44 | 45 | import java.io.OutputStream; |
| 46 | +<<<<<<< HEAD |
| 47 | +======= |
| 48 | +import java.nio.file.InvalidPathException; |
| 49 | +import java.nio.file.Files; |
| 50 | +>>>>>>> 5f95b79 (Avoid inclussion of duplicate included paths (#429)) |
45 | 51 | import java.nio.file.Path; |
46 | 52 | import java.nio.file.Paths; |
47 | 53 | import java.util.ArrayList; |
@@ -174,7 +180,54 @@ else if (arg.equals("-example")) |
174 | 180 | throw new BadArgumentException("No architecture speficied after -example argument"); |
175 | 181 | } |
176 | 182 | } |
| 183 | +<<<<<<< HEAD |
177 | 184 | else if (arg.equals("-language")) |
| 185 | +======= |
| 186 | + else if (arg.equals(extra_template_arg)) |
| 187 | + { |
| 188 | + if (count + 1 < args.length) |
| 189 | + { |
| 190 | + m_customStgOutput.put(args[count++], args[count++]); |
| 191 | + } |
| 192 | + else |
| 193 | + { |
| 194 | + throw new BadArgumentException("Missing arguments for " + extra_template_arg); |
| 195 | + } |
| 196 | + } |
| 197 | + else if (arg.equals(flat_output_directory_arg)) |
| 198 | + { |
| 199 | + m_flat_output_dir = true; |
| 200 | + } |
| 201 | + else if (arg.equals(generate_api_arg)) |
| 202 | + { |
| 203 | + gen_api_ = true; |
| 204 | + } |
| 205 | + else if (arg.equals(help_arg)) |
| 206 | + { |
| 207 | + printHelp(); |
| 208 | + System.exit(0); |
| 209 | + } |
| 210 | + else if (arg.equals("-help+")) |
| 211 | + { |
| 212 | + printEnhacedHelp(); |
| 213 | + System.exit(0); |
| 214 | + } |
| 215 | + else if (arg.equals(include_path_arg)) |
| 216 | + { |
| 217 | + if (count < args.length) |
| 218 | + { |
| 219 | + String pathStr = args[count++]; |
| 220 | + if (!isIncludePathDuplicated(pathStr)) { |
| 221 | + m_includePaths.add(include_path_arg.concat(pathStr)); |
| 222 | + } |
| 223 | + } |
| 224 | + else |
| 225 | + { |
| 226 | + throw new BadArgumentException("No include directory specified after " + include_path_arg + " argument"); |
| 227 | + } |
| 228 | + } |
| 229 | + else if (arg.equals(language_arg)) |
| 230 | +>>>>>>> 5f95b79 (Avoid inclussion of duplicate included paths (#429)) |
178 | 231 | { |
179 | 232 | if (count < args.length) |
180 | 233 | { |
@@ -542,6 +595,70 @@ private void showVersion() |
542 | 595 | System.out.println(m_appName + " version " + version); |
543 | 596 | } |
544 | 597 |
|
| 598 | +<<<<<<< HEAD |
| 599 | +======= |
| 600 | + private boolean isIncludePathDuplicated(String pathToCheck) { |
| 601 | + try { |
| 602 | + Path path = Paths.get(pathToCheck); |
| 603 | + String absPath = path.toAbsolutePath().toString(); |
| 604 | + boolean isDuplicateFound = false; |
| 605 | + for (String includePath : m_includePaths) { |
| 606 | + // include paths are prefixed with "-I" |
| 607 | + if (includePath.length() <= 2) { |
| 608 | + continue; |
| 609 | + } |
| 610 | + String absIncludePath = Paths.get(includePath.substring(2)).toAbsolutePath().toString(); |
| 611 | + if (absPath.toLowerCase().equals(absIncludePath.toLowerCase())) { |
| 612 | + isDuplicateFound = true; |
| 613 | + break; |
| 614 | + } |
| 615 | + } |
| 616 | + if (isDuplicateFound) { |
| 617 | + return true; |
| 618 | + } |
| 619 | + } catch (InvalidPathException | IOError | SecurityException ex) { |
| 620 | + // path operations failed, just returning false |
| 621 | + } |
| 622 | + return false; |
| 623 | + } |
| 624 | + |
| 625 | + /* |
| 626 | + * ---------------------------------------------------------------------------------------- |
| 627 | + * Arguments |
| 628 | + */ |
| 629 | + private static final String case_sensitive_arg = "-cs"; |
| 630 | + private static final String output_path_arg = "-d"; |
| 631 | + private static final String default_container_prealloc_size = "-default-container-prealloc-size"; |
| 632 | + private static final String default_extensibility_arg = "-default_extensibility"; |
| 633 | + private static final String default_extensibility_short_arg = "-de"; |
| 634 | + private static final String specific_platform_arg = "-example"; |
| 635 | + private static final String extra_template_arg = "-extrastg"; |
| 636 | + private static final String flat_output_directory_arg = "-flat-output-dir"; |
| 637 | + private static final String fusion_arg = "-fusion"; |
| 638 | + private static final String help_arg = "-help"; |
| 639 | + private static final String include_path_arg = "-I"; |
| 640 | + private static final String language_arg = "-language"; |
| 641 | + private static final String no_typesupport_arg = "-no-typesupport"; |
| 642 | + private static final String no_typeobjectsupport_arg = "-no-typeobjectsupport"; |
| 643 | + private static final String no_dependencies_arg = "-no-dependencies"; |
| 644 | + private static final String package_arg = "-package"; |
| 645 | + private static final String disable_preprocessor_arg = "-ppDisable"; |
| 646 | + private static final String preprocessor_path_arg = "-ppPath"; |
| 647 | + private static final String python_bindings_arg = "-python"; |
| 648 | + private static final String replace_arg = "-replace"; |
| 649 | + private static final String temp_dir_arg = "-t"; |
| 650 | + private static final String ros2_names_arg = "-typeros2"; |
| 651 | + private static final String cnames_arg = "-typesc"; |
| 652 | + private static final String version_arg = "-version"; |
| 653 | + |
| 654 | + /* |
| 655 | + * ---------------------------------------------------------------------------------------- |
| 656 | + * Developer Arguments |
| 657 | + */ |
| 658 | + private static final String generate_api_arg = "-genapi"; |
| 659 | + private static final String execute_test_arg = "-test"; |
| 660 | + |
| 661 | +>>>>>>> 5f95b79 (Avoid inclussion of duplicate included paths (#429)) |
545 | 662 | public static void printHelp() |
546 | 663 | { |
547 | 664 | System.out.println(m_appName + " usage:"); |
|
0 commit comments