Skip to content

Commit feed699

Browse files
authored
[jnigen] Improve coverage (#134)
1 parent 0713d2e commit feed699

21 files changed

+764
-753
lines changed

.github/workflows/test-package.yml

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ jobs:
8787
sudo apt-get install -y clang-format
8888
- name: Install dependencies
8989
run: dart pub get
90+
- name: build in_app_java APK
91+
run: flutter build apk --target-platform=android-arm64
92+
working-directory: pkg/jnigen/example/in_app_java
93+
- name: build notification_plugin example APK
94+
run: flutter build apk --target-platform=android-arm64
95+
working-directory: pkg/jnigen/example/notification_plugin/example
9096
- name: Run VM tests
9197
run: dart test --platform vm
9298
- name: Install coverage
@@ -245,6 +251,12 @@ jobs:
245251
- run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server"
246252
- run: dart pub get
247253
- run: dart run jnigen:setup
254+
- name: build in_app_java APK
255+
run: flutter build apk --target-platform=android-arm64
256+
working-directory: pkg/jnigen/example/in_app_java
257+
- name: build notification_plugin example APK
258+
run: flutter build apk --target-platform=android-arm64
259+
working-directory: pkg/jnigen/example/notification_plugin/example
248260
- run: dart test
249261

250262
test_jni_macos_minimal:
@@ -359,63 +371,6 @@ jobs:
359371
- run: flutter pub get
360372
- run: flutter build apk
361373

362-
build_notification_plugin_example:
363-
runs-on: ubuntu-latest
364-
defaults:
365-
run:
366-
working-directory: pkg/jnigen/example/notification_plugin
367-
steps:
368-
- uses: actions/checkout@v3
369-
- uses: actions/setup-java@v2
370-
with:
371-
distribution: 'zulu'
372-
java-version: '11'
373-
- uses: subosito/flutter-action@v2
374-
with:
375-
channel: 'stable'
376-
cache: true
377-
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
378-
- run: flutter pub get
379-
- run: flutter analyze
380-
- run: flutter build apk
381-
working-directory: pkg/jnigen/example/notification_plugin/example
382-
- name: re-generate bindings
383-
run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml
384-
- name: compare generated dart bindings
385-
run: diff lib/notifications.dart _temp.dart
386-
- name: compare generated C bindings
387-
run: diff -r src/ _c
388-
389-
build_in_app_java_example:
390-
runs-on: ubuntu-latest
391-
defaults:
392-
run:
393-
working-directory: pkg/jnigen/example/in_app_java
394-
steps:
395-
- uses: actions/checkout@v3
396-
- uses: actions/setup-java@v2
397-
with:
398-
distribution: 'zulu'
399-
java-version: '11'
400-
- uses: subosito/flutter-action@v2
401-
with:
402-
channel: 'stable'
403-
cache: true
404-
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
405-
- name: install clang tools
406-
run: |
407-
sudo apt-get update -y
408-
sudo apt-get install -y clang-format
409-
- run: flutter pub get
410-
- run: flutter analyze
411-
- run: flutter build apk
412-
- name: re-generate bindings
413-
run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml
414-
- name: compare generated dart bindings
415-
run: diff lib/android_utils.dart _temp.dart
416-
- name: compare generated C bindings
417-
run: diff -r src/android_utils _c
418-
419374
run_pdfbox_example_linux:
420375
runs-on: ubuntu-latest
421376
defaults:

pkgs/jnigen/bin/jnigen.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,15 @@
33
// BSD-style license that can be found in the LICENSE file.
44

55
import 'package:jnigen/jnigen.dart';
6+
import 'package:jnigen/src/logging/logging.dart';
67

78
void main(List<String> args) async {
8-
final config = Config.parseArgs(args);
9+
Config config;
10+
try {
11+
config = Config.parseArgs(args);
12+
} on ConfigException catch (e) {
13+
log.fatal(e);
14+
return;
15+
}
916
await generateJniBindings(config);
1017
}

pkgs/jnigen/lib/src/bindings/common.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ abstract class BindingsGenerator {
207207
case Kind.typeVariable:
208208
case Kind.wildcard:
209209
throw SkipException(
210-
'Generic type parameters are not supported', t.toJson());
210+
'Generic type parameters are not supported', t.name);
211211
case Kind.array:
212212
case Kind.declared:
213213
return voidPointer;

0 commit comments

Comments
 (0)