flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

feat: strip attributes outside of cargo-expand

Open Desdaemon opened this issue 2 years ago • 4 comments

Changes

  • Inject a special #[cfg] only when running cargo-expand to preserve FRB attributes
  • Preserve token span information

Closes #1488

Closed #1720 (<- edited by @fzyzcjy)

Checklist

  • [x] An issue to be fixed by this PR is listed above.
  • [ ] New tests are added to ensure new features are working. Please refer to this page to see how to add a test.
  • [ ] ./frb_internal precommit --mode slow (or fast) is run (it internal runs code generator, does auto formatting, etc).
  • [ ] If this PR adds/changes features, documentations (in the ./website folder) are updated.
  • [ ] CI is passing. Please refer to this page to see how to solve a failed CI.

Remark for PR creator

  • ./frb_internal --help shows utilities for development.
  • If fzyzcjy does not reply for a few days, maybe he just did not see it, so please ping him.

Desdaemon avatar Jan 17 '24 22:01 Desdaemon

Codecov Report

Attention: Patch coverage is 66.66667% with 10 lines in your changes are missing coverage. Please review.

Project coverage is 55.12%. Comparing base (9fdcce2) to head (42e559d). Report is 1 commits behind head on master.

:exclamation: Current head 42e559d differs from pull request most recent head 1f30aae. Consider uploading reports for the commit 1f30aae to get more accurate results

Files Patch % Lines
...n/generator/api_dart/spec_generator/class/field.rs 0.00% 10 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1676       +/-   ##
===========================================
- Coverage   99.26%   55.12%   -44.14%     
===========================================
  Files         358      351        -7     
  Lines       14948    12703     -2245     
===========================================
- Hits        14838     7003     -7835     
- Misses        110     5700     +5590     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Jan 17 '24 23:01 codecov[bot]

I've been having difficulties running precommit as it keeps deleting everything inside flutter_via_create/integrate, wonder if it's intermittent or something more serious that needs fixing.

Desdaemon avatar Jan 20 '24 21:01 Desdaemon

I've been having difficulties running precommit as it keeps deleting everything inside flutter_via_create/integrate, wonder if it's intermittent or something more serious that needs fixing.

Curently the precommit slow logic contains:

  1. precommit-generate to run codegen for every package
  2. precommit-integrate to run flutter_rust_bridge_codegen create/integrate for flutter_via_create/integrate, which deletes the folder and copy-paste-modify the internal templates into the folder

Thus, if the template is outdated, it will be pasted and override the newly generated thing...

This is suboptimal and maybe we can improve it, what do you think?

fzyzcjy avatar Jan 20 '24 23:01 fzyzcjy

Thus, if the template is outdated, it will be pasted and override the newly generated thing...

Interesting, will check tomorrow what might make the template be outdated.

Desdaemon avatar Jan 21 '24 03:01 Desdaemon