Skip to content

Commit 0f41ebb

Browse files
authored
[ffigen] Move core ObjC classes to package:objective_c (#1088)
* 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
1 parent e88a6a8 commit 0f41ebb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+72366
-100356
lines changed

.github/workflows/ffigen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
- name: Upload coverage
100100
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
101101
with:
102-
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"
102+
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"
103103
github-token: ${{ secrets.GITHUB_TOKEN }}
104104
parallel-finished: true
105105

.github/workflows/health_flutter.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- "pkgs/ffigen/**"
88
- "pkgs/jni/**"
99
- "pkgs/jnigen/**"
10+
- "pkgs/objective_c/**"
1011
types: [opened, synchronize, reopened, labeled, unlabeled]
1112
jobs:
1213
health:

.github/workflows/jnigen.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,6 @@ jobs:
424424
- name: Coveralls finished
425425
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
426426
with:
427-
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"
427+
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"
428428
github-token: ${{ secrets.github_token }}
429429
parallel-finished: true

.github/workflows/native.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,6 @@ jobs:
145145
- name: Upload coverage
146146
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
147147
with:
148-
carryforward: "ffigen_macos,jnigen_tests,jni_tests"
148+
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"
149149
github-token: ${{ secrets.GITHUB_TOKEN }}
150150
parallel-finished: true

.github/workflows/objective_c.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,35 @@ jobs:
4242
- name: Analyze code
4343
run: flutter analyze --fatal-infos
4444
if: always() && steps.install.outcome == 'success'
45+
46+
test-mac:
47+
needs: analyze
48+
runs-on: 'macos-latest'
49+
defaults:
50+
run:
51+
working-directory: pkgs/objective_c/
52+
steps:
53+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
54+
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1
55+
with:
56+
flutter-version: 3.19.0
57+
channel: 'stable'
58+
- name: Install dependencies
59+
run: flutter pub get
60+
- name: Run VM tests
61+
run: dart test
62+
- name: Collect coverage
63+
run: ./tool/coverage.sh
64+
- name: Upload coverage
65+
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
66+
with:
67+
flag-name: objective_c_tests
68+
github-token: ${{ secrets.GITHUB_TOKEN }}
69+
parallel: true
70+
path-to-lcov: pkgs/objective_c/lcov.info
71+
- name: Upload coverage
72+
uses: coverallsapp/github-action@3dfc5567390f6fa9267c0ee9c251e4c8c3f18949
73+
with:
74+
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"
75+
github-token: ${{ secrets.GITHUB_TOKEN }}
76+
parallel-finished: true

pkgs/ffigen/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- __Breaking change__: Use `package:objective_c` in ObjC bindings.
1010
- ObjC packages will have a flutter dependency (until
1111
https://github.com/dart-lang/native/issues/1068 is fixed).
12+
- Core classes such as `NSString` have been moved intpu `package:objective_c`.
1213
- ObjC class methods don't need the ubiquitous `lib` argument anymore. In
1314
fact, ffigen won't even generate the native library class (unless it needs
1415
to bind top level functions without using `@Native`). It is still necessary
@@ -21,6 +22,11 @@
2122
- Regardless of whether the native library class still exists, delete the
2223
`lib` parameter from all ObjC object constructors and static method calls
2324
and block constructors.
25+
- If core ObjC classes such as `NSString` are being used,
26+
`package:objective_c` must be imported, as they won't be exported by the
27+
generated bindings.
28+
- Add --[no-]format option to ffigen command line, which controls whether the
29+
formatting step happens. Defaults to true.
2430

2531
## 11.0.0
2632

0 commit comments

Comments
 (0)