Skip to content

Commit

Permalink
[jnigen] Update links and paths to use dart-lang/native
Browse files Browse the repository at this point in the history
  • Loading branch information
HosseinYousefi committed Nov 19, 2023
1 parent 5dca10e commit 1257bf7
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/jnigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# code before making a PR. If you add a task here, you might want to add
# the equivalent in that script as well.

name: Dart CI
name: jnigen

on:
# Run on PRs and pushes to the default branch.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ building and bundling.
| Package | Description | Version |
| --- | --- | --- |
| [ffigen](pkgs/ffigen/) | Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. | [![pub package](https://img.shields.io/pub/v/ffigen.svg)](https://pub.dev/packages/ffigen) |
| [jni](pkgs/jni/) | A library to access JNI from Dart and Flutter that acts as a support library for `package:jnigen`. | [![pub package](https://img.shields.io/pub/v/jni.svg)](https://pub.dev/packages/jni) |
| [jnigen](pkgs/jnigen/) | A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. | [![pub package](https://img.shields.io/pub/v/jnigen.svg)](https://pub.dev/packages/jnigen) |
| [native_assets_builder](pkgs/native_assets_builder/) | This package is the backend that invokes top-level `build.dart` scripts. | [![pub package](https://img.shields.io/pub/v/native_assets_builder.svg)](https://pub.dev/packages/native_assets_builder) |
| [native_assets_cli](pkgs/native_assets_cli/) | A library that contains the argument and file formats for implementing a native assets CLI. | [![pub package](https://img.shields.io/pub/v/native_assets_cli.svg)](https://pub.dev/packages/native_assets_cli) |
| [native_toolchain_c](pkgs/native_toolchain_c/) | A library to invoke the native C compiler installed on the host machine. | [![pub package](https://img.shields.io/pub/v/native_toolchain_c.svg)](https://pub.dev/packages/native_toolchain_c) |
Expand Down
10 changes: 5 additions & 5 deletions pkgs/jni/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 0.8.0-wip

- **Breaking Change** ([#394](https://github.com/dart-lang/jnigen/issues/394)):
- **Breaking Change** ([#548](https://github.com/dart-lang/native/issues/548)):
Converted various `Exception`s into `Error`s:
- `UseAfterReleaseException` -> `UseAfterReleaseError`
- `DoubleReleaseException` -> `DoubleReleaseError`
Expand All @@ -23,11 +23,11 @@
- Fixed a bug where reading non-null terminated strings would overflow.

## 0.7.1
- Removed macOS Flutter plugin until package:jni supports it ([#41](https://github.com/dart-lang/jnigen/issues/41)).
- Removed macOS Flutter plugin until package:jni supports it ([#780](https://github.com/dart-lang/native/issues/780)).

## 0.7.0

- **Breaking Change** ([#387](https://github.com/dart-lang/jnigen/issues/387)):
- **Breaking Change** ([#563](https://github.com/dart-lang/native/issues/563)):
Added `JBuffer` and `JByteBuffer` classes as default classes for
`java.nio.Buffer` and `java.nio.ByteBuffer` respectively.
- **Breaking Change**: Made the type classes `final`.
Expand All @@ -42,14 +42,14 @@

## 0.6.0

- **Breaking Change** ([#131](https://github.com/dart-lang/jnigen/issues/131)):
- **Breaking Change** ([#707](https://github.com/dart-lang/native/issues/707)):
Renamed `delete*` to `release*`.
- Added `PortProxy` and related methods used for interface implementation.
- Added the missing binding for `java.lang.Character`.

## 0.5.0

- **Breaking Change** ([#137](https://github.com/dart-lang/jnigen/issues/137)):
- **Breaking Change** ([#711](https://github.com/dart-lang/native/issues/711)):
Java primitive types are now all lowercase like `jint`, `jshort`, ...
- The bindings for `java.util.Set`, `java.util.Map`, `java.util.List` and the
numeric types like `java.lang.Integer`, `java.lang.Boolean`, ... are now
Expand Down
5 changes: 5 additions & 0 deletions pkgs/jni/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
[![Build Status](https://github.com/dart-lang/native/actions/workflows/jnigen.yaml/badge.svg)](https://github.com/dart-lang/native/actions/workflows/jnigen.yaml)
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/native/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/native?branch=main)
[![pub package](https://img.shields.io/pub/v/jni.svg)](https://pub.dev/packages/jni)
[![package publisher](https://img.shields.io/pub/publisher/jni.svg)](https://pub.dev/packages/jni/publisher)

# jni

This is a support library to access JNI from Dart / Flutter code. This provides the common infrastructure to bindings generated by [jnigen](https://pub.dev/packages/jnigen), as well as some utility methods.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jni/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: jni
description: A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen.
version: 0.8.0-wip
repository: https://github.com/dart-lang/jnigen/tree/main/jni
repository: https://github.com/dart-lang/native/tree/main/pkgs/jni

topics:
- interop
Expand Down
12 changes: 6 additions & 6 deletions pkgs/jnigen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

## 0.7.0

- **Breaking Change** ([#387](https://github.com/dart-lang/jnigen/issues/387)):
- **Breaking Change** ([#563](https://github.com/dart-lang/native/issues/563)):
Added `JBuffer` and `JByteBuffer` classes as default classes for
`java.nio.Buffer` and `java.nio.ByteBuffer` respectively.
- **Breaking Change**: Made the type classes `final`.
Expand All @@ -16,9 +16,9 @@

## 0.6.0

- **Breaking Change** ([#131](https://github.com/dart-lang/jnigen/issues/131)):
- **Breaking Change** ([#707](https://github.com/dart-lang/native/issues/707)):
Renamed `delete*` to `release*`.
- **Breaking Change** ([#354](https://github.com/dart-lang/jnigen/issues/354)):
- **Breaking Change** ([#585](https://github.com/dart-lang/native/issues/585)):
Renamed constructors from `ctor1`, `ctor2`, ... to `new1`, `new2`, ...
- **Breaking Change**: Specifying a class always pulls in nested classes by
default. If a nested class is specified in config, it will be an error.
Expand All @@ -39,18 +39,18 @@

## 0.5.0

- **Breaking Change** ([#72](https://github.com/dart-lang/jnigen/issues/72)):
- **Breaking Change** ([#746](https://github.com/dart-lang/native/issues/746)):
Removed support for `importMap` in favor of the newly added interop mechanism
with importing yaml files.
- **Breaking Change** ([#72](https://github.com/dart-lang/jnigen/issues/72)):
- **Breaking Change** ([#746](https://github.com/dart-lang/native/issues/746)):
`java.util.Set`, `java.util.Map`, `java.util.List`, `java.util.Iterator` and
the boxed types like `java.lang.Integer`, `java.lang.Double`, ... will be
generated as their corresponding classes in `package:jni`.
- Strings now use UTF16.

## 0.4.0

- **Breaking Change** ([#145](https://github.com/dart-lang/jnigen/issues/145)):
- **Breaking Change** ([#705](https://github.com/dart-lang/native/issues/705)):
Type arguments are now named instead of positional.
- Type parameters can now be inferred when possible.
- Fixed a bug where passing a `long` argument truncated it to `int` in pure dart
Expand Down
8 changes: 5 additions & 3 deletions pkgs/jnigen/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[![Build Status](https://github.com/dart-lang/jnigen/workflows/Dart%20CI/badge.svg)](https://github.com/dart-lang/jnigen/actions?query=workflow%3A%22Dart+CI%22+branch%3Amain)
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/jnigen/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/jnigen?branch=main)
[![Build Status](https://github.com/dart-lang/native/actions/workflows/jnigen.yaml/badge.svg)](https://github.com/dart-lang/native/actions/workflows/jnigen.yaml)
[![Coverage Status](https://coveralls.io/repos/github/dart-lang/native/badge.svg?branch=main)](https://coveralls.io/github/dart-lang/native?branch=main)
[![pub package](https://img.shields.io/pub/v/jnigen.svg)](https://pub.dev/packages/jnigen)
[![package publisher](https://img.shields.io/pub/publisher/jnigen.svg)](https://pub.dev/packages/jnigen/publisher)

## Introduction
Experimental bindings generator for Java bindings through dart:ffi and JNI.
Expand Down Expand Up @@ -136,7 +138,7 @@ On Android, the flutter application runs embedded in Android JVM. On other platf
## Java features support
Currently basic features of the Java language are supported in the bindings. Each Java class is mapped to a Dart class. Bindings are generated for methods, constructors and fields. Exceptions thrown in Java are rethrown in Dart with stack trace from Java.

More advanced features such as callbacks are not supported yet. Support for these features is tracked in the [issue tracker](https://github.com/dart-lang/jnigen/issues).
More advanced features such as callbacks are not supported yet. Support for these features is tracked in the [issue tracker](https://github.com/dart-lang/native/issues?q=is%3Aopen+is%3Aissue+label%3Apackage%3Ajni%2Cpackage%3Ajnigen).

## Note on Dart (standalone) target
`package:jni` is an FFI plugin containing native code, and any bindings generated from jnigen contains native code too.
Expand Down
14 changes: 7 additions & 7 deletions pkgs/jnigen/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ This directory contains examples on how to use jnigen.

| Directory | Description |
| ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| [in_app_java](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/in_app_java/) | Demonstrates how to include custom Java code in Flutter application and call that using jnigen |
| [pdfbox_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/) | Example of a flutter plugin which provides bindings to Apache PDFBox library. Currently works on Flutter desktop and Dart standalone on linux. |
| [notification_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/notification_plugin/) | Example of a reusable Flutter plugin with custom Java code which uses Android libraries. |
| [kotlin_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/kotlin_plugin) | Example of using jnigen to generate bindings for Kotlin. |
| [in_app_java](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/in_app_java/) | Demonstrates how to include custom Java code in Flutter application and call that using jnigen |
| [pdfbox_plugin](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/pdfbox_plugin/) | Example of a flutter plugin which provides bindings to Apache PDFBox library. Currently works on Flutter desktop and Dart standalone on linux. |
| [notification_plugin](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/notification_plugin/) | Example of a reusable Flutter plugin with custom Java code which uses Android libraries. |
| [kotlin_plugin](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/kotlin_plugin) | Example of using jnigen to generate bindings for Kotlin. |

We intend to cover few more use cases in future.

Expand All @@ -16,12 +16,12 @@ We intend to cover few more use cases in future.
### Dart package (Standalone only)

- Create dart package, add `jni` as dependency and `jnigen` as dev dependency.
- Write the jnigen config similar to [the one in pdfbox_plugin](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/jnigen.yaml).
- Write the jnigen config similar to [the one in pdfbox_plugin](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml).
- Generate JNI bindings by running `dart run jnigen --config jnigen.yaml`.

- In the CLI project which uses this package, add this package, and `jni` as a dependency.
- Run `dart run jni:setup` to build native libraries for JNI base library and jnigen generated package.
- Import the package. See [pdf_info.dart](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart) for an example of using JNI from dart standalone.
- Import the package. See [pdf_info.dart](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/pdfbox_plugin/dart_example/bin/pdf_info.dart) for an example of using JNI from dart standalone.

### Flutter FFI plugin

Expand All @@ -42,7 +42,7 @@ To create an FFI plugin with JNI bindings:
- Create an FFI plugin with Android as the only platform.
- Build the example/ Android project using command `flutter build apk`. After a release build is done, jnigen can use a gradle stub to collect compile classpaths.
- Write your custom Java code in `android/src/main/java` hierarchy of the plugin.
- Generate JNI bindings as described above. See [notification_plugin/jnigen.yaml](https://github.com/dart-lang/jnigen/tree/main/jnigen/example/notification_plugin/jnigen.yaml) for example configuration.
- Generate JNI bindings as described above. See [notification_plugin/jnigen.yaml](https://github.com/dart-lang/native/tree/main/pkgs/jnigen/example/notification_plugin/jnigen.yaml) for example configuration.

### Pure dart bindings

Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/example/notification_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: notification_plugin
description: Example for Android plugin with custom Java code using jnigen.
version: 0.0.1
publish_to: none
homepage: https://github.com/dart-lang/jnigen
homepage: https://github.com/dart-lang/native

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/example/pdfbox_plugin/jnigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ classes:
## directly to dart static fields. In the current implementation some string
## escaping problems may occur.
##
## See issue #31 (https://github.com/dart-lang/jnigen/issues/31) for details.
## See issue #31 (https://github.com/dart-lang/native/issues/792) for details.
## (This field does not appear in bindings unless full package bindings are
## generated using a `-Dclasses` override.)
##
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/example/pdfbox_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: |
Example of using jnigen to generate bindings for a non-trivial Java library.
version: 0.0.1
publish_to: none
homepage: https://github.com/dart-lang/jnigen
homepage: https://github.com/dart-lang/native

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/lib/src/bindings/dart_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ import "package:jni/jni.dart" as jni;
log.fatal('Dart format completed with exit code ${formatRes.exitCode} '
'This usually means there\'s a syntax error in bindings.\n'
'Please look at the generated files and report a bug: \n'
'https://github.com/dart-lang/jnigen/issues/new\n');
'https://github.com/dart-lang/native/issues/new?labels=package%3Ajnigen\n');
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
name: jnigen
description: A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine.
version: 0.8.0-wip
repository: https://github.com/dart-lang/jnigen/tree/main/jnigen
repository: https://github.com/dart-lang/native/tree/main/pkgs/jnigen

environment:
sdk: ">=3.1.0 <4.0.0"
Expand Down

0 comments on commit 1257bf7

Please sign in to comment.