< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/Main.java

Print this page




 116             if (Main.DEBUG) {
 117                 ex.printStackTrace(ctx.err);
 118             }
 119         }
 120     }
 121 
 122     public int run(String[] args) {
 123         OptionParser parser = new OptionParser();
 124         parser.accepts("dry-run", format("help.dry_run"));
 125         parser.accepts("I", format("help.I")).withRequiredArg();
 126         // option is expected to specify paths to load shared libraries
 127         // to check & warn missing symbols during jextract session.
 128         parser.accepts("L", format("help.L")).withRequiredArg();
 129         parser.accepts("l", format("help.l")).withRequiredArg();
 130         parser.accepts("d", format("help.d")).withRequiredArg();
 131         parser.acceptsAll(List.of("o", "jar"), format("help.o")).withRequiredArg();
 132         parser.acceptsAll(List.of("t", "target-package"), format("help.t")).withRequiredArg();
 133         parser.acceptsAll(List.of("m", "package-map"), format("help.m")).withRequiredArg();
 134         parser.acceptsAll(List.of("?", "h", "help"), format("help.h")).forHelp();
 135         parser.accepts("C", format("help.C")).withRequiredArg();

 136         parser.accepts("log", format("help.log")).withRequiredArg();
 137         parser.accepts("exclude-symbols", format("help.exclude_symbols")).withRequiredArg();
 138         parser.accepts("rpath", format("help.rpath")).withRequiredArg();
 139         parser.accepts("infer-rpath", format("help.infer.rpath"));
 140         parser.accepts("static-forwarder", format("help.static.forwarder")).
 141             withRequiredArg().ofType(boolean.class);
 142         parser.nonOptions(format("help.non.option"));
 143 
 144         OptionSet options = null;
 145         try {
 146              options = parser.parse(args);
 147         } catch (OptionException oe) {
 148              ctx.err.println(oe.getMessage());
 149              if (Main.DEBUG) {
 150                  oe.printStackTrace(ctx.err);
 151              }
 152              printHelp(parser);
 153              return 1;
 154         }
 155 


 197                 //conflicting rpaths options
 198                 ctx.err.println(format("warn.rpath.auto.conflict"));
 199                 infer_rpath = false;
 200             }
 201 
 202             // "rpath" with no "l" option!
 203             if (options.has("l")) {
 204                 options.valuesOf("rpath").forEach(p -> ctx.addLibraryPath((String) p));
 205             } else {
 206                 ctx.err.println(format("warn.rpath.without.l"));
 207             }
 208         }
 209 
 210         // generate static forwarder class if user specified -l option
 211         boolean staticForwarder = true;
 212         if (options.has("static-forwarder")) {
 213             staticForwarder = (boolean)options.valueOf("static-forwarder");
 214         }
 215         ctx.setGenStaticForwarder(staticForwarder && options.has("l"));
 216 








 217         if (options.has("exclude-symbols")) {
 218             try {
 219                 options.valuesOf("exclude-symbols").forEach(sym -> ctx.addExcludeSymbols((String) sym));
 220             } catch (PatternSyntaxException pse) {
 221                 ctx.err.println(format("exclude.symbols.pattern.error", pse.getMessage()));
 222             }
 223         }
 224 
 225         if (options.has("L")) {
 226             List<?> libpaths = options.valuesOf("L");
 227             // "L" with no "l" option!
 228             if (options.has("l")) {
 229                 libpaths.forEach(p -> ctx.addLinkCheckPath((String) p));
 230                 if (infer_rpath) {
 231                     libpaths.forEach(p -> ctx.addLibraryPath((String) p));
 232                 }
 233             } else {
 234                 ctx.err.println(format("warn.L.without.l"));
 235             }
 236         } else if (infer_rpath) {




 116             if (Main.DEBUG) {
 117                 ex.printStackTrace(ctx.err);
 118             }
 119         }
 120     }
 121 
 122     public int run(String[] args) {
 123         OptionParser parser = new OptionParser();
 124         parser.accepts("dry-run", format("help.dry_run"));
 125         parser.accepts("I", format("help.I")).withRequiredArg();
 126         // option is expected to specify paths to load shared libraries
 127         // to check & warn missing symbols during jextract session.
 128         parser.accepts("L", format("help.L")).withRequiredArg();
 129         parser.accepts("l", format("help.l")).withRequiredArg();
 130         parser.accepts("d", format("help.d")).withRequiredArg();
 131         parser.acceptsAll(List.of("o", "jar"), format("help.o")).withRequiredArg();
 132         parser.acceptsAll(List.of("t", "target-package"), format("help.t")).withRequiredArg();
 133         parser.acceptsAll(List.of("m", "package-map"), format("help.m")).withRequiredArg();
 134         parser.acceptsAll(List.of("?", "h", "help"), format("help.h")).forHelp();
 135         parser.accepts("C", format("help.C")).withRequiredArg();
 136         parser.accepts("include-symbols", format("help.include_symbols")).withRequiredArg();
 137         parser.accepts("log", format("help.log")).withRequiredArg();
 138         parser.accepts("exclude-symbols", format("help.exclude_symbols")).withRequiredArg();
 139         parser.accepts("rpath", format("help.rpath")).withRequiredArg();
 140         parser.accepts("infer-rpath", format("help.infer.rpath"));
 141         parser.accepts("static-forwarder", format("help.static.forwarder")).
 142             withRequiredArg().ofType(boolean.class);
 143         parser.nonOptions(format("help.non.option"));
 144 
 145         OptionSet options = null;
 146         try {
 147              options = parser.parse(args);
 148         } catch (OptionException oe) {
 149              ctx.err.println(oe.getMessage());
 150              if (Main.DEBUG) {
 151                  oe.printStackTrace(ctx.err);
 152              }
 153              printHelp(parser);
 154              return 1;
 155         }
 156 


 198                 //conflicting rpaths options
 199                 ctx.err.println(format("warn.rpath.auto.conflict"));
 200                 infer_rpath = false;
 201             }
 202 
 203             // "rpath" with no "l" option!
 204             if (options.has("l")) {
 205                 options.valuesOf("rpath").forEach(p -> ctx.addLibraryPath((String) p));
 206             } else {
 207                 ctx.err.println(format("warn.rpath.without.l"));
 208             }
 209         }
 210 
 211         // generate static forwarder class if user specified -l option
 212         boolean staticForwarder = true;
 213         if (options.has("static-forwarder")) {
 214             staticForwarder = (boolean)options.valueOf("static-forwarder");
 215         }
 216         ctx.setGenStaticForwarder(staticForwarder && options.has("l"));
 217 
 218         if (options.has("include-symbols")) {
 219             try {
 220                 options.valuesOf("include-symbols").forEach(sym -> ctx.addIncludeSymbols((String) sym));
 221             } catch (PatternSyntaxException pse) {
 222                 ctx.err.println(format("include.symbols.pattern.error", pse.getMessage()));
 223             }
 224         }
 225 
 226         if (options.has("exclude-symbols")) {
 227             try {
 228                 options.valuesOf("exclude-symbols").forEach(sym -> ctx.addExcludeSymbols((String) sym));
 229             } catch (PatternSyntaxException pse) {
 230                 ctx.err.println(format("exclude.symbols.pattern.error", pse.getMessage()));
 231             }
 232         }
 233 
 234         if (options.has("L")) {
 235             List<?> libpaths = options.valuesOf("L");
 236             // "L" with no "l" option!
 237             if (options.has("l")) {
 238                 libpaths.forEach(p -> ctx.addLinkCheckPath((String) p));
 239                 if (infer_rpath) {
 240                     libpaths.forEach(p -> ctx.addLibraryPath((String) p));
 241                 }
 242             } else {
 243                 ctx.err.println(format("warn.L.without.l"));
 244             }
 245         } else if (infer_rpath) {


< prev index next >