From 778ea98cec9c4526ac41cd28e973c02a97d5aea1 Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Wed, 24 Apr 2024 17:18:30 +0200 Subject: [PATCH 1/2] [jnigen] Close #877; Fix summarizer and improve errors --- .../jnigen/apisummarizer/SummarizerOptions.java | 14 +++++++++++--- pkgs/jnigen/lib/src/summary/summary.dart | 6 +----- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/SummarizerOptions.java b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/SummarizerOptions.java index 8a3e5450c..70b7408e5 100644 --- a/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/SummarizerOptions.java +++ b/pkgs/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/SummarizerOptions.java @@ -1,5 +1,6 @@ package com.github.dart_lang.jnigen.apisummarizer; +import java.io.PrintWriter; import java.util.Arrays; import org.apache.commons.cli.*; @@ -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 [-s ] " + "[-c ] \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"); } diff --git a/pkgs/jnigen/lib/src/summary/summary.dart b/pkgs/jnigen/lib/src/summary/summary.dart index 25f932d2f..87c5819e5 100644 --- a/pkgs/jnigen/lib/src/summary/summary.dart +++ b/pkgs/jnigen/lib/src/summary/summary.dart @@ -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"']); } } From 3b95b6361c58650a61b3adf00879262aa3c9ca4e Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Wed, 24 Apr 2024 17:23:29 +0200 Subject: [PATCH 2/2] Edit changelog --- pkgs/jnigen/CHANGELOG.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/jnigen/CHANGELOG.md b/pkgs/jnigen/CHANGELOG.md index 4f4752613..fb29d5f09 100644 --- a/pkgs/jnigen/CHANGELOG.md +++ b/pkgs/jnigen/CHANGELOG.md @@ -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