flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

Ability to mark a method to be ignored by codegen

Open qdot opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. I've got a JNI_OnLoad method that I have to export "C" in order for JNI to call it on init.

This method doesn't need to be exported to dart at all, but seems to be no matter what. I also need to build this library on iOS, which means I don't want the JNI picked up there (it'll generate into the iOS headers and definitely won't build there), but it doesn't look like codegen parses cfg(target) attributes I currently have guarding it.

Describe the solution you'd like

A way to mark a method to not be exported by codegen even if it is marked pub/extern.

Describe alternatives you've considered

Currently I'm just dividing my main input modules into ios/android and generating through those.

qdot avatar Sep 17 '22 07:09 qdot

I agree. Feel free to make a PR!

fzyzcjy avatar Sep 17 '22 07:09 fzyzcjy

@fzyzcjy Would you be ok with an addition to the codegen RawOpts to just ignore certain files, the paths of which would be passed in a vec? I feel like trying to parse out fn attributes might be a bit difficult.

qdot avatar Sep 17 '22 20:09 qdot

LGTM :)

fzyzcjy avatar Sep 17 '22 23:09 fzyzcjy

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 17 '22 01:11 stale[bot]

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

github-actions[bot] avatar Dec 08 '22 02:12 github-actions[bot]