Skip to content

Commit

Permalink
[ffigen] Move core ObjC classes to package:objective_c (#1088)
Browse files Browse the repository at this point in the history
* Move core ObjC classes to package:objective_c

* Fix formatting and analysis

* Fix analysis

* Fix analysis

* Fix analysis and add tests

* Fix pub get failure

* More tests and coverage

* Fix path

* Fix permissions

* Fix coverage

* Debugging coverage

* Fix analysis

* Still debugging coverage

* Fix analysis

* Debug coverage

* Remove coverage debugging

* Daco's comments
  • Loading branch information
liamappelbe authored Apr 17, 2024
1 parent e88a6a8 commit 0f41ebb
Show file tree
Hide file tree
Showing 47 changed files with 72,366 additions and 100,356 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ffigen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
carryforward: "jnigen_tests,jni_tests,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
carryforward: "objective_c_tests,ffigen_macos,jnigen_tests,jni_tests,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/health_flutter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
- "pkgs/ffigen/**"
- "pkgs/jni/**"
- "pkgs/jnigen/**"
- "pkgs/objective_c/**"
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
health:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/jnigen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,6 @@ jobs:
- name: Coveralls finished
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
carryforward: "ffigen_macos,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
carryforward: "objective_c_tests,ffigen_macos,jnigen_tests,jni_tests,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
github-token: ${{ secrets.github_token }}
parallel-finished: true
2 changes: 1 addition & 1 deletion .github/workflows/native.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,6 @@ jobs:
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
carryforward: "ffigen_macos,jnigen_tests,jni_tests"
carryforward: "objective_c_tests,ffigen_macos,jnigen_tests,jni_tests,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
32 changes: 32 additions & 0 deletions .github/workflows/objective_c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,35 @@ jobs:
- name: Analyze code
run: flutter analyze --fatal-infos
if: always() && steps.install.outcome == 'success'

test-mac:
needs: analyze
runs-on: 'macos-latest'
defaults:
run:
working-directory: pkgs/objective_c/
steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
with:
flutter-version: 3.19.0
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Run VM tests
run: dart test
- name: Collect coverage
run: ./tool/coverage.sh
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
flag-name: objective_c_tests
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel: true
path-to-lcov: pkgs/objective_c/lcov.info
- name: Upload coverage
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
with:
carryforward: "objective_c_tests,ffigen_macos,jnigen_tests,jni_tests,native_assets_builder_macos,native_assets_builder_ubuntu,native_assets_builder_windows,native_assets_cli_macos,native_assets_cli_ubuntu,native_assets_cli_windows,native_toolchain_c_macos,native_toolchain_c_ubuntu,native_toolchain_c_windows"
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
6 changes: 6 additions & 0 deletions pkgs/ffigen/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- __Breaking change__: Use `package:objective_c` in ObjC bindings.
- ObjC packages will have a flutter dependency (until
https://github.com/dart-lang/native/issues/1068 is fixed).
- Core classes such as `NSString` have been moved intpu `package:objective_c`.
- ObjC class methods don't need the ubiquitous `lib` argument anymore. In
fact, ffigen won't even generate the native library class (unless it needs
to bind top level functions without using `@Native`). It is still necessary
Expand All @@ -21,6 +22,11 @@
- Regardless of whether the native library class still exists, delete the
`lib` parameter from all ObjC object constructors and static method calls
and block constructors.
- If core ObjC classes such as `NSString` are being used,
`package:objective_c` must be imported, as they won't be exported by the
generated bindings.
- Add --[no-]format option to ffigen command line, which controls whether the
formatting step happens. Defaults to true.

## 11.0.0

Expand Down
Loading

0 comments on commit 0f41ebb

Please sign in to comment.