< prev index next >
src/jdk.jextract/share/classes/com/sun/tools/jextract/Main.java
Print this page
*** 91,101 ****
if (!Files.isReadable(p)) {
throw new IllegalArgumentException(format("cannot.read.header.file", header));
}
p = p.toAbsolutePath();
ctx.usePackageForFolder(p.getParent(), targetPackage);
! ctx.sources.add(p);
}
private void setupLogging(Level level) {
Logger logger = ctx.logger;
logger.setUseParentHandlers(false);
--- 91,101 ----
if (!Files.isReadable(p)) {
throw new IllegalArgumentException(format("cannot.read.header.file", header));
}
p = p.toAbsolutePath();
ctx.usePackageForFolder(p.getParent(), targetPackage);
! ctx.addSource(p);
}
private void setupLogging(Level level) {
Logger logger = ctx.logger;
logger.setUseParentHandlers(false);
*** 158,182 ****
} else {
setupLogging(Level.WARNING);
}
if (options.has("I")) {
! options.valuesOf("I").forEach(p -> ctx.clangArgs.add("-I" + p));
}
if (options.has("C")) {
! options.valuesOf("C").forEach(p -> ctx.clangArgs.add((String) p));
}
if (options.has("l")) {
try {
options.valuesOf("l").forEach(p -> {
String lib = (String)p;
if (lib.indexOf(File.separatorChar) != -1) {
throw new IllegalArgumentException(format("l.name.should.not.be.path", lib));
}
! ctx.libraryNames.add(lib);
});
} catch (IllegalArgumentException iae) {
ctx.err.println(iae.getMessage());
if (Main.DEBUG) {
iae.printStackTrace(ctx.err);
--- 158,182 ----
} else {
setupLogging(Level.WARNING);
}
if (options.has("I")) {
! options.valuesOf("I").forEach(p -> ctx.addClangArg("-I" + p));
}
if (options.has("C")) {
! options.valuesOf("C").forEach(p -> ctx.addClangArg((String) p));
}
if (options.has("l")) {
try {
options.valuesOf("l").forEach(p -> {
String lib = (String)p;
if (lib.indexOf(File.separatorChar) != -1) {
throw new IllegalArgumentException(format("l.name.should.not.be.path", lib));
}
! ctx.addLibraryName(lib);
});
} catch (IllegalArgumentException iae) {
ctx.err.println(iae.getMessage());
if (Main.DEBUG) {
iae.printStackTrace(ctx.err);
*** 186,205 ****
}
if (options.has("rpath")) {
// "rpath" with no "l" option!
if (options.has("l")) {
! options.valuesOf("rpath").forEach(p -> ctx.libraryPaths.add((String) p));
} else {
ctx.err.println(format("warn.rpath.without.l"));
}
}
if (options.has("L")) {
// "L" with no "l" option!
if (options.has("l")) {
! options.valuesOf("L").forEach(p -> ctx.linkCheckPaths.add((String) p));
} else {
ctx.err.println(format("warn.L.without.l"));
}
}
--- 186,205 ----
}
if (options.has("rpath")) {
// "rpath" with no "l" option!
if (options.has("l")) {
! options.valuesOf("rpath").forEach(p -> ctx.addLibraryPath((String) p));
} else {
ctx.err.println(format("warn.rpath.without.l"));
}
}
if (options.has("L")) {
// "L" with no "l" option!
if (options.has("l")) {
! options.valuesOf("L").forEach(p -> ctx.addLinkCheckPath((String) p));
} else {
ctx.err.println(format("warn.L.without.l"));
}
}
*** 212,222 ****
options.valuesOf("m").forEach(this::processPackageMapping);
}
try {
options.nonOptionArguments().stream().forEach(this::processHeader);
! ctx.parse(AsmCodeFactory::new);
} catch (RuntimeException re) {
ctx.err.println(re.getMessage());
if (Main.DEBUG) {
re.printStackTrace(ctx.err);
}
--- 212,222 ----
options.valuesOf("m").forEach(this::processPackageMapping);
}
try {
options.nonOptionArguments().stream().forEach(this::processHeader);
! ctx.parse();
} catch (RuntimeException re) {
ctx.err.println(re.getMessage());
if (Main.DEBUG) {
re.printStackTrace(ctx.err);
}
*** 242,252 ****
return 0;
}
public static void main(String... args) {
! Main instance = new Main(Context.newInstance());
System.exit(instance.run(args));
}
public static class JextractToolProvider implements ToolProvider {
--- 242,252 ----
return 0;
}
public static void main(String... args) {
! Main instance = new Main(new Context());
System.exit(instance.run(args));
}
public static class JextractToolProvider implements ToolProvider {
*** 264,273 ****
if (System.getSecurityManager() != null) {
System.getSecurityManager().
checkPermission(new RuntimePermission("jextract"));
}
! Main instance = new Main(Context.newInstance(out, err));
return instance.run(args);
}
}
}
--- 264,273 ----
if (System.getSecurityManager() != null) {
System.getSecurityManager().
checkPermission(new RuntimePermission("jextract"));
}
! Main instance = new Main(new Context(out, err));
return instance.run(args);
}
}
}
< prev index next >