flutter_rust_bridge icon indicating copy to clipboard operation
flutter_rust_bridge copied to clipboard

[experimental-feature] third party lib, doesnt throw errors nor generate files

Open abdelaziz-mahdy opened this issue 1 year ago • 8 comments

Describe the bug

i am trying to create mapping to polars, but the generate function works but doesnt create the mapping so i am confused

Steps to reproduce

Hint: A simple way to reproduce is to clone and modify the https://github.com/fzyzcjy/flutter_rust_bridge/tree/master/frb_example/dart_minimal example package according to your needs.

  1. updated the frb_example/dart_minimal/flutter_rust_bridge.yaml to have rust_input: polars
  2. run cd rust && cargo add polars && cd ..
  3. run flutter_rust_bridge_codegen generate

Logs

https://justpaste.it/exo6j

Expected behavior

the dart binding should get generated

Generated binding code

none

OS

macos

Version of flutter_rust_bridge_codegen

2.4.0

Flutter info

[✓] Flutter (Channel stable, 3.24.3, on macOS 15.0 24A335 darwin-arm64, locale
    en-EG)
    • Flutter version 3.24.3 on channel stable at
      /Users/AbdelazizMahdy/Developer/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2663184aa7 (8 days ago), 2024-09-11 16:27:48 -0500
    • Engine revision 36335019a8
    • Dart version 3.5.3
    • DevTools version 2.37.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/AbdelazizMahdy/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      17.0.11+0-17.0.11b1207.24-11852314)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      17.0.11+0-17.0.11b1207.24-11852314)

[✓] IntelliJ IDEA Community Edition (version 2024.2.0.2)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 242.20629

[✓] VS Code (version 1.93.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.96.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 15.0 24A335 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 15.0 24A335 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 128.0.6613.138

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Version of clang++

clang --version Apple clang version 16.0.0 (clang-1600.0.26.3) Target: arm64-apple-darwin24.0.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Additional context

No response

abdelaziz-mahdy avatar Sep 19 '24 23:09 abdelaziz-mahdy

Hi! Thanks for opening your first issue here! :smile:

welcome[bot] avatar Sep 19 '24 23:09 welcome[bot]

Hi, could you please provide a minimal reproducible sample?

Btw, polars may be too complex to be auto scanned by the experimental "scan whole third party package" feature.

And you may be interested in: https://github.com/Desdaemon/polars_dart

fzyzcjy avatar Sep 20 '24 00:09 fzyzcjy

this is an example repo, https://github.com/abdelaziz-mahdy/polars_dart

i would love to have the auto scan working in general since that will make migration rust crates binding so much easier and that will improve the dart platform in general, so i am interested to make it work

abdelaziz-mahdy avatar Sep 20 '24 00:09 abdelaziz-mahdy

i would love to have the auto scan working in general since that will make migration rust crates binding so much easier and that will improve the dart platform in general, so i am interested to make it work

I think so, that would be quite convenient. And, even if it cannot handle 100% cases, let it handle a large portion of trivial things would also be beneficial.

fzyzcjy avatar Sep 20 '24 03:09 fzyzcjy

Looked at the logs. Seems

[2024-09-19T23:27:04.134Z DEBUG /Users/AbdelazizMahdy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.4.0/src/library/codegen/parser/hir/tree/transformer/pub_use_transformer.rs:155] transform_module_by_pub_use_single skip `PubUseInfo { namespace: Namespace { joined_path: "polars_core::export" }, name_filter: None }` since cannot find mod

i.e. the polars package is almost empty and only exports polars_core. On the other hand, frb currently has not implemented such complex cross-multiple-third-party-crate-import things.

fzyzcjy avatar Sep 20 '24 03:09 fzyzcjy

Looked at the logs. Seems

[2024-09-19T23:27:04.134Z DEBUG /Users/AbdelazizMahdy/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.4.0/src/library/codegen/parser/hir/tree/transformer/pub_use_transformer.rs:155] transform_module_by_pub_use_single skip `PubUseInfo { namespace: Namespace { joined_path: "polars_core::export" }, name_filter: None }` since cannot find mod

i.e. the polars package is almost empty and only exports polars_core. On the other hand, frb currently has not implemented such complex cross-multiple-third-party-crate-import things.

Oh okay, guess I will wait for it to get fixed when you have time to do so,

Or create my own API around it

Thank you for the awesome package and looking forward to scanning to be improved

abdelaziz-mahdy avatar Sep 20 '24 07:09 abdelaziz-mahdy

You are welcome! I guess this may be a bit nontrivial so cannot estimate the time to implement it.

fzyzcjy avatar Sep 20 '24 07:09 fzyzcjy

i was trying ndarray and faced the same issue, dont know if they are related or not but i wanted to share it incase it helps https://github.com/abdelaziz-mahdy/rust_ndarray_dart logs: https://justpaste.it/8v3kt

abdelaziz-mahdy avatar Sep 22 '24 01:09 abdelaziz-mahdy

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 Jan 04 '25 13:01 stale[bot]

Do you think it's doable? Or should we close the issue?

abdelaziz-mahdy avatar Jan 04 '25 16:01 abdelaziz-mahdy

I think polars may be really too complex, and a semi-manual mapping may be needed... But maybe in the long future we will have our codegen so strong that can auto handle it.

fzyzcjy avatar Jan 04 '25 23:01 fzyzcjy

I think polars may be really too complex, and a semi-manual mapping may be needed... But maybe in the long future we will have our codegen so strong that can auto handle it.

is it the same for ndarray?

and if there is resources or guidance on how i can improve it i would love to do so

abdelaziz-mahdy avatar Jan 10 '25 14:01 abdelaziz-mahdy

Yes, I guess ndarray is also too complicated to be auto translated... There is doc but is mainly about how to use it. To modify the auto translation logic, the main source may be looking at the code.

fzyzcjy avatar Jan 10 '25 23:01 fzyzcjy

Yes, I guess ndarray is also too complicated to be auto translated... There is doc but is mainly about how to use it. To modify the auto translation logic, the main source may be looking at the code.

okay noted, will look into it when i got time and if i am able to contribute will open a pr, thank you for the awesome package <3

abdelaziz-mahdy avatar Jan 10 '25 23:01 abdelaziz-mahdy

You are welcome and looking forward to it!

fzyzcjy avatar Jan 11 '25 00:01 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.

github-actions[bot] avatar Mar 12 '25 02:03 github-actions[bot]

false

github-actions[bot] avatar Mar 19 '25 02:03 github-actions[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 Apr 02 '25 02:04 github-actions[bot]