[jnigen] Initial commit
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
new file mode 100644
index 0000000..6052b06
--- /dev/null
+++ b/.github/workflows/test-package.yml
@@ -0,0 +1,67 @@
+# Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+name: Dart CI
+
+on:
+  # Run on PRs and pushes to the default branch.
+  push:
+    branches: [ main ]
+  pull_request:
+    branches: [ main ]
+  schedule:
+    - cron: "0 0 * * 0"
+
+env:
+  PUB_ENVIRONMENT: bot.github
+
+jobs:
+  # Check code formatting and static analysis on a single OS (linux)
+  # against Dart stable.
+  analyze:
+    runs-on: ubuntu-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        sdk: [stable]
+    steps:
+      - uses: actions/checkout@v2
+      - uses: dart-lang/setup-dart@v1.0
+        with:
+          sdk: ${{ matrix.sdk }}
+      - id: install
+        name: Install dependencies
+        run: dart pub get
+      - name: Check formatting
+        run: dart format --output=none --set-exit-if-changed .
+        if: always() && steps.install.outcome == 'success'
+      - name: Analyze code
+        run: dart analyze --fatal-infos
+        if: always() && steps.install.outcome == 'success'
+
+  test:
+    needs: analyze
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        # Add macos-latest and/or windows-latest if relevant for this package.
+        os: [ubuntu-latest]
+        sdk: [2.17.0, dev]
+    steps:
+      - uses: actions/checkout@v2
+      - uses: dart-lang/setup-dart@v1.0
+        with:
+          sdk: stable
+      - name: Install dependencies
+        run: dart pub get
+      - name: Run VM tests
+        run: dart test --platform vm
+      - name: Collect coverage
+        run: ./tool/coverage.sh
+      - name: Upload coverage
+        uses: coverallsapp/github-action@v1.1.2
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          path-to-lcov: lcov.info
diff --git a/pkgs/.gitignore b/pkgs/.gitignore
new file mode 100644
index 0000000..93533a5
--- /dev/null
+++ b/pkgs/.gitignore
@@ -0,0 +1,35 @@
+# See https://www.dartlang.org/guides/libraries/private-files
+
+# Files and directories created by pub.
+.dart_tool/
+.packages
+build/
+pubspec.lock
+
+# Directory created by dartdoc.
+doc/api/
+
+# Avoid committing generated Javascript files:
+*.dart.js
+*.info.json      # Produced by the --dump-info flag.
+*.js             # When generated by dart2js. Don't specify *.js if your
+                 # project includes source files written in JavaScript.
+*.js_
+*.js.deps
+*.js.map
+
+# IDE and debugger files.
+.clangd
+.gdb_history
+.history
+.vscode
+compile_commands.json
+
+# IntelliJ
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# Mac
+.DS_Store
diff --git a/pkgs/CONTRIBUTING.md b/pkgs/CONTRIBUTING.md
new file mode 100644
index 0000000..5dadc74
--- /dev/null
+++ b/pkgs/CONTRIBUTING.md
@@ -0,0 +1,29 @@
+# How to Contribute
+
+We'd love to accept your patches and contributions to this project. There are
+just a few small guidelines you need to follow.
+
+## Contributor License Agreement
+
+Contributions to this project must be accompanied by a Contributor License
+Agreement. You (or your employer) retain the copyright to your contribution;
+this simply gives us permission to use and redistribute your contributions as
+part of the project. Head over to <https://cla.developers.google.com/> to see
+your current agreements on file or to sign a new one.
+
+You generally only need to submit a CLA once, so if you've already submitted one
+(even if it was for a different project), you probably don't need to do it
+again.
+
+## Code reviews
+
+All submissions, including submissions by project members, require review. We
+use GitHub pull requests for this purpose. Consult
+[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
+information on using pull requests.
+
+## Community Guidelines
+
+This project follows [Google's Open Source Community
+Guidelines](https://opensource.google/conduct/) and the [Dart code of
+conduct](https://dart.dev/code-of-conduct).
diff --git a/pkgs/analysis_options.yaml b/pkgs/analysis_options.yaml
new file mode 100644
index 0000000..9c8e2c5
--- /dev/null
+++ b/pkgs/analysis_options.yaml
@@ -0,0 +1,5 @@
+# Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+include: package:lints/recommended.yaml
diff --git a/pkgs/jnigen/README.md b/pkgs/jnigen/README.md
new file mode 100644
index 0000000..d0f0474
--- /dev/null
+++ b/pkgs/jnigen/README.md
@@ -0,0 +1,6 @@
+# Experimental generator for FFI+JNI bindings.
+
+This package will generate JNI code to invoke Java from C, and Dart FFI bindings to invoke this C code.
+This enables calling Java code from Dart.
+
+This is a GSoC 2022 project.
diff --git a/pkgs/lib/jnigen.dart b/pkgs/lib/jnigen.dart
new file mode 100644
index 0000000..34a82dd
--- /dev/null
+++ b/pkgs/lib/jnigen.dart
@@ -0,0 +1,5 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+export 'src/my_sum.dart';
diff --git a/pkgs/lib/src/my_sum.dart b/pkgs/lib/src/my_sum.dart
new file mode 100644
index 0000000..5e21504
--- /dev/null
+++ b/pkgs/lib/src/my_sum.dart
@@ -0,0 +1,6 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Computes the sum of its arguments.
+int mySum(int a, int b) => a + b;
diff --git a/pkgs/pubspec.yaml b/pkgs/pubspec.yaml
new file mode 100644
index 0000000..a649b6a
--- /dev/null
+++ b/pkgs/pubspec.yaml
@@ -0,0 +1,17 @@
+# Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+name: jnigen
+version: 0.0.1
+homepage: https://github.com/google/jnigen.dart
+description: Experimental generator for FFI+JNI bindings.
+
+environment:
+  sdk: '>=2.17.0 <3.0.0'
+
+dependencies:
+
+dev_dependencies:
+  lints: ^2.0.0
+  test: ^1.17.5
diff --git a/pkgs/test/my_test.dart b/pkgs/test/my_test.dart
new file mode 100644
index 0000000..bcf2b68
--- /dev/null
+++ b/pkgs/test/my_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2022, the Dart project authors.  Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:test/test.dart';
+import 'package:jnigen/jnigen.dart';
+
+void main() {
+  test('dummy test', () {
+    final result = mySum(2, 40);
+    expect(result, 42);
+  });
+}
diff --git a/pkgs/tool/coverage.sh b/pkgs/tool/coverage.sh
new file mode 100755
index 0000000..24fbaf2
--- /dev/null
+++ b/pkgs/tool/coverage.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+# Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+# for details. All rights reserved. Use of this source code is governed by a
+# BSD-style license that can be found in the LICENSE file.
+
+# Fast fail the script on failures.
+set -e
+
+# Gather coverage.
+dart pub global activate coverage
+# Generate coverage report.
+dart run --pause-isolates-on-exit --disable-service-auth-codes --enable-vm-service=3000 test &
+dart pub global run coverage:collect_coverage --wait-paused --uri=http://127.0.0.1:3000/ -o coverage.json --resume-isolates --scope-output=jnigen
+dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --lcov -i coverage.json -o lcov.info