Skip to content

Commit

Permalink
[jnigen] Fix summarizer and improve errors (#1103)
Browse files Browse the repository at this point in the history
Close #877
  • Loading branch information
HosseinYousefi committed Apr 25, 2024
1 parent 880ca30 commit 3bc1eb8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions pkgs/jnigen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

- **Breaking Change** ([#660](https://github.com/dart-lang/native/issues/660)):
Removed C-based bindings. Now all bindings are Dart-only.
- Expand constraint on `package:cli_config` to allow `^0.2.0`.
- Ignore `use_super_parameters` lint in generated files.
- Expanded constraint on `package:cli_config` to allow `^0.2.0`.
- Ignored `use_super_parameters` lint in generated files.
- Fixed a bug in summarizer and improved the display of errors.

## 0.8.0

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.github.dart_lang.jnigen.apisummarizer;

import java.io.PrintWriter;
import java.util.Arrays;
import org.apache.commons.cli.*;

Expand Down Expand Up @@ -63,15 +64,22 @@ public static SummarizerOptions parseArgs(String[] args) {
try {
cmd = parser.parse(options, args);
if (cmd.getArgs().length < 1) {
throw new ParseException("Need to specify paths to source files");
throw new ParseException("Need to specify the package or class names");
}
} catch (ParseException e) {
System.out.println(e.getMessage());
System.err.println(e.getMessage());
help.printHelp(
new PrintWriter(System.err, true),
help.getWidth(),
"java -jar <JAR> [-s <SOURCE_DIR=.>] "
+ "[-c <CLASSES_JAR>] <CLASS_OR_PACKAGE_NAMES>\n"
+ "Class or package names should be fully qualified.\n\n",
options);
null,
options,
help.getLeftPadding(),
help.getDescPadding(),
null,
false);
System.exit(1);
throw new RuntimeException("Unreachable code");
}
Expand Down
6 changes: 1 addition & 5 deletions pkgs/jnigen/lib/src/summary/summary.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ class SummarizerCommand {
final joined = paths
.map((uri) => uri.toFilePath())
.join(Platform.isWindows ? ';' : ':');
if (option.endsWith("=")) {
args.add(option + joined);
} else {
args.addAll([option, joined]);
}
args.addAll([option, '"$joined"']);
}
}

Expand Down

0 comments on commit 3bc1eb8

Please sign in to comment.