-
Notifications
You must be signed in to change notification settings - Fork 72
[swiftgen] Initial version of swiftgen #2372
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
9ef4609
Squashed merge of swiftgen2
liamappelbe feaca08
Remove swift2objc stuff
liamappelbe 14fea78
Fix example
liamappelbe 09ddf52
Fix tests
liamappelbe 96a9cba
Clean up
liamappelbe 3efed20
Fix analysis
liamappelbe 8056564
github workflow
liamappelbe 5b2f412
fmt
liamappelbe f5452e7
Fix workflow
liamappelbe 938e9ed
Fix workflow
liamappelbe 9857d4b
Config refactor
liamappelbe 2a2e602
Config delegate
liamappelbe 90865c9
fix analysis
liamappelbe 71491a2
Revert config changes
liamappelbe 36f7fe4
Merge branch 'main' into swiftgen4
liamappelbe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: swiftgen | ||
|
||
on: | ||
# Run on PRs and pushes to the default branch. | ||
push: | ||
branches: [main, stable] | ||
paths: | ||
- '.github/workflows/swiftgen.yaml' | ||
- 'pkgs/swiftgen/**' | ||
pull_request: | ||
branches: [main, stable] | ||
paths: | ||
- '.github/workflows/swiftgen.yaml' | ||
- 'pkgs/ffigen/**' | ||
- 'pkgs/objective_c/**' | ||
- 'pkgs/swift2objc/**' | ||
- 'pkgs/swiftgen/**' | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
env: | ||
PUB_ENVIRONMENT: bot.github | ||
|
||
jobs: | ||
# Check code formatting and static analysis. | ||
analyze: | ||
runs-on: macos-latest | ||
defaults: | ||
run: | ||
working-directory: pkgs/swiftgen/ | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 | ||
with: | ||
channel: 'stable' | ||
- id: install | ||
name: Install dependencies | ||
run: flutter 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-mac: | ||
needs: analyze | ||
runs-on: 'macos-latest' | ||
defaults: | ||
run: | ||
working-directory: pkgs/swiftgen/ | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | ||
- uses: subosito/flutter-action@e938fdf56512cc96ef2f93601a5a40bde3801046 | ||
with: | ||
channel: 'stable' | ||
- name: Install dependencies | ||
run: flutter pub get | ||
- name: Install ObjC dependencies | ||
working-directory: pkgs/objective_c/ | ||
run: flutter pub get | ||
- name: Build ObjC test dylib | ||
working-directory: pkgs/objective_c/ | ||
# TODO(https://github.com/dart-lang/native/issues/1068): Remove this. | ||
run: dart test/setup.dart | ||
- name: Install coverage | ||
run: dart pub global activate coverage | ||
- name: Run VM tests and collect coverage | ||
run: dart pub global run coverage:test_with_coverage --scope-output=swiftgen | ||
- name: Upload coverage | ||
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b | ||
with: | ||
flag-name: swiftgen | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel: true | ||
path-to-lcov: pkgs/swiftgen/coverage/lcov.info | ||
- name: Upload coverage | ||
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b | ||
with: | ||
carryforward: "ffigen,jni,jnigen,native_pkgs_macos,native_pkgs_ubuntu,native_pkgs_windows,objective_c,swift2objc,swiftgen" | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
parallel-finished: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,12 +8,21 @@ | |
/// https://pub.dev/packages/ffigen for details. | ||
library ffigen; | ||
|
||
export 'src/code_generator/imports.dart' show ImportedType, LibraryImport; | ||
export 'src/config_provider.dart' | ||
show | ||
CommentType, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to self: We should go and do an API authoring round of FFIgen to make sure use from Dart is nice. |
||
CompoundDependencies, | ||
Config, | ||
Declaration, | ||
DeclarationFilters, | ||
ExternalVersions, | ||
FfiNativeConfig, | ||
Language, | ||
PackingValue, | ||
SymbolFile, | ||
VarArgFunction, | ||
Versions, | ||
YamlConfig; | ||
YamlConfig, | ||
defaultCompilerOpts; | ||
export 'src/ffigen.dart' show FfiGen; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
temp/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# swiftgen example | ||
|
||
Demonstrates how to use swiftgen to generate Dart bindings for a Swift API. | ||
|
||
Regenerating the bindings: | ||
|
||
```shell | ||
dart generate_code.dart | ||
``` | ||
|
||
Running the example: | ||
|
||
```shell | ||
dart play_audio.dart <audio_file> | ||
``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not merge into one bot?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Until I finish migrating package:objective_c to native assets, some of these workflows need to run on Dart and some need to run on Flutter. I'll merge them once they can all run on Dart.