├── jni
├── java
│ ├── .gitignore
│ └── README.md
├── example
│ ├── linux
│ │ ├── .gitignore
│ │ ├── main.cc
│ │ ├── flutter
│ │ │ ├── generated_plugin_registrant.cc
│ │ │ ├── generated_plugin_registrant.h
│ │ │ └── generated_plugins.cmake
│ │ └── my_application.h
│ ├── README.md
│ ├── android
│ │ ├── gradle.properties
│ │ ├── app
│ │ │ └── src
│ │ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── dev
│ │ │ │ │ │ └── dart
│ │ │ │ │ │ └── jni_example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── java
│ │ │ │ │ └── com
│ │ │ │ │ └── github
│ │ │ │ │ └── dart_lang
│ │ │ │ │ └── jni_example
│ │ │ │ │ └── Toaster.java
│ │ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── .gitignore
│ │ ├── settings.gradle
│ │ └── build.gradle
│ ├── macos
│ │ ├── Runner
│ │ │ ├── Configs
│ │ │ │ ├── Debug.xcconfig
│ │ │ │ ├── Release.xcconfig
│ │ │ │ ├── Warnings.xcconfig
│ │ │ │ └── AppInfo.xcconfig
│ │ │ ├── Assets.xcassets
│ │ │ │ └── AppIcon.appiconset
│ │ │ │ │ ├── app_icon_128.png
│ │ │ │ │ ├── app_icon_16.png
│ │ │ │ │ ├── app_icon_256.png
│ │ │ │ │ ├── app_icon_32.png
│ │ │ │ │ ├── app_icon_512.png
│ │ │ │ │ ├── app_icon_64.png
│ │ │ │ │ └── app_icon_1024.png
│ │ │ ├── AppDelegate.swift
│ │ │ ├── Release.entitlements
│ │ │ ├── DebugProfile.entitlements
│ │ │ └── MainFlutterWindow.swift
│ │ ├── .gitignore
│ │ ├── Flutter
│ │ │ ├── Flutter-Debug.xcconfig
│ │ │ ├── Flutter-Release.xcconfig
│ │ │ └── GeneratedPluginRegistrant.swift
│ │ ├── Runner.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── Runner.xcodeproj
│ │ │ └── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── windows
│ │ ├── runner
│ │ │ ├── resources
│ │ │ │ └── app_icon.ico
│ │ │ ├── resource.h
│ │ │ ├── utils.h
│ │ │ ├── runner.exe.manifest
│ │ │ └── flutter_window.h
│ │ ├── flutter
│ │ │ ├── generated_plugin_registrant.cc
│ │ │ ├── generated_plugin_registrant.h
│ │ │ └── generated_plugins.cmake
│ │ └── .gitignore
│ └── .gitignore
├── android
│ ├── settings.gradle
│ ├── consumer-rules.pro
│ ├── .gitignore
│ ├── src
│ │ └── main
│ │ │ └── AndroidManifest.xml
│ └── README.md
├── lib
│ ├── src
│ │ ├── third_party
│ │ │ └── generated_bindings.dart
│ │ ├── nio
│ │ │ └── nio.dart
│ │ ├── util
│ │ │ └── util.dart
│ │ ├── lang
│ │ │ └── lang.dart
│ │ ├── build_util
│ │ │ └── build_util.dart
│ │ └── jfinal_string.dart
│ └── internal_helpers_for_jnigen.dart
├── src
│ ├── .gitignore
│ ├── README.md
│ ├── .clang-format
│ ├── include
│ │ ├── dart_version.h
│ │ ├── internal
│ │ │ └── dart_api_dl_impl.h
│ │ ├── BUILD.gn
│ │ └── analyze_snapshot_api.h
│ ├── CMakeLists.txt
│ └── jni_constants.h
├── macos
│ ├── Classes
│ │ └── jni.c
│ └── jni.podspec
├── dart_test.yaml
├── tool
│ └── wrapper_generators
│ │ └── logging.dart
├── windows
│ ├── .gitignore
│ └── CMakeLists.txt
├── analysis_options.yaml
├── ffigen_exts.yaml
├── .gitignore
└── linux
│ └── CMakeLists.txt
├── jnigen
├── android_test_runner
│ ├── android
│ │ ├── app
│ │ │ ├── .gitignore
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ ├── res
│ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── kotlin
│ │ │ │ │ │ └── com
│ │ │ │ │ │ └── github
│ │ │ │ │ │ └── dart_lang
│ │ │ │ │ │ └── jnigen
│ │ │ │ │ │ └── android_integration_test
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ ├── debug
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── profile
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ └── CMakeLists.txt
│ │ ├── gradle.properties
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── .gitignore
│ │ ├── settings.gradle
│ │ └── build.gradle
│ ├── integration_test
│ │ └── .gitignore
│ ├── README.md
│ ├── .gitignore
│ └── .metadata
├── example
│ ├── pdfbox_plugin
│ │ ├── example
│ │ │ ├── linux
│ │ │ │ ├── .gitignore
│ │ │ │ ├── main.cc
│ │ │ │ ├── flutter
│ │ │ │ │ ├── generated_plugin_registrant.cc
│ │ │ │ │ ├── generated_plugin_registrant.h
│ │ │ │ │ └── generated_plugins.cmake
│ │ │ │ └── my_application.h
│ │ │ ├── android
│ │ │ │ ├── gradle.properties
│ │ │ │ ├── app
│ │ │ │ │ └── src
│ │ │ │ │ │ ├── main
│ │ │ │ │ │ ├── res
│ │ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ └── kotlin
│ │ │ │ │ │ │ └── com
│ │ │ │ │ │ │ └── example
│ │ │ │ │ │ │ └── pdfbox_plugin_example
│ │ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ │ ├── debug
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ │ │ └── profile
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── gradle
│ │ │ │ │ └── wrapper
│ │ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── .gitignore
│ │ │ │ ├── settings.gradle
│ │ │ │ └── build.gradle
│ │ │ ├── windows
│ │ │ │ ├── runner
│ │ │ │ │ ├── resources
│ │ │ │ │ │ └── app_icon.ico
│ │ │ │ │ ├── resource.h
│ │ │ │ │ ├── utils.h
│ │ │ │ │ ├── runner.exe.manifest
│ │ │ │ │ └── flutter_window.h
│ │ │ │ ├── flutter
│ │ │ │ │ ├── generated_plugin_registrant.cc
│ │ │ │ │ ├── generated_plugin_registrant.h
│ │ │ │ │ └── generated_plugins.cmake
│ │ │ │ └── .gitignore
│ │ │ ├── .gitignore
│ │ │ └── README.md
│ │ ├── android
│ │ │ ├── settings.gradle
│ │ │ ├── .gitignore
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── AndroidManifest.xml
│ │ ├── dart_example
│ │ │ ├── CHANGELOG.md
│ │ │ ├── .gitignore
│ │ │ ├── README.md
│ │ │ ├── pubspec.yaml
│ │ │ └── analysis_options.yaml
│ │ ├── lib
│ │ │ ├── src
│ │ │ │ └── third_party
│ │ │ │ │ └── org
│ │ │ │ │ └── apache
│ │ │ │ │ └── pdfbox
│ │ │ │ │ ├── text
│ │ │ │ │ └── _package.dart
│ │ │ │ │ └── pdmodel
│ │ │ │ │ └── _package.dart
│ │ │ └── pdfbox_plugin.dart
│ │ ├── analysis_options.yaml
│ │ ├── windows
│ │ │ ├── .gitignore
│ │ │ └── CMakeLists.txt
│ │ ├── README.md
│ │ ├── src
│ │ │ ├── third_party
│ │ │ │ └── .clang-format
│ │ │ └── CMakeLists.txt
│ │ ├── .gitignore
│ │ ├── pubspec.yaml
│ │ └── linux
│ │ │ └── CMakeLists.txt
│ ├── kotlin_plugin
│ │ ├── analysis_options.yaml
│ │ ├── android
│ │ │ ├── settings.gradle
│ │ │ ├── .gitignore
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ ├── AndroidManifest.xml
│ │ │ │ └── kotlin
│ │ │ │ └── Example.kt
│ │ ├── example
│ │ │ ├── android
│ │ │ │ ├── app
│ │ │ │ │ ├── proguard-rules.pro
│ │ │ │ │ └── src
│ │ │ │ │ │ ├── main
│ │ │ │ │ │ ├── res
│ │ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ └── kotlin
│ │ │ │ │ │ │ └── com
│ │ │ │ │ │ │ └── example
│ │ │ │ │ │ │ └── kotlin_plugin
│ │ │ │ │ │ │ └── example
│ │ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ │ ├── debug
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ │ │ └── profile
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── gradle.properties
│ │ │ │ ├── gradle
│ │ │ │ │ └── wrapper
│ │ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── .gitignore
│ │ │ │ ├── settings.gradle
│ │ │ │ └── build.gradle
│ │ │ ├── pubspec.yaml
│ │ │ ├── README.md
│ │ │ ├── .gitignore
│ │ │ └── .metadata
│ │ ├── lib
│ │ │ └── kotlin_plugin.dart
│ │ ├── .metadata
│ │ ├── jnigen.yaml
│ │ ├── src
│ │ │ ├── .clang-format
│ │ │ └── CMakeLists.txt
│ │ ├── .gitignore
│ │ └── pubspec.yaml
│ ├── notification_plugin
│ │ ├── android
│ │ │ ├── settings.gradle
│ │ │ ├── .gitignore
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── AndroidManifest.xml
│ │ ├── example
│ │ │ ├── android
│ │ │ │ ├── gradle.properties
│ │ │ │ ├── app
│ │ │ │ │ └── src
│ │ │ │ │ │ ├── main
│ │ │ │ │ │ ├── res
│ │ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ └── kotlin
│ │ │ │ │ │ │ └── com
│ │ │ │ │ │ │ └── example
│ │ │ │ │ │ │ └── notification_plugin_example
│ │ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ │ ├── debug
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ │ │ └── profile
│ │ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ ├── gradle
│ │ │ │ │ └── wrapper
│ │ │ │ │ │ └── gradle-wrapper.properties
│ │ │ │ ├── .gitignore
│ │ │ │ ├── settings.gradle
│ │ │ │ └── build.gradle
│ │ │ ├── README.md
│ │ │ └── .gitignore
│ │ ├── analysis_options.yaml
│ │ ├── src
│ │ │ ├── .clang-format
│ │ │ └── CMakeLists.txt
│ │ ├── .gitignore
│ │ ├── jnigen.yaml
│ │ ├── .metadata
│ │ └── README.md
│ └── in_app_java
│ │ ├── android
│ │ ├── gradle.properties
│ │ ├── app
│ │ │ ├── src
│ │ │ │ ├── main
│ │ │ │ │ ├── res
│ │ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ │ ├── drawable
│ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ │ ├── values
│ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ │ └── values-night
│ │ │ │ │ │ │ └── styles.xml
│ │ │ │ │ ├── kotlin
│ │ │ │ │ │ └── com
│ │ │ │ │ │ │ └── example
│ │ │ │ │ │ │ └── in_app_java
│ │ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ │ └── java
│ │ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── in_app_java
│ │ │ │ │ │ └── AndroidUtils.java
│ │ │ │ ├── debug
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ │ └── profile
│ │ │ │ │ └── AndroidManifest.xml
│ │ │ └── proguard-rules.pro
│ │ ├── gradle
│ │ │ └── wrapper
│ │ │ │ └── gradle-wrapper.properties
│ │ ├── .gitignore
│ │ ├── settings.gradle
│ │ └── build.gradle
│ │ ├── src
│ │ └── android_utils
│ │ │ ├── .clang-format
│ │ │ └── CMakeLists.txt
│ │ ├── jnigen.yaml
│ │ ├── .gitignore
│ │ └── .metadata
├── test
│ ├── kotlin_test
│ │ ├── .gitignore
│ │ ├── c_based
│ │ │ └── c_bindings
│ │ │ │ ├── .clang-format
│ │ │ │ └── CMakeLists.txt
│ │ ├── kotlin
│ │ │ └── src
│ │ │ │ └── main
│ │ │ │ └── kotlin
│ │ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── dart_lang
│ │ │ │ └── jnigen
│ │ │ │ └── SuspendFun.kt
│ │ ├── runtime_test_registrant.dart
│ │ └── generated_files_test.dart
│ ├── .gitignore
│ ├── jackson_core_test
│ │ ├── .gitignore
│ │ └── third_party
│ │ │ ├── c_based
│ │ │ ├── dart_bindings
│ │ │ │ └── com
│ │ │ │ │ └── fasterxml
│ │ │ │ │ └── jackson
│ │ │ │ │ └── core
│ │ │ │ │ └── _package.dart
│ │ │ └── c_bindings
│ │ │ │ ├── .clang-format
│ │ │ │ └── CMakeLists.txt
│ │ │ └── dart_only
│ │ │ └── dart_bindings
│ │ │ └── com
│ │ │ └── fasterxml
│ │ │ └── jackson
│ │ │ └── core
│ │ │ └── _package.dart
│ ├── simple_package_test
│ │ ├── .gitignore
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── github
│ │ │ │ └── dart_lang
│ │ │ │ └── jnigen
│ │ │ │ ├── generics
│ │ │ │ ├── StringMap.java
│ │ │ │ ├── StringStack.java
│ │ │ │ ├── StringKeyedMap.java
│ │ │ │ ├── StringValuedMap.java
│ │ │ │ ├── GenericTypeParams.java
│ │ │ │ └── MyMap.java
│ │ │ │ ├── inheritance
│ │ │ │ ├── BaseClass.java
│ │ │ │ ├── SpecificDerivedClass.java
│ │ │ │ └── GenericDerivedClass.java
│ │ │ │ ├── pkg2
│ │ │ │ ├── C2.java
│ │ │ │ └── Example.java
│ │ │ │ ├── interfaces
│ │ │ │ ├── MyRunnable.java
│ │ │ │ ├── MyInterface.java
│ │ │ │ ├── MyRunnableRunner.java
│ │ │ │ └── MyInterfaceConsumer.java
│ │ │ │ ├── annotations
│ │ │ │ ├── MyDataClass.java
│ │ │ │ └── JsonSerializable.java
│ │ │ │ └── simple_package
│ │ │ │ └── Color.java
│ │ ├── c_based
│ │ │ └── c_bindings
│ │ │ │ ├── .clang-format
│ │ │ │ └── CMakeLists.txt
│ │ └── generated_files_test.dart
│ ├── README.md
│ ├── test_util
│ │ └── callback_types.dart
│ └── dart_generator_test.dart
├── cmake
│ ├── README.md
│ └── CMakeLists.txt.tmpl
├── java
│ ├── .gitignore
│ └── src
│ │ ├── main
│ │ └── java
│ │ │ └── com
│ │ │ └── github
│ │ │ └── dart_lang
│ │ │ └── jnigen
│ │ │ └── apisummarizer
│ │ │ ├── elements
│ │ │ ├── Package.java
│ │ │ ├── DeclKind.java
│ │ │ ├── TypeParam.java
│ │ │ ├── Param.java
│ │ │ ├── JavaDocComment.java
│ │ │ ├── Field.java
│ │ │ ├── JavaAnnotation.java
│ │ │ ├── KotlinTypeProjection.java
│ │ │ ├── Method.java
│ │ │ ├── KotlinValueParameter.java
│ │ │ └── KotlinTypeParameter.java
│ │ │ ├── disasm
│ │ │ ├── AsmConstants.java
│ │ │ ├── AsmAnnotatedElementVisitor.java
│ │ │ ├── AsmSummarizer.java
│ │ │ └── AsmFieldVisitor.java
│ │ │ ├── util
│ │ │ ├── SkipException.java
│ │ │ ├── InputStreamProvider.java
│ │ │ ├── JarEntryInputStreamProvider.java
│ │ │ ├── Log.java
│ │ │ ├── JsonWriter.java
│ │ │ ├── ExceptionUtil.java
│ │ │ ├── FileInputStreamProvider.java
│ │ │ └── StreamUtil.java
│ │ │ └── doclet
│ │ │ └── AstEnv.java
│ │ └── test
│ │ └── resources
│ │ └── com
│ │ └── example
│ │ └── Example.java
├── lib
│ ├── tools.dart
│ ├── src
│ │ ├── config
│ │ │ ├── config.dart
│ │ │ └── config_exception.dart
│ │ ├── tools
│ │ │ └── tools.dart
│ │ └── util
│ │ │ └── string_util.dart
│ └── jnigen.dart
├── README.md
├── dart_test.yaml
├── analysis_options.yaml
├── bin
│ ├── jnigen.dart
│ ├── setup.dart
│ └── download_maven_jars.dart
├── .gitignore
└── pubspec.yaml
├── AUTHORS
└── .github
├── dependabot.yaml
└── workflows
└── publish.yaml
/jni/java/.gitignore:
--------------------------------------------------------------------------------
1 | target/
--------------------------------------------------------------------------------
/jni/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/.gitignore:
--------------------------------------------------------------------------------
1 | .cxx
--------------------------------------------------------------------------------
/jni/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'jni'
2 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/integration_test/.gitignore:
--------------------------------------------------------------------------------
1 | runtime_test.dart
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/jni/android/consumer-rules.pro:
--------------------------------------------------------------------------------
1 | -keep class com.github.dart_lang.jni.** { *; }
2 |
--------------------------------------------------------------------------------
/jni/example/README.md:
--------------------------------------------------------------------------------
1 | # jni_example
2 | Demonstrates how to use the jni plugin.
3 |
4 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'pdfbox_plugin'
2 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'notification_plugin'
2 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/dart_example/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 1.0.0
2 |
3 | - Initial version.
4 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | *.class
3 | test_lib/
4 | test_src/
5 | target/
6 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/android/settings.gradle:
--------------------------------------------------------------------------------
1 | rootProject.name = 'notification_plugin'
2 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | -keep class kotlin.coroutines.** { *; }
2 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/lib/kotlin_plugin.dart:
--------------------------------------------------------------------------------
1 | library kotlin_plugin;
2 |
3 | export 'kotlin_bindings.dart';
4 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/text/_package.dart:
--------------------------------------------------------------------------------
1 | export "PDFTextStripper.dart";
2 |
--------------------------------------------------------------------------------
/jni/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/jni/lib/src/third_party/generated_bindings.dart:
--------------------------------------------------------------------------------
1 | export 'jni_bindings_generated.dart';
2 | export 'global_env_extensions.dart';
3 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/jni/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jnigen/test/.gitignore:
--------------------------------------------------------------------------------
1 | # TODO(#166): Remove this.
2 | !jni.jar
3 | runtime_test_registrant_dartonly_generated.dart
4 | generated_runtime_test.dart
--------------------------------------------------------------------------------
/jni/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/jnigen/test/jackson_core_test/.gitignore:
--------------------------------------------------------------------------------
1 | *.jar
2 | third_party/jar/**
3 | third_party/java/**
4 | third_party/test_lib/
5 | third_party/test_src/
6 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/lib/src/third_party/org/apache/pdfbox/pdmodel/_package.dart:
--------------------------------------------------------------------------------
1 | export "PDDocument.dart";
2 | export "PDDocumentInformation.dart";
3 |
--------------------------------------------------------------------------------
/jni/src/.gitignore:
--------------------------------------------------------------------------------
1 | CMakeFiles/
2 | Makefile
3 | cmake_install.cmake
4 | libdartjni.so
5 | CMakeCache.txt
6 | .cache
7 | compile_commands.json
8 | !.clang-format
9 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/README.md:
--------------------------------------------------------------------------------
1 | # notification_plugin_example
2 |
3 | This app demonstrates how to use the notification_plugin plugin.
4 |
5 |
--------------------------------------------------------------------------------
/jni/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/jni/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/jni/android/README.md:
--------------------------------------------------------------------------------
1 | This folder contains the [Android plugin class](src/main/java/com/github/dart_lang/jni/JniPlugin.java) which takes care of initializing JNI on Android.
2 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | *.class
3 | test_lib/
4 | test_src/
5 | *_dartonly_generated.dart ## Generated test replicas
6 | generated_runtime_test.dart
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2 | #include "ephemeral/Flutter-Generated.xcconfig"
3 |
--------------------------------------------------------------------------------
/jni/macos/Classes/jni.c:
--------------------------------------------------------------------------------
1 | // Relative import to be able to reuse the C sources.
2 | // See the comment in ../{projectName}}.podspec for more information.
3 | #include "../../src/jni.c"
4 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/java/README.md:
--------------------------------------------------------------------------------
1 | # Jni Java
2 |
3 | This is a standalone java support which includes `PortContinuation` to support
4 | converting from Kotlin's `suspend fun` to Dart's `async` functions.
5 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/jnigen/test/jackson_core_test/third_party/c_based/dart_bindings/com/fasterxml/jackson/core/_package.dart:
--------------------------------------------------------------------------------
1 | export "JsonFactory.dart";
2 | export "JsonParser.dart";
3 | export "JsonToken.dart";
4 |
--------------------------------------------------------------------------------
/jnigen/test/jackson_core_test/third_party/dart_only/dart_bindings/com/fasterxml/jackson/core/_package.dart:
--------------------------------------------------------------------------------
1 | export "JsonFactory.dart";
2 | export "JsonParser.dart";
3 | export "JsonToken.dart";
4 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/android/.gitignore:
--------------------------------------------------------------------------------
1 | *.iml
2 | .gradle
3 | /local.properties
4 | /.idea/workspace.xml
5 | /.idea/libraries
6 | .DS_Store
7 | /build
8 | /captures
9 | .cxx
10 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jni/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/android_test_runner/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/android_test_runner/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/in_app_java/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/in_app_java/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/android/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | # Below is a list of people and organizations that have contributed
2 | # to the Dart project. Names should be added to the list like so:
3 | #
4 | # Name/Organization
5 |
6 | Google LLC
7 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/android_test_runner/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/android_test_runner/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/in_app_java/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | #include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/jni/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/kotlin/dev/dart/jni_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jni_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/kotlin_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/kotlin/com/example/in_app_java/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.in_app_java
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/cmake/README.md:
--------------------------------------------------------------------------------
1 | This directory contains a CMakeLists.txt.tmpl file which will be used to generate build configuration for generated C code.
2 |
3 | `{{LIBRARY_NAME}}` in this template will be replaced by `library_name` configuration parameter.
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dart-archive/jnigen/main/jnigen/example/notification_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/jni/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/dart_example/.gitignore:
--------------------------------------------------------------------------------
1 | # Files and directories created by pub.
2 | .dart_tool/
3 | .packages
4 |
5 | # Conventional directory for build output.
6 | build/
7 |
8 | # PDF files
9 | *.pdf
10 |
11 | # AOT compiled
12 | *.exe
13 |
--------------------------------------------------------------------------------
/jni/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/jni/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/kotlin/com/example/kotlin_plugin/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.kotlin_plugin.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/kotlin/com/example/pdfbox_plugin_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.pdfbox_plugin_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jni/src/README.md:
--------------------------------------------------------------------------------
1 | Native code for jni library.
2 |
3 | ## LSP instructions
4 |
5 | see https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clangd/Installation.html#project-setup for creating compile_commands.json for use with LSP based editor plugins (in VS Code, VIM etc..).
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/android/src/main/kotlin/Example.kt:
--------------------------------------------------------------------------------
1 | import androidx.annotation.Keep
2 | import kotlinx.coroutines.*
3 |
4 | @Keep
5 | class Example {
6 | public suspend fun thinkBeforeAnswering(): String {
7 | delay(1000L)
8 | return "42"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/jni/dart_test.yaml:
--------------------------------------------------------------------------------
1 | ## Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | ## for details. All rights reserved. Use of this source code is governed by a
3 | ## BSD-style license that can be found in the LICENSE file.
4 |
5 | tags:
6 | load_test:
7 | timeout: 10x
8 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/kotlin/com/example/notification_plugin_example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.notification_plugin_example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/jnigen/java/.gitignore:
--------------------------------------------------------------------------------
1 | target/*
2 | *.class
3 | *.jar
4 |
5 | .idea/compiler.xml
6 | .idea/dictionaries
7 | .idea/inspectionProfiles/
8 | .idea/jarRepositories.xml
9 | .idea/misc.xml
10 | .idea/runConfigurations.xml
11 |
12 | .classpath ## Used for experimenting with JShell REPL
13 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/kotlin/com/github/dart_lang/jnigen/android_integration_test/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.android_integration_test
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
6 |
--------------------------------------------------------------------------------
/jni/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jni/lib/src/nio/nio.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | export 'jbuffer.dart';
6 | export 'jbyte_buffer.dart';
7 |
--------------------------------------------------------------------------------
/jnigen/lib/tools.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | library jnigen_tools;
6 |
7 | export 'src/tools/tools.dart';
8 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/jnigen/lib/src/config/config.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | export 'config_types.dart';
6 | export 'config_exception.dart';
7 |
--------------------------------------------------------------------------------
/.github/dependabot.yaml:
--------------------------------------------------------------------------------
1 | # Dependabot configuration file.
2 | # See https://docs.github.com/en/code-security/dependabot/dependabot-version-updates
3 |
4 | version: 2
5 | updates:
6 | - package-ecosystem: github-actions
7 | directory: /
8 | schedule:
9 | interval: monthly
10 | labels:
11 | - autosubmit
12 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
7 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jni/lib/src/util/util.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | export 'jiterator.dart';
6 | export 'jlist.dart';
7 | export 'jmap.dart';
8 | export 'jset.dart';
9 |
--------------------------------------------------------------------------------
/jnigen/lib/src/tools/tools.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | export 'android_sdk_tools.dart';
6 | export 'maven_tools.dart';
7 | export 'build_summarizer.dart';
8 |
--------------------------------------------------------------------------------
/jni/tool/wrapper_generators/logging.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:logging/logging.dart';
6 |
7 | final logger = Logger('ffi_wrappers_generator');
8 |
--------------------------------------------------------------------------------
/jni/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jni/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/lib/pdfbox_plugin.dart:
--------------------------------------------------------------------------------
1 | /// File merely exporting the generated bindings from lib/src/third_party
2 | library pdfbox_plugin;
3 |
4 | export 'src/third_party/org/apache/pdfbox/pdmodel/PDDocument.dart';
5 | export 'src/third_party/org/apache/pdfbox/pdmodel/PDDocumentInformation.dart';
6 | export 'src/third_party/org/apache/pdfbox/text/PDFTextStripper.dart';
7 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled and should not be manually edited.
5 |
6 | version:
7 | revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
8 | channel: beta
9 |
10 | project_type: package
11 |
--------------------------------------------------------------------------------
/jni/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | analyzer:
4 | exclude: [build/**, third_party/**]
5 | language:
6 | strict-raw-types: true
7 |
8 | linter:
9 | rules:
10 | - prefer_final_locals
11 | - prefer_const_declarations
12 | # Additional information about this file can be found at
13 | # https://dart.dev/guides/language/analysis-options
14 |
--------------------------------------------------------------------------------
/jni/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/jni/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/jni/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringMap.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | public class StringMap extends StringKeyedMap {}
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringStack.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | public class StringStack extends MyStack {}
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/inheritance/BaseClass.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.inheritance;
6 |
7 | public class BaseClass {}
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/pkg2/C2.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.pkg2;
6 |
7 | public class C2 {
8 | public static int CONSTANT = 12;
9 | }
10 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringKeyedMap.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | public class StringKeyedMap extends MyMap {}
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/StringValuedMap.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | public class StringValuedMap extends MyMap {}
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/interfaces/MyRunnable.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.interfaces;
6 |
7 | public interface MyRunnable {
8 | void run();
9 | }
10 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/jnigen.yaml:
--------------------------------------------------------------------------------
1 | android_sdk_config:
2 | add_gradle_deps: true
3 | android_example: 'example/'
4 |
5 | summarizer:
6 | backend: asm
7 |
8 | suspend_fun_to_async: true
9 |
10 | output:
11 | c:
12 | library_name: kotlin_plugin_bindings
13 | path: src/
14 | dart:
15 | path: lib/kotlin_bindings.dart
16 | structure: single_file
17 |
18 | log_level: all
19 |
20 | classes:
21 | - 'Example'
22 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/Package.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | public class Package {
8 | public String name;
9 | }
10 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/inheritance/SpecificDerivedClass.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.inheritance;
6 |
7 | public class SpecificDerivedClass extends BaseClass {}
8 |
--------------------------------------------------------------------------------
/jnigen/README.md:
--------------------------------------------------------------------------------
1 | # Experimental generator for FFI+JNI bindings.
2 |
3 | This package consists of the code generator `package:jnigen` and a few [examples](example).
4 |
5 | See the [README](../README.md) at the root of this repository for a technical introduction and usage reference.
6 |
7 | See [Architecture & Design Notes](https://github.com/dart-lang/jnigen/wiki/Architecture-&-Design-Notes) for details about architecture and inner workings of `jnigen`.
8 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/MyDataClass.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.annotations;
6 |
7 | @JsonSerializable(JsonSerializable.Case.CAMEL_CASE)
8 | public class MyDataClass {}
9 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/inheritance/GenericDerivedClass.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.inheritance;
6 |
7 | public class GenericDerivedClass extends BaseClass {}
8 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/dart_example/README.md:
--------------------------------------------------------------------------------
1 | ## Running
2 | After generating `pdfbox_plugin` bindings in the parent directory
3 |
4 | * setup native libraries: `dart run jni:setup`
5 |
6 | * `dart run bin/pdf_info.dart `
7 |
8 | Alternatively, it's possible to compile `bin/pdf_info.dart` and then run it.
9 |
10 | To run it from other directories, the `helperDir` and `classpath` parameters in `Jni.spawn` call should be adjusted appropriately.
11 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/dart_example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: pdf_info
2 | description: Dart standalone example using jnigen PDFBox bindings.
3 | version: 1.0.0
4 | publish_to: none
5 | # homepage: https://www.example.com
6 |
7 | environment:
8 | sdk: '>=3.1.0 <4.0.0'
9 |
10 | dependencies:
11 | path: ^1.8.0
12 | jni:
13 | path: ../../../../jni/
14 | pdfbox_plugin:
15 | path: ../
16 |
17 | dev_dependencies:
18 | lints: ^2.0.0
19 | test: ^1.16.0
20 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/README.md:
--------------------------------------------------------------------------------
1 | # pdfbox_plugin
2 |
3 | Example of a JNI plugin using `jnigen` to auto-generate bindings for PDFBox java library.
4 |
5 | Bindings can be generated by running `dart run jnigen --config jnigen.yaml`. Required source code and JARs will be downloaded using maven (requires `mvn` command).
6 |
7 | `jnigen` is also available as an API which tooling scripts can use. See `tool/generate_bindings.dart` for the script equivalent of the YAML file.
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/DeclKind.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | public enum DeclKind {
8 | CLASS,
9 | ENUM,
10 | INTERFACE,
11 | ANNOTATION_TYPE
12 | }
13 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/simple_package/Color.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.simple_package;
6 |
7 | public enum Color {
8 | RED,
9 | BLUE,
10 | BLACK,
11 | GREEN,
12 | YELLOW,
13 | LIME
14 | }
15 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jni/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/dart_test.yaml:
--------------------------------------------------------------------------------
1 | ## Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | ## for details. All rights reserved. Use of this source code is governed by a
3 | ## BSD-style license that can be found in the LICENSE file.
4 |
5 | ## This file defines test groups for jnigen. This will be helpful to exclude
6 | ## lengthy tests by using -x flag.
7 |
8 | tags:
9 | large_test:
10 | timeout: 2x
11 | summarizer_test:
12 | timeout: 1x
13 | runtime_test:
14 | timeout: 1x
15 |
--------------------------------------------------------------------------------
/jnigen/test/README.md:
--------------------------------------------------------------------------------
1 | ## How to run tests?
2 | #### One-time setup:
3 | ```
4 | dart run jnigen:setup
5 | ```
6 |
7 | #### Running tests
8 | ```sh
9 | dart run tool/generate_runtime_tests.dart ## Regenerates runtime test files
10 | dart test
11 | ```
12 |
13 | Note: Tests fail if summarizer is not previously built and 2 tests try to build it concurrently. We have to address it using a lock file and exponential backoff (#43). Temporarily, run `dart run jnigen:setup` before running tests for the first time.
14 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmConstants.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.disasm;
6 |
7 | import static org.objectweb.asm.Opcodes.ASM9;
8 |
9 | public class AsmConstants {
10 | static final int API = ASM9;
11 | }
12 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/jni/lib/src/lang/lang.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | export 'jboolean.dart';
6 | export 'jbyte.dart';
7 | export 'jcharacter.dart';
8 | export 'jdouble.dart';
9 | export 'jfloat.dart';
10 | export 'jinteger.dart';
11 | export 'jlong.dart';
12 | export 'jnumber.dart';
13 | export 'jshort.dart';
14 | export 'jstring.dart';
15 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/GenericTypeParams.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | public class GenericTypeParams> {}
8 |
9 | // TODO: Add more cases of generic parameters
10 |
--------------------------------------------------------------------------------
/jni/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jni/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 |
4 | publish_to: "none"
5 |
6 | version: 1.0.0+1
7 |
8 | environment:
9 | sdk: '>=3.1.0 <4.0.0'
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | kotlin_plugin:
16 | path: ../
17 |
18 | jni:
19 | path: ../../../../jni
20 |
21 | dev_dependencies:
22 | flutter_test:
23 | sdk: flutter
24 |
25 | flutter_lints: ^2.0.0
26 |
27 | flutter:
28 | uses-material-design: true
29 |
30 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/jnigen/lib/src/config/config_exception.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | /// Exception thrown when a configuration value is invalid.
6 | class ConfigException implements Exception {
7 | ConfigException(this.message);
8 | String message;
9 |
10 | @override
11 | String toString() => 'Error parsing configuration: $message';
12 | }
13 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/lib/src/util/string_util.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | extension StringUtil on String {
6 | /// Makes the first letter uppercase.
7 | String capitalize() {
8 | return '${this[0].toUpperCase()}${substring(1)}';
9 | }
10 |
11 | /// Reverses an ASCII string.
12 | String get reversed => split('').reversed.join();
13 | }
14 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ## Parent CMake for Android native build target. This will build
2 | ## all C bindings from tests.
3 |
4 | cmake_minimum_required(VERSION 3.10)
5 |
6 | project(simple_package VERSION 0.0.1 LANGUAGES C)
7 |
8 | add_subdirectory(../../../test/jackson_core_test/third_party/c_based/c_bindings jackson_core_test_build)
9 | add_subdirectory(../../../test/simple_package_test/c_based/c_bindings simple_package_test_build)
10 | add_subdirectory(../../../test/kotlin_test/c_based/c_bindings kotlin_test_build)
11 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/pkg2/Example.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | /// This class is named the same as `Example` in other package to verify the renaming works.
6 |
7 | package com.github.dart_lang.jnigen.pkg2;
8 |
9 | public class Example {
10 | public int whichExample() {
11 | return 1;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/TypeParam.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public class TypeParam {
11 | public String name;
12 | public List bounds = new ArrayList<>();
13 | }
14 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/jni/lib/internal_helpers_for_jnigen.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | /// This library exports the methods meant for use by generated code only, and
6 | /// not to be used directly.
7 | library internal_helpers_for_jnigen;
8 |
9 | export 'src/accessors.dart';
10 | export 'src/jni.dart' show ProtectedJniExtensions;
11 | export 'src/jreference.dart';
12 | export 'src/method_invocation.dart';
13 |
--------------------------------------------------------------------------------
/jnigen/test/test_util/callback_types.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | // These definitions could be in `test_util` but these are imported by android
6 | // integration tests, and we test_util imports several parts of package:jnigen.
7 |
8 | typedef TestCaseCallback = void Function();
9 | typedef TestRunnerCallback = void Function(
10 | String description,
11 | TestCaseCallback test,
12 | );
13 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/interfaces/MyInterface.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.interfaces;
6 |
7 | public interface MyInterface {
8 | void voidCallback(String s);
9 |
10 | String stringCallback(String s);
11 |
12 | T varCallback(T t);
13 |
14 | long manyPrimitives(int a, boolean b, char c, double d);
15 | }
16 |
--------------------------------------------------------------------------------
/jnigen/lib/jnigen.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | /// This library exports a high level programmatic API to jnigen, the entry
6 | /// point of which is runJniGenTask function, which takes run configuration as
7 | /// a JniGenTask.
8 | library jnigen;
9 |
10 | export 'src/elements/elements.dart';
11 | export 'src/config/config.dart';
12 | export 'src/config/filters.dart';
13 | export 'src/generate_bindings.dart';
14 |
--------------------------------------------------------------------------------
/jni/src/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/.github/workflows/publish.yaml:
--------------------------------------------------------------------------------
1 | # A CI configuration to auto-publish pub packages.
2 |
3 | name: Publish
4 |
5 | on:
6 | pull_request:
7 | branches: [ main ]
8 | push:
9 | tags: [ '[A-z]+-v[0-9]+.[0-9]+.[0-9]+' ]
10 |
11 | jobs:
12 | publish:
13 | if: ${{ github.repository_owner == 'dart-lang' }}
14 | uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main
15 | with:
16 | use-flutter: true # Since package:jni uses Flutter.
17 | permissions:
18 | id-token: write # Required for authentication using OIDC
19 | pull-requests: write # Required for writing the pull request note
20 |
--------------------------------------------------------------------------------
/jnigen/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | # for details. All rights reserved. Use of this source code is governed by a
3 | # BSD-style license that can be found in the LICENSE file.
4 |
5 | include: package:lints/recommended.yaml
6 |
7 | analyzer:
8 | exclude: [build/**, example/**]
9 | language:
10 | strict-raw-types: true
11 | strict-inference: true
12 |
13 | linter:
14 | rules:
15 | - prefer_final_locals
16 | - prefer_const_declarations
17 | - unawaited_futures
18 | - prefer_const_constructors
19 | - prefer_relative_imports
20 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/README.md:
--------------------------------------------------------------------------------
1 | ## What's this?
2 |
3 | This is Flutter app project which serves as a skeleton for running binding runtime tests on android, using Flutter's integration testing mechanism.
4 |
5 | ## How to run tests?
6 |
7 | Generate runtime test files, by running the following in parent (jnigen) directory.
8 |
9 | ```bash
10 | dart run tool/generate_runtime_tests.dart
11 | ```
12 |
13 | This will generate integration_test/runtime_test.dart in this directory, along with other runtime tests for `jnigen`. This can be run with regular integration test mechanism.
14 |
15 | ```bash
16 | flutter test integration_test/
17 | ```
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/src/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/Param.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.ArrayList;
8 | import java.util.List;
9 |
10 | public class Param {
11 | public String name;
12 | public TypeUsage type;
13 |
14 | public JavaDocComment javadoc;
15 | public List annotations = new ArrayList<>();
16 | }
17 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/src/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/src/android_utils/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13 |
14 | For help getting started with Flutter development, view the
15 | [online documentation](https://docs.flutter.dev/), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/src/third_party/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/c_based/c_bindings/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jni/ffigen_exts.yaml:
--------------------------------------------------------------------------------
1 | # Run with `dart run ffigen --config ffigen.yaml`.
2 | name: JniExtensions
3 | description: |
4 | This config is for use by the script that generates extension methods in C.
5 | This config only scans jni.h and does not do renaming etc..
6 | output: 'unused.dart'
7 | headers:
8 | entry-points:
9 | - 'third_party/jni.h' # Exports majority of JNI functions
10 | #- 'src/third_party/global_jni_env.h' # Exports GlobalJniEnv type
11 | include-directives:
12 | #- 'src/dartjni.h'
13 | #- 'src/third_party/global_jni_env.h'
14 | - 'third_party/jni.h' # jni.h from Android NDK
15 | compiler-opts:
16 | - '-Ithird_party/'
17 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/c_based/c_bindings/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/.clang-format:
--------------------------------------------------------------------------------
1 | # From dart SDK: https://github.com/dart-lang/sdk/blob/main/.clang-format
2 |
3 | # Defines the Chromium style for automatic reformatting.
4 | # http://clang.llvm.org/docs/ClangFormatStyleOptions.html
5 | BasedOnStyle: Chromium
6 |
7 | # clang-format doesn't seem to do a good job of this for longer comments.
8 | ReflowComments: 'false'
9 |
10 | # We have lots of these. Though we need to put them all in curly braces,
11 | # clang-format can't do that.
12 | AllowShortIfStatementsOnASingleLine: 'true'
13 |
14 | # Put escaped newlines into the rightmost column.
15 | AlignEscapedNewlinesLeft: false
16 |
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/jnigen/bin/jnigen.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:jnigen/jnigen.dart';
6 | import 'package:jnigen/src/logging/logging.dart';
7 |
8 | void main(List args) async {
9 | enableLoggingToFile();
10 | Config config;
11 | try {
12 | config = Config.parseArgs(args);
13 | } on ConfigException catch (e) {
14 | log.fatal(e);
15 | } on FormatException catch (e) {
16 | log.fatal(e);
17 | }
18 | await generateJniBindings(config);
19 | }
20 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/annotations/JsonSerializable.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.annotations;
6 |
7 | import java.lang.annotation.*;
8 |
9 | @Retention(RetentionPolicy.SOURCE)
10 | @Target(ElementType.TYPE)
11 | public @interface JsonSerializable {
12 | public static enum Case {
13 | SNAKE_CASE,
14 | KEBAB_CASE,
15 | CAMEL_CASE
16 | }
17 |
18 | public Case value();
19 | }
20 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/SkipException.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.util;
6 |
7 | // Generic skip exception when the code cannot decide how to handle an element.
8 | // The caller in some above layer can catch this and skip to appropriate extent.
9 | public class SkipException extends RuntimeException {
10 | public SkipException(String message) {
11 | super(message);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/JavaDocComment.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | public class JavaDocComment {
8 | // TODO(#28): Build a detailed tree representation of JavaDocComment
9 | // which can be processed by tools in other languages as well.
10 | public String comment;
11 |
12 | public JavaDocComment(String comment) {
13 | this.comment = comment;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/jni/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
32 | .vscode/
--------------------------------------------------------------------------------
/jni/src/include/dart_version.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
3 | * for details. All rights reserved. Use of this source code is governed by a
4 | * BSD-style license that can be found in the LICENSE file.
5 | */
6 |
7 | #ifndef RUNTIME_INCLUDE_DART_VERSION_H_
8 | #define RUNTIME_INCLUDE_DART_VERSION_H_
9 |
10 | // On breaking changes the major version is increased.
11 | // On backwards compatible changes the minor version is increased.
12 | // The versioning covers the symbols exposed in dart_api_dl.h
13 | #define DART_API_DL_MAJOR_VERSION 2
14 | #define DART_API_DL_MINOR_VERSION 3
15 |
16 | #endif /* RUNTIME_INCLUDE_DART_VERSION_H_ */ /* NOLINT */
17 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/InputStreamProvider.java:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.apisummarizer.util;
2 |
3 | import java.io.InputStream;
4 |
5 | /**
6 | * Implementers of this interface provide an InputStream on-demand for writing, and provide a way to
7 | * close the same.
8 | * The implementation doesn't need to be thread-safe, since this is only used in AsmSummarizer,
9 | * which reads the classes serially.
10 | */
11 | public interface InputStreamProvider {
12 | /** Return the input stream, initializing it if needed. */
13 | InputStream getInputStream();
14 |
15 | /** close the underlying InputStream. */
16 | void close();
17 | }
18 |
--------------------------------------------------------------------------------
/jni/src/include/internal/dart_api_dl_impl.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
3 | * for details. All rights reserved. Use of this source code is governed by a
4 | * BSD-style license that can be found in the LICENSE file.
5 | */
6 |
7 | #ifndef RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
8 | #define RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_
9 |
10 | typedef struct {
11 | const char* name;
12 | void (*function)(void);
13 | } DartApiEntry;
14 |
15 | typedef struct {
16 | const int major;
17 | const int minor;
18 | const DartApiEntry* const functions;
19 | } DartApi;
20 |
21 | #endif /* RUNTIME_INCLUDE_INTERNAL_DART_API_DL_IMPL_H_ */ /* NOLINT */
22 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/kotlin/src/main/kotlin/com/github/dart_lang/jnigen/SuspendFun.kt:
--------------------------------------------------------------------------------
1 | /* Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | * for details. All rights reserved. Use of this source code is governed by a
3 | * BSD-style license that can be found in the LICENSE file.
4 | */
5 |
6 | package com.github.dart_lang.jnigen
7 |
8 | import kotlinx.coroutines.delay
9 | import kotlin.coroutines.Continuation
10 |
11 | public class SuspendFun {
12 | suspend fun sayHello(): String {
13 | delay(100L)
14 | return "Hello!"
15 | }
16 |
17 | suspend fun sayHello(name: String): String {
18 | delay(100L)
19 | return "Hello $name!"
20 | }
21 | }
--------------------------------------------------------------------------------
/jni/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = jni_example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.github.dart_lang.jniExample
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.github.dart_lang. All rights reserved.
15 |
--------------------------------------------------------------------------------
/jni/src/include/BUILD.gn:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
2 | # for details. All rights reserved. Use of this source code is governed by a
3 | # BSD-style license that can be found in the LICENSE file.
4 |
5 | import("../../sdk_args.gni")
6 |
7 | # This rule copies header files to include/
8 | copy("copy_headers") {
9 | visibility = [ "../../sdk:copy_headers" ]
10 |
11 | sources = [
12 | "dart_api.h",
13 | "dart_api_dl.c",
14 | "dart_api_dl.h",
15 | "dart_native_api.h",
16 | "dart_tools_api.h",
17 | "dart_version.h",
18 | "internal/dart_api_dl_impl.h",
19 | ]
20 |
21 | outputs =
22 | [ "$root_out_dir/$dart_sdk_output/include/{{source_target_relative}}" ]
23 | }
24 |
--------------------------------------------------------------------------------
/jni/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/test/dart_generator_test.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:jnigen/src/bindings/dart_generator.dart';
6 | import 'package:test/test.dart';
7 |
8 | import 'test_util/test_util.dart';
9 |
10 | void main() async {
11 | await checkLocallyBuiltDependencies();
12 |
13 | test('OutsideInBuffer', () {
14 | final buffer = OutsideInBuffer();
15 | buffer.appendLeft('f(');
16 | buffer.prependRight('x)');
17 | buffer.appendLeft('g(');
18 | buffer.prependRight('y) + ');
19 | expect(buffer.toString(), 'f(g(y) + x)');
20 | });
21 | }
22 |
--------------------------------------------------------------------------------
/jni/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 |
26 | subprojects {
27 | project.evaluationDependsOn(':app')
28 | }
29 |
30 | tasks.register("clean", Delete) {
31 | delete rootProject.buildDir
32 | }
33 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/java/com/example/in_app_java/AndroidUtils.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.example.in_app_java;
6 |
7 | import android.app.Activity;
8 | import android.widget.Toast;
9 | import androidx.annotation.Keep;
10 |
11 | @Keep
12 | public abstract class AndroidUtils {
13 | // Hide constructor
14 | private AndroidUtils() {}
15 |
16 | public static void showToast(Activity mainActivity, CharSequence text, int duration) {
17 | mainActivity.runOnUiThread(() -> Toast.makeText(mainActivity, text, duration).show());
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/Field.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashSet;
9 | import java.util.List;
10 | import java.util.Set;
11 |
12 | public class Field {
13 | public Set modifiers = new HashSet<>();
14 | public String name;
15 | public TypeUsage type;
16 | public Object defaultValue;
17 |
18 | public JavaDocComment javadoc;
19 | public List annotations = new ArrayList<>();
20 | }
21 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.6.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.1.2'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/jnigen.yaml:
--------------------------------------------------------------------------------
1 | android_sdk_config:
2 | add_gradle_deps: true
3 | add_gradle_sources: true
4 |
5 | output:
6 | c:
7 | library_name: android_utils
8 | path: src/android_utils/
9 | dart:
10 | path: lib/android_utils.dart
11 | structure: single_file
12 |
13 | source_path:
14 | - 'android/app/src/main/java'
15 | classes:
16 | - 'com.example.in_app_java.AndroidUtils' # from source_path
17 | - 'androidx.emoji2.text.EmojiCompat' # From gradle's source path
18 | - 'androidx.emoji2.text.DefaultEmojiCompatConfig' # From gradle's source path
19 | - 'android.os.Build' # from gradle's compile classpath
20 | - 'java.util.HashMap' # from gradle's compile classpath
21 | exclude:
22 | fields:
23 | - 'android.os.Build\$VERSION_CODES#UPSIDE_DOWN_CAKE'
24 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/pubspec.yaml:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | # for details. All rights reserved. Use of this source code is governed by a
3 | # BSD-style license that can be found in the LICENSE file.
4 |
5 | name: kotlin_plugin
6 | description: Example of using jnigen to generate bindings for Kotlin.
7 | version: 0.0.1
8 | publish_to: none
9 |
10 | environment:
11 | sdk: '>=3.1.0 <4.0.0'
12 | flutter: ">=1.17.0"
13 |
14 | dependencies:
15 | flutter:
16 | sdk: flutter
17 | jni:
18 | path: ../../../jni
19 |
20 | dev_dependencies:
21 | flutter_test:
22 | sdk: flutter
23 | flutter_lints: ^2.0.0
24 | jnigen:
25 | path: ../../
26 |
27 | flutter:
28 | plugin:
29 | platforms:
30 | android:
31 | ffiPlugin: true
32 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/JavaAnnotation.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | public class JavaAnnotation {
11 | public String binaryName;
12 | public Map properties = new HashMap<>();
13 |
14 | public static class EnumVal {
15 | public String enumClass;
16 | public String value;
17 |
18 | public EnumVal(String enumClass, String value) {
19 | this.enumClass = enumClass;
20 | this.value = value;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/jnigen.yaml:
--------------------------------------------------------------------------------
1 | android_sdk_config:
2 | add_gradle_deps: true
3 | android_example: 'example/'
4 |
5 | preamble: |
6 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
7 | // for details. All rights reserved. Use of this source code is governed by a
8 | // BSD-style license that can be found in the LICENSE file.
9 |
10 | source_path:
11 | - 'android/src/main/java'
12 | classes:
13 | - 'com.example.notification_plugin.Notifications'
14 |
15 | output:
16 | c:
17 | path: 'src/'
18 | library_name: notification_plugin
19 | dart:
20 | path: 'lib/notifications.dart'
21 | ## Output to single file instead of recreating source's file structure.
22 | ## This will be useful to reduce clutter when binding a small number of
23 | ## classes.
24 | structure: 'single_file'
25 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinTypeProjection.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import kotlinx.metadata.KmTypeProjection;
8 | import kotlinx.metadata.KmVariance;
9 |
10 | public class KotlinTypeProjection {
11 | public KotlinType type;
12 | public KmVariance variance;
13 |
14 | public static KotlinTypeProjection fromKmTypeProjection(KmTypeProjection t) {
15 | var proj = new KotlinTypeProjection();
16 | proj.type = KotlinType.fromKmType(t.getType());
17 | proj.variance = t.getVariance();
18 | return proj;
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/interfaces/MyRunnableRunner.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.interfaces;
6 |
7 | public class MyRunnableRunner {
8 | final MyRunnable runnable;
9 |
10 | public Throwable error;
11 |
12 | public MyRunnableRunner(MyRunnable runnable) {
13 | this.runnable = runnable;
14 | }
15 |
16 | public void runOnSameThread() {
17 | try {
18 | runnable.run();
19 | } catch (Throwable e) {
20 | error = e;
21 | }
22 | }
23 |
24 | public void runOnAnotherThread() {
25 | var thread = new Thread(this::runOnSameThread);
26 | thread.start();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/jni/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | jni
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/jni/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | jni
10 | )
11 |
12 | set(PLUGIN_BUNDLED_LIBRARIES)
13 |
14 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
15 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
16 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
19 | endforeach(plugin)
20 |
21 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
22 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
23 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
24 | endforeach(ffi_plugin)
25 |
--------------------------------------------------------------------------------
/jnigen/bin/setup.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:io';
6 |
7 | import 'package:jnigen/src/logging/logging.dart';
8 | import 'package:jnigen/src/tools/tools.dart';
9 | import 'package:logging/logging.dart';
10 |
11 | void main(List args) async {
12 | bool force = false;
13 | setLoggingLevel(Level.INFO);
14 | if (args.isNotEmpty) {
15 | if (args.length != 1 || args[0] != '-f') {
16 | stderr.writeln('usage: dart run jnigen:setup [-f]');
17 | stderr.writeln('* -f\trebuild ApiSummarizer jar even if it already '
18 | 'exists.');
19 | } else {
20 | force = true;
21 | }
22 | }
23 | await buildSummarizerIfNotExists(force: force);
24 | }
25 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/Method.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashSet;
9 | import java.util.List;
10 | import java.util.Set;
11 |
12 | public class Method {
13 | public Set modifiers = new HashSet<>();
14 | public String name;
15 | public String descriptor;
16 | public List typeParams = new ArrayList<>();
17 | public List params = new ArrayList<>();
18 | public TypeUsage returnType;
19 |
20 | public JavaDocComment javadoc;
21 | public List annotations = new ArrayList<>();
22 | }
23 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/JarEntryInputStreamProvider.java:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.apisummarizer.util;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 | import java.util.jar.JarFile;
6 | import java.util.zip.ZipEntry;
7 |
8 | public class JarEntryInputStreamProvider implements InputStreamProvider {
9 |
10 | private final JarFile jarFile;
11 | private final ZipEntry zipEntry;
12 |
13 | public JarEntryInputStreamProvider(JarFile jarFile, ZipEntry zipEntry) {
14 | this.jarFile = jarFile;
15 | this.zipEntry = zipEntry;
16 | }
17 |
18 | @Override
19 | public InputStream getInputStream() {
20 | try {
21 | return jarFile.getInputStream(zipEntry);
22 | } catch (IOException e) {
23 | throw new RuntimeException(e);
24 | }
25 | }
26 |
27 | @Override
28 | public void close() {}
29 | }
30 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
26 | /pubspec.lock
27 | **/doc/api/
28 | .dart_tool/
29 | .packages
30 | build/
31 |
32 | ## Downloaded by jnigen
33 | /mvn_java/
34 | /mvn_jar/
35 | ## Sometimes generated by maven.
36 | ## TODO(#34) This is unwanted.
37 | /target/
38 |
39 | # Builds & downloads
40 | *.pdf
41 | *.jar
42 | *.exe
43 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | jni
10 | pdfbox_plugin
11 | )
12 |
13 | set(PLUGIN_BUNDLED_LIBRARIES)
14 |
15 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
20 | endforeach(plugin)
21 |
22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
25 | endforeach(ffi_plugin)
26 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # This is the rules file which prevents `proguard` from aggressively
2 | # removing the classes which appear to be unused, in release mode.
3 | #
4 | # Since JNI is based on runtime lookup for classes, proguard will not have
5 | # a way to know EmojiCompat class in our example is actually used. Therefore
6 | # we have to explicitly list it in this file to prevent the application from
7 | # crashing with ClassNotFoundException.
8 | #
9 | # This doesn't apply to builtin classes, eg: those in `android.` namespace Since
10 | # they are already present on the device.
11 | # For the Java code which is written by yourself, you can add `androidx.annotation.Keep`
12 | # instead. (As done in `AndroidUtils.java`).
13 | #
14 | # For more details, see
15 | # http://developer.android.com/guide/developing/tools/proguard.html
16 |
17 | -keep class androidx.emoji2.text.EmojiCompat { public *; }
18 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | jni
10 | pdfbox_plugin
11 | )
12 |
13 | set(PLUGIN_BUNDLED_LIBRARIES)
14 |
15 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
20 | endforeach(plugin)
21 |
22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
25 | endforeach(ffi_plugin)
26 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/jni/lib/src/build_util/build_util.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | // Any shared build logic should be here. This way it can be reused across bin/,
6 | // tool/ and test/.
7 |
8 | import 'dart:io';
9 |
10 | const ansiRed = '\x1b[31m';
11 | const ansiDefault = '\x1b[39;49m';
12 |
13 | /// Returns true if [artifact] does not exist, or any file in [sourceDir] is
14 | /// newer than [artifact].
15 | bool needsBuild(File artifact, Directory sourceDir) {
16 | if (!artifact.existsSync()) return true;
17 | final fileLastModified = artifact.lastModifiedSync();
18 | for (final entry in sourceDir.listSync(recursive: true)) {
19 | if (entry.statSync().modified.isAfter(fileLastModified)) {
20 | return true;
21 | }
22 | }
23 | return false;
24 | }
25 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/generated_files_test.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:jnigen/jnigen.dart';
6 | import 'package:test/test.dart';
7 |
8 | import 'generate.dart';
9 | import '../test_util/test_util.dart';
10 |
11 | void main() async {
12 | await checkLocallyBuiltDependencies();
13 |
14 | generateAndCompareBothModes(
15 | 'Generate and compare bindings for simple_package java files',
16 | getConfig(BindingsType.cBased),
17 | getConfig(BindingsType.dartOnly),
18 | );
19 |
20 | test("Generate and analyze bindings for simple_package - pure dart",
21 | () async {
22 | await generateAndAnalyzeBindings(
23 | getConfig(BindingsType.dartOnly),
24 | );
25 | }); // test if generated file == expected file
26 | }
27 |
--------------------------------------------------------------------------------
/jni/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/Log.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.util;
6 |
7 | import java.util.logging.Level;
8 | import java.util.logging.Logger;
9 |
10 | public class Log {
11 | private static final Logger logger = Logger.getLogger("ApiSummarizer");
12 |
13 | private static void log(Level level, String format, Object... args) {
14 | String formatted = String.format(format, args);
15 | logger.log(level, formatted);
16 | }
17 |
18 | public static void info(String format, Object... args) {
19 | log(Level.INFO, format, args);
20 | }
21 |
22 | public static void warning(String format, Object... args) {
23 | log(Level.WARNING, format, args);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/jni/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/jnigen/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://www.dartlang.org/guides/libraries/private-files
2 |
3 | # Files and directories created by pub.
4 | .dart_tool/
5 | .packages
6 | build/
7 | pubspec.lock
8 | .flutter-plugins
9 | .flutter-plugins-dependencies
10 |
11 | # created by maven
12 | /target/
13 |
14 | # Directory created by dartdoc.
15 | doc/api/
16 |
17 | # Avoid committing generated Javascript files:
18 | *.dart.js
19 | *.info.json # Produced by the --dump-info flag.
20 | *.js # When generated by dart2js. Don't specify *.js if your
21 | # project includes source files written in JavaScript.
22 | *.js_
23 | *.js.deps
24 | *.js.map
25 |
26 | # IDE and debugger files.
27 | .clangd
28 | .gdb_history
29 | .history
30 | .vscode
31 | compile_commands.json
32 |
33 | # IntelliJ
34 | *.iml
35 | *.ipr
36 | *.iws
37 | .idea/
38 |
39 | # Mac
40 | .DS_Store
41 |
42 | # Vim
43 | .*.swp
44 |
45 | ## Downloaded files and build artifacts
46 | *.jar
47 | *.class
48 | *.exe
49 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
--------------------------------------------------------------------------------
/jnigen/pubspec.yaml:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | # for details. All rights reserved. Use of this source code is governed by a
3 | # BSD-style license that can be found in the LICENSE file.
4 |
5 | name: jnigen
6 | description: A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine.
7 | version: 0.8.0-wip
8 | repository: https://github.com/dart-lang/jnigen/tree/main/jnigen
9 |
10 | environment:
11 | sdk: ">=3.1.0 <4.0.0"
12 |
13 | topics:
14 | - interop
15 | - ffi
16 | - codegen
17 | - java
18 | - jni
19 |
20 | dependencies:
21 | json_annotation: ^4.8.0
22 | package_config: ^2.1.0
23 | path: ^1.8.0
24 | pub_semver: ^2.1.4
25 | args: ^2.3.0
26 | yaml: ^3.1.0
27 | logging: ^1.0.2
28 | meta: ^1.8.0
29 | cli_config: ^0.1.0
30 |
31 | dev_dependencies:
32 | lints: ^2.0.0
33 | jni:
34 | path: ../jni
35 | test: ^1.24.1
36 | build_runner: ^2.2.0
37 | json_serializable: ^6.6.0
38 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/JsonWriter.java:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.apisummarizer.util;
2 |
3 | import com.fasterxml.jackson.annotation.JsonInclude;
4 | import com.fasterxml.jackson.databind.ObjectMapper;
5 | import com.fasterxml.jackson.databind.SerializationFeature;
6 | import com.github.dart_lang.jnigen.apisummarizer.elements.ClassDecl;
7 | import java.io.IOException;
8 | import java.io.OutputStream;
9 | import java.util.List;
10 |
11 | public class JsonWriter {
12 | public static void writeJSON(List classes, OutputStream output) {
13 | var mapper = new ObjectMapper();
14 | Log.info("Writing JSON for %d classes", classes.size());
15 | mapper.enable(SerializationFeature.INDENT_OUTPUT);
16 | mapper.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
17 | try {
18 | mapper.writeValue(output, classes);
19 | } catch (IOException e) {
20 | e.printStackTrace();
21 | }
22 | Log.info("Finished");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/interfaces/MyInterfaceConsumer.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.interfaces;
6 |
7 | public class MyInterfaceConsumer {
8 | public static void consumeOnAnotherThread(
9 | MyInterface myInterface, String s, int a, boolean b, char c, double d, T t) {
10 | var thread = new Thread(() -> consumeOnSameThread(myInterface, s, a, b, c, d, t));
11 | thread.start();
12 | }
13 |
14 | public static void consumeOnSameThread(
15 | MyInterface myInterface, String s, int a, boolean b, char c, double d, T t) {
16 | String result = myInterface.stringCallback(s);
17 | myInterface.voidCallback(result);
18 | myInterface.manyPrimitives(a, b, c, d);
19 | myInterface.varCallback(t);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/jni/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The Flutter tooling requires that developers have CMake 3.10 or later
2 | # installed. You should not increase this version, as doing so will cause
3 | # the plugin to fail to compile for some customers of the plugin.
4 | cmake_minimum_required(VERSION 3.10)
5 |
6 | # Project-level configuration.
7 | set(PROJECT_NAME "jni")
8 | project(${PROJECT_NAME} LANGUAGES CXX)
9 |
10 | # Invoke the build for native code shared with the other target platforms.
11 | # This can be changed to accomodate different builds.
12 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
13 |
14 | # List of absolute paths to libraries that should be bundled with the plugin.
15 | # This list could contain prebuilt libraries, or libraries created by an
16 | # external build triggered from this build file.
17 | set(jni_bundled_libraries
18 | # Defined in ../src/CMakeLists.txt.
19 | # This can be changed to accomodate different builds.
20 | $
21 | PARENT_SCOPE
22 | )
23 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: pdfbox_plugin
2 | description: |
3 | Example of using jnigen to generate bindings for a non-trivial Java library.
4 | version: 0.0.1
5 | publish_to: none
6 | homepage: https://github.com/dart-lang/jnigen
7 |
8 | environment:
9 | sdk: '>=3.1.0 <4.0.0'
10 | #flutter: ">=2.11.0"
11 |
12 | dependencies:
13 | jni:
14 | path: ../../../jni/
15 | #flutter:
16 | #sdk: flutter
17 | plugin_platform_interface: ^2.0.2
18 |
19 | dev_dependencies:
20 | ## Path dependency for sake of the example
21 | jnigen:
22 | path: ../../
23 | test: any
24 | lints: ^2.0.0
25 |
26 | flutter:
27 | # A JNI plugin uses FFI for calling into C code. Thus the relevant shared
28 | # library artifacts must be bundled with final application.
29 | # Please refer to README.md for a detailed explanation.
30 | plugin:
31 | platforms:
32 | android:
33 | ffiPlugin: true
34 | linux:
35 | ffiPlugin: true
36 | windows:
37 | ffiPlugin: true
38 |
39 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinValueParameter.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import kotlinx.metadata.KmValueParameter;
8 |
9 | public class KotlinValueParameter {
10 | public String name;
11 | public int flags;
12 | public KotlinType type;
13 | public KotlinType varargElementType;
14 |
15 | public static KotlinValueParameter fromKmValueParameter(KmValueParameter p) {
16 | if (p == null) return null;
17 | var param = new KotlinValueParameter();
18 | param.name = p.getName();
19 | param.flags = p.getFlags();
20 | param.type = KotlinType.fromKmType(p.getType());
21 | param.varargElementType = KotlinType.fromKmType(p.getVarargElementType());
22 | return param;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/c_based/c_bindings/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(kotlin VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(kotlin SHARED
11 | "./kotlin.c"
12 | )
13 |
14 | set_target_properties(kotlin PROPERTIES
15 | OUTPUT_NAME "kotlin"
16 | )
17 |
18 | target_compile_definitions(kotlin PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(kotlin log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(kotlin ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/ExceptionUtil.java:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.apisummarizer.util;
2 |
3 | public class ExceptionUtil {
4 | @FunctionalInterface
5 | public interface CheckedFunction {
6 | R function(T value) throws Exception;
7 | }
8 |
9 | @FunctionalInterface
10 | public interface CheckedRunnable {
11 | void run() throws Exception;
12 | }
13 |
14 | /**
15 | * Wraps a function throwing a checked exception and throws all checked exceptions as runtime
16 | * exceptions.
17 | */
18 | public static R wrapCheckedException(CheckedFunction function, T value) {
19 | try {
20 | return function.function(value);
21 | } catch (Exception e) {
22 | throw new RuntimeException(e);
23 | }
24 | }
25 |
26 | public static void wrapCheckedException(CheckedRunnable runnable) {
27 | try {
28 | runnable.run();
29 | } catch (Exception e) {
30 | throw new RuntimeException(e);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/FileInputStreamProvider.java:
--------------------------------------------------------------------------------
1 | package com.github.dart_lang.jnigen.apisummarizer.util;
2 |
3 | import java.io.*;
4 |
5 | /** Implementation of InputStreamProvider backed by a File. */
6 | public class FileInputStreamProvider implements InputStreamProvider {
7 | File file;
8 | InputStream stream;
9 |
10 | public FileInputStreamProvider(File file) {
11 | this.file = file;
12 | }
13 |
14 | @Override
15 | public InputStream getInputStream() {
16 | if (stream == null) {
17 | try {
18 | stream = new FileInputStream(file);
19 | } catch (FileNotFoundException e) {
20 | throw new RuntimeException(e);
21 | }
22 | }
23 | return stream;
24 | }
25 |
26 | @Override
27 | public void close() {
28 | if (stream == null) {
29 | return;
30 | }
31 | try {
32 | stream.close();
33 | stream = null;
34 | } catch (IOException e) {
35 | throw new RuntimeException(e);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/jni/lib/src/jfinal_string.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:ffi';
6 |
7 | import 'jreference.dart';
8 | import 'lang/jstring.dart';
9 | import 'third_party/generated_bindings.dart';
10 |
11 | /// Used for `static final` Java strings, where the constant string is
12 | /// available.
13 | ///
14 | /// If only its value is used using [toDartString], the [reference] is never
15 | /// populated, saving a method call.
16 | class JFinalString extends JString with JLazyReference {
17 | @override
18 | final JObjectPtr Function() lazyReference;
19 |
20 | final String string;
21 |
22 | JFinalString(this.lazyReference, this.string) : super.fromRef(nullptr);
23 |
24 | @override
25 | String toDartString({bool releaseOriginal = false}) {
26 | if (releaseOriginal) {
27 | release();
28 | }
29 | return string;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Web related
36 | lib/generated_plugin_registrant.dart
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 |
49 | ## Generated by build process
50 | android/app/.cxx
51 |
--------------------------------------------------------------------------------
/jni/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The Flutter tooling requires that developers have a version of Visual Studio
2 | # installed that includes CMake 3.14 or later. You should not increase this
3 | # version, as doing so will cause the plugin to fail to compile for some
4 | # customers of the plugin.
5 | cmake_minimum_required(VERSION 3.14)
6 |
7 | # Project-level configuration.
8 | set(PROJECT_NAME "jni")
9 | project(${PROJECT_NAME} LANGUAGES CXX)
10 |
11 | # Invoke the build for native code shared with the other target platforms.
12 | # This can be changed to accomodate different builds.
13 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
14 |
15 | # List of absolute paths to libraries that should be bundled with the plugin.
16 | # This list could contain prebuilt libraries, or libraries created by an
17 | # external build triggered from this build file.
18 | set(jni_bundled_libraries
19 | # Defined in ../src/CMakeLists.txt.
20 | # This can be changed to accomodate different builds.
21 | $
22 | PARENT_SCOPE
23 | )
24 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/java/com/github/dart_lang/jni_example/Toaster.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jni_example;
6 |
7 | import android.app.Activity;
8 | import android.content.Context;
9 | import android.widget.Toast;
10 | import androidx.annotation.Keep;
11 |
12 | @Keep
13 | class Toaster {
14 | static Toaster makeText(Activity mainActivity, Context context, CharSequence text, int duration) {
15 | Toaster toast = new Toaster();
16 | toast.mainActivity = mainActivity;
17 | toast.context = context;
18 | toast.text = text;
19 | toast.duration = duration;
20 | return toast;
21 | }
22 |
23 | void show() {
24 | mainActivity.runOnUiThread(() -> Toast.makeText(context, text, duration).show());
25 | }
26 |
27 | Activity mainActivity;
28 | Context context;
29 | CharSequence text;
30 | int duration;
31 | }
32 |
--------------------------------------------------------------------------------
/jni/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(jni_library VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(jni SHARED
11 | "dartjni.c"
12 | "third_party/global_jni_env.c"
13 | "include/dart_api_dl.c"
14 | )
15 |
16 | set_target_properties(jni PROPERTIES
17 | PUBLIC_HEADER dartjni.h
18 | OUTPUT_NAME "dartjni"
19 | )
20 |
21 | target_compile_definitions(jni PUBLIC DART_SHARED_LIB)
22 |
23 | if(WIN32)
24 | set_target_properties(${TARGET_NAME} PROPERTIES
25 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
26 | endif()
27 |
28 | if (ANDROID)
29 | target_link_libraries(jni log)
30 | else()
31 | find_package(Java REQUIRED)
32 | find_package(JNI REQUIRED)
33 | include_directories(${JNI_INCLUDE_DIRS})
34 | target_link_libraries(jni ${JNI_LIBRARIES})
35 | endif()
36 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: f72efea43c3013323d1b95cff571f3c1caa37583
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
17 | base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
18 | - platform: android
19 | create_revision: f72efea43c3013323d1b95cff571f3c1caa37583
20 | base_revision: f72efea43c3013323d1b95cff571f3c1caa37583
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: f1875d570e39de09040c8f79aa13cc56baab8db1
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
17 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
18 | - platform: android
19 | create_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
20 | base_revision: f1875d570e39de09040c8f79aa13cc56baab8db1
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The Flutter tooling requires that developers have CMake 3.10 or later
2 | # installed. You should not increase this version, as doing so will cause
3 | # the plugin to fail to compile for some customers of the plugin.
4 | cmake_minimum_required(VERSION 3.10)
5 |
6 | # Project-level configuration.
7 | set(PROJECT_NAME "pdfbox_plugin")
8 | project(${PROJECT_NAME} LANGUAGES CXX)
9 |
10 | # Invoke the build for native code shared with the other target platforms.
11 | # This can be changed to accomodate different builds.
12 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
13 |
14 | # List of absolute paths to libraries that should be bundled with the plugin.
15 | # This list could contain prebuilt libraries, or libraries created by an
16 | # external build triggered from this build file.
17 | set(pdfbox_plugin_bundled_libraries
18 | # Defined in ../src/CMakeLists.txt.
19 | # This can be changed to accomodate different builds.
20 | $
21 | PARENT_SCOPE
22 | )
23 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/src/android_utils/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(android_utils VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(android_utils SHARED
11 | "./android_utils.c"
12 | )
13 |
14 | set_target_properties(android_utils PROPERTIES
15 | OUTPUT_NAME "android_utils"
16 | )
17 |
18 | target_compile_definitions(android_utils PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(android_utils log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(android_utils ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(pdfbox_plugin VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(pdfbox_plugin SHARED
11 | "third_party//pdfbox_plugin.c"
12 | )
13 |
14 | set_target_properties(pdfbox_plugin PROPERTIES
15 | OUTPUT_NAME "pdfbox_plugin"
16 | )
17 |
18 | target_compile_definitions(pdfbox_plugin PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(pdfbox_plugin log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(pdfbox_plugin ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmAnnotatedElementVisitor.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.disasm;
6 |
7 | import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation;
8 | import org.objectweb.asm.AnnotationVisitor;
9 | import org.objectweb.asm.Type;
10 |
11 | // This interface removes some repetitive code using default methods
12 |
13 | public interface AsmAnnotatedElementVisitor {
14 | void addAnnotation(JavaAnnotation annotation);
15 |
16 | default AnnotationVisitor visitAnnotationDefault(String descriptor, boolean visible) {
17 | var annotation = new JavaAnnotation();
18 | var aType = Type.getType(descriptor);
19 | annotation.binaryName = aType.getClassName();
20 | addAnnotation(annotation);
21 | return new AsmAnnotationVisitor(annotation);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/jnigen/cmake/CMakeLists.txt.tmpl:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project({{LIBRARY_NAME}} VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library({{LIBRARY_NAME}} SHARED
11 | "{{SUBDIR}}/{{LIBRARY_NAME}}.c"
12 | )
13 |
14 | set_target_properties({{LIBRARY_NAME}} PROPERTIES
15 | OUTPUT_NAME "{{LIBRARY_NAME}}"
16 | )
17 |
18 | target_compile_definitions({{LIBRARY_NAME}} PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries({{LIBRARY_NAME}} log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries({{LIBRARY_NAME}} ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
8 | channel: beta
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
17 | base_revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
18 | - platform: android
19 | create_revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
20 | base_revision: 9b4416aaa79bf984d06aa40ab515a274a50a75a7
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/jnigen/test/jackson_core_test/third_party/c_based/c_bindings/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(jackson_core VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(jackson_core SHARED
11 | "./jackson_core.c"
12 | )
13 |
14 | set_target_properties(jackson_core PROPERTIES
15 | OUTPUT_NAME "jackson_core"
16 | )
17 |
18 | target_compile_definitions(jackson_core PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(jackson_core log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(jackson_core ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
8 | channel: stable
9 |
10 | project_type: plugin_ffi
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
17 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
18 | - platform: android
19 | create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
20 | base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
21 |
22 | # User provided section
23 |
24 | # List of Local paths (relative to this file) that should be
25 | # ignored by the migrate tool.
26 | #
27 | # Files that are not part of the templates will be ignored by default.
28 | unmanaged_files:
29 | - 'lib/main.dart'
30 | - 'ios/Runner.xcodeproj/project.pbxproj'
31 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/runtime_test_registrant.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:test/test.dart';
6 | import 'package:jni/jni.dart';
7 |
8 | import '../test_util/callback_types.dart';
9 |
10 | import 'c_based/dart_bindings/kotlin.dart';
11 |
12 | void registerTests(String groupName, TestRunnerCallback test) {
13 | group(groupName, () {
14 | test('Suspend functions', () async {
15 | await using((arena) async {
16 | final suspendFun = SuspendFun()..releasedBy(arena);
17 | final hello = await suspendFun.sayHello();
18 | expect(hello.toDartString(releaseOriginal: true), "Hello!");
19 | const name = "Bob";
20 | final helloBob =
21 | await suspendFun.sayHello1(name.toJString()..releasedBy(arena));
22 | expect(helloBob.toDartString(releaseOriginal: true), "Hello $name!");
23 | });
24 | });
25 | });
26 | }
27 |
--------------------------------------------------------------------------------
/jni/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/util/StreamUtil.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.util;
6 |
7 | import java.util.*;
8 | import java.util.function.Function;
9 | import java.util.stream.Collectors;
10 |
11 | public class StreamUtil {
12 | public static List map(List list, Function function) {
13 | return list.stream().map(function).collect(Collectors.toList());
14 | }
15 |
16 | public static List map(T[] array, Function function) {
17 | return Arrays.stream(array).map(function).collect(Collectors.toList());
18 | }
19 |
20 | public static List flattenListValues(Map> map) {
21 | return map.values().stream()
22 | .filter(Objects::nonNull)
23 | .flatMap(Collection::stream)
24 | .collect(Collectors.toList());
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/c_based/c_bindings/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(simple_package VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(simple_package SHARED
11 | "./simple_package.c"
12 | )
13 |
14 | set_target_properties(simple_package PROPERTIES
15 | OUTPUT_NAME "simple_package"
16 | )
17 |
18 | target_compile_definitions(simple_package PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(simple_package log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(simple_package ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jni/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/README.md:
--------------------------------------------------------------------------------
1 | # notification_plugin
2 |
3 | Example of Android plugin project with jnigen.
4 |
5 | This plugin project contains [custom code](android/src/main/java/com/example/notification_plugin) which uses the Android libraries. The bindings are generated using [jnigen config](jnigen.yaml) and then used in [flutter example](example/lib/main.dart), with help of `package:jni` APIs.
6 |
7 | The command to regenerate JNI bindings is:
8 | ```
9 | flutter pub run jnigen --config jnigen.yaml # run from notification_plugin project root
10 | ```
11 |
12 | The `example/` app must be built at least once in _release_ mode (eg `flutter build apk`) before running jnigen. This is the equivalent of Gradle Sync in Android Studio, and enables `jnigen` to run a Gradle stub and determine release build's classpath, which contains the paths to relevant dependencies. Therefore a build must have been run after cleaning build directories, or updating Java dependencies. This is a known complexity of the Gradle build system, and if you know a solution, please contribute to issue discussion at #33.
13 |
14 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/doclet/AstEnv.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.doclet;
6 |
7 | import com.sun.source.util.DocTrees;
8 | import javax.lang.model.util.Elements;
9 | import javax.lang.model.util.Types;
10 | import jdk.javadoc.doclet.DocletEnvironment;
11 |
12 | /** Class to hold utility classes initialized from DocletEnvironment. */
13 | public class AstEnv {
14 | public final Types types;
15 | public final Elements elements;
16 | public final DocTrees trees;
17 |
18 | public AstEnv(Types types, Elements elements, DocTrees trees) {
19 | this.types = types;
20 | this.elements = elements;
21 | this.trees = trees;
22 | }
23 |
24 | public static AstEnv fromEnvironment(DocletEnvironment env) {
25 | return new AstEnv(env.getTypeUtils(), env.getElementUtils(), env.getDocTrees());
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/java/src/test/resources/com/example/Example.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.example;
6 |
7 | public class Example {
8 | public static final boolean staticFinalField = true;
9 |
10 | public Example(int instanceField) {
11 | this.instanceField = instanceField;
12 | }
13 |
14 | public static String staticField = "hello";
15 |
16 | public static String getStaticField() {
17 | return staticField;
18 | }
19 |
20 | public int instanceField;
21 |
22 | public int getInstanceField() {
23 | return instanceField;
24 | }
25 |
26 | protected int overrideableMethod(int x, int y) {}
27 |
28 | int defaultAccessNotVisible();
29 |
30 | private int privateAccessNotVisible();
31 |
32 | public static class Aux extends Example {
33 | public static int nothing = 0;
34 |
35 | public static Example getAnExample() {
36 | return new Example();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/jnigen/test/kotlin_test/generated_files_test.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'package:jnigen/jnigen.dart';
6 | import 'package:test/test.dart';
7 |
8 | import 'generate.dart';
9 | import '../test_util/test_util.dart';
10 |
11 | void main() async {
12 | // This is not run in setupAll, because we want to exit with one line of
13 | // error message, not throw a long exception.
14 | await checkLocallyBuiltDependencies();
15 | generateAndCompareBothModes(
16 | 'Generate and compare bindings for kotlin_test',
17 | getConfig(BindingsType.cBased),
18 | getConfig(BindingsType.dartOnly),
19 | );
20 | test(
21 | "Generate and analyze bindings for kotlin_test - pure dart",
22 | () async {
23 | await generateAndAnalyzeBindings(
24 | getConfig(BindingsType.dartOnly),
25 | );
26 | },
27 | timeout: const Timeout.factor(1.5),
28 | tags: largeTestTag,
29 | );
30 | }
31 |
--------------------------------------------------------------------------------
/jnigen/android_test_runner/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/in_app_java/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(notification_plugin VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(notification_plugin SHARED
11 | "./notification_plugin.c"
12 | )
13 |
14 | set_target_properties(notification_plugin PROPERTIES
15 | OUTPUT_NAME "notification_plugin"
16 | )
17 |
18 | target_compile_definitions(notification_plugin PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(notification_plugin log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(notification_plugin ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The Flutter tooling requires that developers have a version of Visual Studio
2 | # installed that includes CMake 3.14 or later. You should not increase this
3 | # version, as doing so will cause the plugin to fail to compile for some
4 | # customers of the plugin.
5 | cmake_minimum_required(VERSION 3.14)
6 |
7 | # Project-level configuration.
8 | set(PROJECT_NAME "pdfbox_plugin")
9 | project(${PROJECT_NAME} LANGUAGES CXX)
10 |
11 | # Invoke the build for native code shared with the other target platforms.
12 | # This can be changed to accomodate different builds.
13 | add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/../src" "${CMAKE_CURRENT_BINARY_DIR}/shared")
14 |
15 | # List of absolute paths to libraries that should be bundled with the plugin.
16 | # This list could contain prebuilt libraries, or libraries created by an
17 | # external build triggered from this build file.
18 | set(pdfbox_plugin_bundled_libraries
19 | # Defined in ../src/CMakeLists.txt.
20 | # This can be changed to accomodate different builds.
21 | $
22 | PARENT_SCOPE
23 | )
24 |
--------------------------------------------------------------------------------
/jni/src/include/analyze_snapshot_api.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
3 | * for details. All rights reserved. Use of this source code is governed by a
4 | * BSD-style license that can be found in the LICENSE file.
5 | */
6 |
7 | #ifndef RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
8 | #define RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
9 |
10 | #include
11 |
12 | namespace dart {
13 | namespace snapshot_analyzer {
14 | typedef struct {
15 | const uint8_t* vm_snapshot_data;
16 | const uint8_t* vm_snapshot_instructions;
17 | const uint8_t* vm_isolate_data;
18 | const uint8_t* vm_isolate_instructions;
19 | } Dart_SnapshotAnalyzerInformation;
20 |
21 | void Dart_DumpSnapshotInformationAsJson(char** buffer,
22 | intptr_t* buffer_length,
23 | Dart_SnapshotAnalyzerInformation* info);
24 |
25 | void Dart_DumpSnapshotInformationPP(Dart_SnapshotAnalyzerInformation* info);
26 |
27 | } // namespace snapshot_analyzer
28 | } // namespace dart
29 |
30 | #endif // RUNTIME_INCLUDE_ANALYZE_SNAPSHOT_API_H_
31 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/README.md:
--------------------------------------------------------------------------------
1 | # pdfbox_plugin_example
2 |
3 | Demonstrates how to use the PDFBox bindings generated using `jnigen`. This is a Linux Flutter application. The sample application lists the PDF files in a directory with number of pages and title, also allowing to navigate between directories.
4 |
5 | First, it's required to have generated the dart and C bindings in the plugin directory, which also downloads the required JARs using maven. The bindings are not committed because generated code is several thousands of lines.
6 |
7 | On a Linux machine, following commands can be used to run the example application.
8 |
9 | ```
10 | cd .. ## From this folder
11 | dart run jnigen --config jnigen.yaml ## Downloads PDFBox JARs and generates bindings.
12 | cd example/
13 | flutter run --release ## Opens the files list from home directory
14 | ```
15 |
16 | It may take some time for PDFBox to process all PDFs in a directory. In the interest of simplicity, this example application displays the list after all PDFs are processed.
17 |
18 | Follow along the code in `lib/main.dart` to see how generated bindings are used.
19 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/notification_plugin/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/jnigen/example/kotlin_plugin/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # jni_native_build (Build with jni:setup. Do not delete this line.)
2 |
3 | # The Flutter tooling requires that developers have CMake 3.10 or later
4 | # installed. You should not increase this version, as doing so will cause
5 | # the plugin to fail to compile for some customers of the plugin.
6 | cmake_minimum_required(VERSION 3.10)
7 |
8 | project(kotlin_plugin_bindings VERSION 0.0.1 LANGUAGES C)
9 |
10 | add_library(kotlin_plugin_bindings SHARED
11 | "./kotlin_plugin_bindings.c"
12 | )
13 |
14 | set_target_properties(kotlin_plugin_bindings PROPERTIES
15 | OUTPUT_NAME "kotlin_plugin_bindings"
16 | )
17 |
18 | target_compile_definitions(kotlin_plugin_bindings PUBLIC DART_SHARED_LIB)
19 |
20 | if(WIN32)
21 | set_target_properties(${TARGET_NAME} PROPERTIES
22 | LINK_FLAGS "/DELAYLOAD:jvm.dll")
23 | endif()
24 |
25 | if (ANDROID)
26 | target_link_libraries(kotlin_plugin_bindings log)
27 | else()
28 | find_package(Java REQUIRED)
29 | find_package(JNI REQUIRED)
30 | include_directories(${JNI_INCLUDE_DIRS})
31 | target_link_libraries(kotlin_plugin_bindings ${JNI_LIBRARIES})
32 | endif()
33 |
--------------------------------------------------------------------------------
/jnigen/test/simple_package_test/java/com/github/dart_lang/jnigen/generics/MyMap.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.generics;
6 |
7 | import java.util.HashMap;
8 | import java.util.Map;
9 |
10 | public class MyMap {
11 | public class MyEntry {
12 | public K key;
13 | public V value;
14 |
15 | public MyEntry(K key, V value) {
16 | this.key = key;
17 | this.value = value;
18 | }
19 | }
20 |
21 | private Map map;
22 |
23 | public MyMap() {
24 | map = new HashMap<>();
25 | }
26 |
27 | public V get(K key) {
28 | return map.get(key);
29 | }
30 |
31 | public V put(K key, V value) {
32 | return map.put(key, value);
33 | }
34 |
35 | public MyStack entryStack() {
36 | var stack = new MyStack();
37 | map.entrySet().stream()
38 | .map(e -> new MyEntry(e.getKey(), e.getValue()))
39 | .forEach(e -> stack.push(e));
40 | return stack;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/jni/macos/jni.podspec:
--------------------------------------------------------------------------------
1 | #
2 | # To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
3 | # Run `pod lib lint jni.podspec` to validate before publishing.
4 | #
5 | Pod::Spec.new do |s|
6 | s.name = 'jni'
7 | s.version = '0.0.1'
8 | s.summary = 'A new Flutter FFI plugin project.'
9 | s.description = <<-DESC
10 | A new Flutter FFI plugin project.
11 | DESC
12 | s.homepage = 'http://example.com'
13 | s.license = { :file => '../LICENSE' }
14 | s.author = { 'Your Company' => 'email@example.com' }
15 |
16 | # This will ensure the source files in Classes/ are included in the native
17 | # builds of apps using this FFI plugin. Podspec does not support relative
18 | # paths, so Classes contains a forwarder C file that relatively imports
19 | # `../src/*` so that the C sources can be shared among all target platforms.
20 | s.source = { :path => '.' }
21 | s.source_files = 'Classes/**/*'
22 | s.dependency 'FlutterMacOS'
23 |
24 | s.platform = :osx, '10.11'
25 | s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
26 | s.swift_version = '5.0'
27 | end
28 |
--------------------------------------------------------------------------------
/jnigen/bin/download_maven_jars.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | import 'dart:io';
6 |
7 | import 'package:jnigen/jnigen.dart';
8 | import 'package:jnigen/tools.dart';
9 |
10 | /// Downloads maven dependencies downloaded by equivalent jnigen invocation.
11 | ///
12 | /// Useful for running standalone examples on already generated sources.
13 | void main(List args) async {
14 | final config = Config.parseArgs(args);
15 | final mavenDownloads = config.mavenDownloads;
16 | if (mavenDownloads != null) {
17 | await MavenTools.downloadMavenJars(
18 | MavenTools.deps(mavenDownloads.jarOnlyDeps + mavenDownloads.sourceDeps),
19 | mavenDownloads.jarDir);
20 | await Directory(mavenDownloads.jarDir)
21 | .list()
22 | .map((entry) => entry.path)
23 | .where((path) => path.endsWith('.jar'))
24 | .forEach(stdout.writeln);
25 | } else {
26 | stderr.writeln('No maven dependencies found in config.');
27 | exitCode = 2;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmSummarizer.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.disasm;
6 |
7 | import static com.github.dart_lang.jnigen.apisummarizer.util.ExceptionUtil.wrapCheckedException;
8 |
9 | import com.github.dart_lang.jnigen.apisummarizer.elements.ClassDecl;
10 | import com.github.dart_lang.jnigen.apisummarizer.util.InputStreamProvider;
11 | import java.util.List;
12 | import org.objectweb.asm.ClassReader;
13 |
14 | public class AsmSummarizer {
15 |
16 | public static List run(List inputProviders) {
17 | var visitor = new AsmClassVisitor();
18 | for (var provider : inputProviders) {
19 | var inputStream = provider.getInputStream();
20 | var classReader = wrapCheckedException(ClassReader::new, inputStream);
21 | classReader.accept(visitor, 0);
22 | provider.close();
23 | }
24 | return visitor.getVisited();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/jni/src/jni_constants.h:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | // This file re-exports some JNI constants as enum, because they are not
6 | // currently being included when they are in macro form.
7 |
8 | enum JniBooleanValues { JNI_FALSE = 0, JNI_TRUE = 1 };
9 |
10 | enum JniVersions {
11 | JNI_VERSION_1_1 = 0x00010001,
12 | JNI_VERSION_1_2 = 0x00010002,
13 | JNI_VERSION_1_4 = 0x00010004,
14 | JNI_VERSION_1_6 = 0x00010006,
15 | };
16 |
17 | enum JniErrorCode {
18 | // Error codes from JNI
19 | JNI_OK = 0, /* no error */
20 | JNI_ERR = -1, /* generic error */
21 | JNI_EDETACHED = -2, /* thread detached from the VM */
22 | JNI_EVERSION = -3, /* JNI version error */
23 | JNI_ENOMEM = -4, /* Out of memory */
24 | JNI_EEXIST = -5, /* VM already created */
25 | JNI_EINVAL = -6, /* Invalid argument */
26 | };
27 |
28 | enum JniBufferWriteBack {
29 | JNI_COMMIT = 1, /* copy content, do not free buffer */
30 | JNI_ABORT = 2, /* free buffer w/o copying back */
31 | };
32 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/elements/KotlinTypeParameter.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.elements;
6 |
7 | import java.util.List;
8 | import java.util.stream.Collectors;
9 | import kotlinx.metadata.KmTypeParameter;
10 | import kotlinx.metadata.KmVariance;
11 |
12 | public class KotlinTypeParameter {
13 | public String name;
14 | public int id;
15 | public int flags;
16 | public List upperBounds;
17 | public KmVariance variance;
18 |
19 | public static KotlinTypeParameter fromKmTypeParameter(KmTypeParameter t) {
20 | var typeParam = new KotlinTypeParameter();
21 | typeParam.name = t.getName();
22 | typeParam.id = t.getId();
23 | typeParam.flags = t.getFlags();
24 | typeParam.upperBounds =
25 | t.getUpperBounds().stream().map(KotlinType::fromKmType).collect(Collectors.toList());
26 | typeParam.variance = t.getVariance();
27 | return typeParam;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/jnigen/java/src/main/java/com/github/dart_lang/jnigen/apisummarizer/disasm/AsmFieldVisitor.java:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2 | // for details. All rights reserved. Use of this source code is governed by a
3 | // BSD-style license that can be found in the LICENSE file.
4 |
5 | package com.github.dart_lang.jnigen.apisummarizer.disasm;
6 |
7 | import com.github.dart_lang.jnigen.apisummarizer.elements.Field;
8 | import com.github.dart_lang.jnigen.apisummarizer.elements.JavaAnnotation;
9 | import org.objectweb.asm.AnnotationVisitor;
10 | import org.objectweb.asm.FieldVisitor;
11 |
12 | public class AsmFieldVisitor extends FieldVisitor implements AsmAnnotatedElementVisitor {
13 | Field field;
14 |
15 | public AsmFieldVisitor(Field field) {
16 | super(AsmConstants.API);
17 | this.field = field;
18 | }
19 |
20 | @Override
21 | public void addAnnotation(JavaAnnotation annotation) {
22 | field.annotations.add(annotation);
23 | }
24 |
25 | @Override
26 | public AnnotationVisitor visitAnnotation(String descriptor, boolean visible) {
27 | return AsmAnnotatedElementVisitor.super.visitAnnotationDefault(descriptor, visible);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/jnigen/example/pdfbox_plugin/dart_example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the static analysis results for your project (errors,
2 | # warnings, and lints).
3 | #
4 | # This enables the 'recommended' set of lints from `package:lints`.
5 | # This set helps identify many issues that may lead to problems when running
6 | # or consuming Dart code, and enforces writing Dart using a single, idiomatic
7 | # style and format.
8 | #
9 | # If you want a smaller set of lints you can change this to specify
10 | # 'package:lints/core.yaml'. These are just the most critical lints
11 | # (the recommended set includes the core lints).
12 | # The core lints are also what is used by pub.dev for scoring packages.
13 |
14 | include: package:lints/recommended.yaml
15 |
16 | # Uncomment the following section to specify additional rules.
17 |
18 | # linter:
19 | # rules:
20 | # - camel_case_types
21 |
22 | # analyzer:
23 | # exclude:
24 | # - path/to/excluded/files/**
25 |
26 | # For more information about the core and recommended set of lints, see
27 | # https://dart.dev/go/core-lints
28 |
29 | # For additional information about configuring this file, see
30 | # https://dart.dev/guides/language/analysis-options
31 |
--------------------------------------------------------------------------------