Skip to content

Commit

Permalink
[jnigen] Improve coverage (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-hegde authored Nov 14, 2022
1 parent 1ca777f commit c41903e
Show file tree
Hide file tree
Showing 21 changed files with 764 additions and 753 deletions.
69 changes: 12 additions & 57 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ jobs:
sudo apt-get install -y clang-format
- name: Install dependencies
run: dart pub get
- name: build in_app_java APK
run: flutter build apk --target-platform=android-arm64
working-directory: pkgs/jnigen/example/in_app_java
- name: build notification_plugin example APK
run: flutter build apk --target-platform=android-arm64
working-directory: pkgs/jnigen/example/notification_plugin/example
- name: Run VM tests
run: dart test --platform vm
- name: Install coverage
Expand Down Expand Up @@ -245,6 +251,12 @@ jobs:
- run: Add-Content $env:GITHUB_PATH "$env:JAVA_HOME\bin\server"
- run: dart pub get
- run: dart run jnigen:setup
- name: build in_app_java APK
run: flutter build apk --target-platform=android-arm64
working-directory: pkgs/jnigen/example/in_app_java
- name: build notification_plugin example APK
run: flutter build apk --target-platform=android-arm64
working-directory: pkgs/jnigen/example/notification_plugin/example
- run: dart test

test_jni_macos_minimal:
Expand Down Expand Up @@ -359,63 +371,6 @@ jobs:
- run: flutter pub get
- run: flutter build apk

build_notification_plugin_example:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/jnigen/example/notification_plugin
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- run: flutter pub get
- run: flutter analyze
- run: flutter build apk
working-directory: pkgs/jnigen/example/notification_plugin/example
- name: re-generate bindings
run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml
- name: compare generated dart bindings
run: diff lib/notifications.dart _temp.dart
- name: compare generated C bindings
run: diff -r src/ _c

build_in_app_java_example:
runs-on: ubuntu-latest
defaults:
run:
working-directory: pkgs/jnigen/example/in_app_java
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
cache-key: 'flutter-:os:-:channel:-:version:-:arch:-:hash:'
- name: install clang tools
run: |
sudo apt-get update -y
sudo apt-get install -y clang-format
- run: flutter pub get
- run: flutter analyze
- run: flutter build apk
- name: re-generate bindings
run: flutter pub run jnigen -Doutput.dart.path=_temp.dart -Doutput.c.path=_c/ --config jnigen.yaml
- name: compare generated dart bindings
run: diff lib/android_utils.dart _temp.dart
- name: compare generated C bindings
run: diff -r src/android_utils _c

run_pdfbox_example_linux:
runs-on: ubuntu-latest
defaults:
Expand Down
9 changes: 8 additions & 1 deletion pkgs/jnigen/bin/jnigen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
// BSD-style license that can be found in the LICENSE file.

import 'package:jnigen/jnigen.dart';
import 'package:jnigen/src/logging/logging.dart';

void main(List<String> args) async {
final config = Config.parseArgs(args);
Config config;
try {
config = Config.parseArgs(args);
} on ConfigException catch (e) {
log.fatal(e);
return;
}
await generateJniBindings(config);
}
2 changes: 1 addition & 1 deletion pkgs/jnigen/lib/src/bindings/common.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ abstract class BindingsGenerator {
case Kind.typeVariable:
case Kind.wildcard:
throw SkipException(
'Generic type parameters are not supported', t.toJson());
'Generic type parameters are not supported', t.name);
case Kind.array:
case Kind.declared:
return voidPointer;
Expand Down
Loading

0 comments on commit c41903e

Please sign in to comment.