Skip to content
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

Avoid global ffigen #605

Merged
merged 31 commits into from
Aug 3, 2022
Merged

Conversation

Roms1383
Copy link
Contributor

@Roms1383 Roms1383 commented Aug 1, 2022

Fixes #602.

Checklist

  • An issue to be fixed by this PR is listed above.
  • New tests are added to ensure new features are working. End-to-end tests are usually in the ./frb_example/pure_dart example, more specifically, rust/src/api.rs and dart/lib/main.dart.
  • The code generator has been run, and code changes are commited. (Otherwise, CI will fail.)
  • If this PR adds/changes features, documentations (in the ./book folder) are updated.
  • CI is passing.

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 1, 2022

Right now my code in frb_codegen is very messy, will have to clean it up following your recommandations.
Also a bunch of tasks are yet to be done : update docs, etc.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 1, 2022

Good job! Feel free to mark it as "ready for review" when ready for review :)

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 1, 2022

Honestly there's a bunch of changes in frb_codegen/src/commands.rs that can greatly be improved, but I would prefer to have your feedback first @fzyzcjy.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 1, 2022

Honestly there's a bunch of changes in frb_codegen/src/commands.rs that can greatly be improved

Yes, I totally agree - code refactor is very welcomed!

Indeed, when I firstly publish this open source lib, I did not expect it to grow this popular :) So the code style was not that good at that time. And later when it grow bigger and bigger more problems arise.

but I would prefer to have your feedback first

I guess you mean I review the current code? Sure, I will do it in a minute.

Copy link
Owner

@fzyzcjy fzyzcjy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

frb_codegen/src/error.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
Roms1383 added 11 commits August 1, 2022 13:24
move ensure_dependencies, ensure_dev_dependencies, guess_toolchain and related structs
also kept the check on its original value at the bottom of frb_codegen method since it conditionally check on freezed and build_runner, which are only available down the scope
rename DependenciesContext into PackageManager, and rename argument name in functions, add Display implementation and change visibility
refactor error MissingDep and InvalidDep with named fields
version req comparison is not implemented in semver crate yet
@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 1, 2022

While updating the docs I noticed the same recommendations are literally redundant in 4 different markdown files.
Maybe we could specify it once in one file and link all the other files to it ?

I also noticed the CI won't pass because flutter --version is not recognized, for example this failed job.

Since I started to remove the code to check dart package version requirements comparison (see discussion above), I guess I can even remove more code.

Not sure if it should be marked as ready for review yet ?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 1, 2022

the same recommendations are literally redundant in 4 different markdown files.
Maybe we could specify it once in one file and link all the other files to it ?

Sure :)

Is it possible to use this feature: https://rust-lang.github.io/mdBook/format/mdbook.html#including-files

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 1, 2022

I also noticed the CI won't pass because flutter --version is not recognized, for example this failed job.

Weird... So how do we run other flutter commands? Maybe missing PATH env var or something?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 1, 2022

Not sure if it should be marked as ready for review yet ?

Surely depends on you :) I will review 8hr later when getting up tomorrow

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 2, 2022

Sure :)
Is it possible to use this feature: https://rust-lang.github.io/mdBook/format/mdbook.html#including-files

Oh ok, exactly what I was thinking then 👌
p.s: I'll address it last.

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 2, 2022

Weird... So how do we run other flutter commands? Maybe missing PATH env var or something?

As far as I understand flutter_rust_bridge github workflow, so far all the examples were treated as depending onto dart toolchain, as can be seen in the common job step.
And looking at all the steps from ci.yaml, no matter these are pure dart or with flutter, they all setup repo the same.

How do you want to address it ? Add flutter toolchain for all, or split the steps in 2 different jobs ? @fzyzcjy

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 2, 2022

Surely depends on you :) I will review 8hr later when getting up tomorrow

Well then I'm gonna wait to make some more progress to avoid consuming your Github Action credit and your time altogether. I still have to improve on these points 😅

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 2, 2022

Add flutter toolchain for all, or split the steps in 2 different jobs ?

adding flutter toolchain LGTM, since that is really a flutter project :)

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 2, 2022

Surely depends on you :) I will review 8hr later when getting up tomorrow

Well then I'm gonna wait to make some more progress to avoid consuming your Github Action credit and your time altogether. I still have to improve on these points 😅

Btw that 8hr has already passed - I reviewed it this morning (about 6hr ago from now).

No worries about CI - the definition, "continuous" integration, means it will run for every commit. Big repos like Rust, Flutter, etc, all do that. Btw GitHub supports open source projects by providing free CI for public repos.

As for my time - I am happy to reply if you have trouble that cannot be solved easily or need review or need discussions etc :)

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 2, 2022

Alright ! A big thanks anyway, that's a pleasure contributing to your repo @fzyzcjy :)

add flutter setup action to run codegen jobs in ci and post release workflows
add install dependencies step for examples in run codegen workflow
@Roms1383 Roms1383 marked this pull request as ready for review August 2, 2022 09:54
@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 2, 2022

Also a pleasure for me :)

Copy link
Owner

@fzyzcjy fzyzcjy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job! Only some nits and I am ready to merge it

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Show resolved Hide resolved
.github/workflows/post_release.yaml Outdated Show resolved Hide resolved
book/src/setup_codegen.md Outdated Show resolved Hide resolved
book/src/tutorial_with_flutter.md Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/commands.rs Show resolved Hide resolved
frb_codegen/src/commands.rs Outdated Show resolved Hide resolved
frb_codegen/src/utils.rs Outdated Show resolved Hide resolved
@Roms1383 Roms1383 requested a review from fzyzcjy August 3, 2022 01:43
Copy link
Owner

@fzyzcjy fzyzcjy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) we only have a few conversations unresolved yet (which GitHub blocks merging, surely)

image

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 3, 2022

going to merge once ci pass :)

@Roms1383
Copy link
Contributor Author

Roms1383 commented Aug 3, 2022

CI is failing:
image
image
image

should I add architecture: x64 to subosito/flutter-action@v2 ?

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 3, 2022

Given the another ios test passes, the code should be ok. That ci failure is indeed another quite annoying problem... Feel free to solve it (in another PR)!

@fzyzcjy fzyzcjy merged commit e742f07 into fzyzcjy:master Aug 3, 2022
@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 3, 2022

@all-contributors please add @Roms1383 for doc

@allcontributors
Copy link
Contributor

@fzyzcjy

I've put up a pull request to add @Roms1383! 🎉

@Roms1383 Roms1383 mentioned this pull request Aug 3, 2022
5 tasks
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Avoid the need of global ffigen to improve isolation and simplify installation
2 participants