Skip to content

Commit 778ea98

Browse files
[jnigen] Close #877; Fix summarizer and improve errors
1 parent 880ca30 commit 778ea98

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/SummarizerOptions.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.github.dart_lang.jnigen.apisummarizer;
22

3+
import java.io.PrintWriter;
34
import java.util.Arrays;
45
import org.apache.commons.cli.*;
56

@@ -63,15 +64,22 @@ public static SummarizerOptions parseArgs(String[] args) {
6364
try {
6465
cmd = parser.parse(options, args);
6566
if (cmd.getArgs().length < 1) {
66-
throw new ParseException("Need to specify paths to source files");
67+
throw new ParseException("Need to specify the package or class names");
6768
}
6869
} catch (ParseException e) {
69-
System.out.println(e.getMessage());
70+
System.err.println(e.getMessage());
7071
help.printHelp(
72+
new PrintWriter(System.err, true),
73+
help.getWidth(),
7174
"java -jar <JAR> [-s <SOURCE_DIR=.>] "
7275
+ "[-c <CLASSES_JAR>] <CLASS_OR_PACKAGE_NAMES>\n"
7376
+ "Class or package names should be fully qualified.\n\n",
74-
options);
77+
null,
78+
options,
79+
help.getLeftPadding(),
80+
help.getDescPadding(),
81+
null,
82+
false);
7583
System.exit(1);
7684
throw new RuntimeException("Unreachable code");
7785
}

pkgs/jnigen/lib/src/summary/summary.dart

+1-5
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,7 @@ class SummarizerCommand {
7171
final joined = paths
7272
.map((uri) => uri.toFilePath())
7373
.join(Platform.isWindows ? ';' : ':');
74-
if (option.endsWith("=")) {
75-
args.add(option + joined);
76-
} else {
77-
args.addAll([option, joined]);
78-
}
74+
args.addAll([option, '"$joined"']);
7975
}
8076
}
8177

0 commit comments

Comments
 (0)