Closed justinmoon closed 1 year ago
Hi! Thanks for opening your first issue here! :smile:
looks like flutter_gen not installed
hmm looks like build_runner throws error, so maybe it is a bug/misuse there
After adding flutter_gen: ^5.1.0+1
to packages/api_client/pubspec.yaml
and running flutter pub get
, I get the following:
flutter_rust_bridge_codegen -r lib/src/rust_bridge/src/api.rs -d lib/src/rust_bridge/bridge_generated.dart -c ../../apps/something/ios/Runner/bridge_generated.h
[2022-11-01T10:47:03Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/io.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/io/mod.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/bridge_generated/io.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/bridge_generated/io/mod.rs, )
Flutter 3.3.6 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 6928314d50 (7 days ago) • 2022-10-25 16:34:41 -0400
Engine • revision 3ad69d7be3
Tools • Dart 2.18.2 • DevTools 2.15.0
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Picked config: Opts { rust_input_path: "/Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/api.rs", dart_output_path: "/Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/bridge_generated.dart", dart_decl_output_path: None, c_output_path: ["/Users/justin/something/mobile/packages/api_client/../../apps/something/ios/Runner/bridge_generated.h"], rust_crate_dir: "/Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge", rust_output_path: "/Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/bridge_generated.rs", class_name: "RustBridge", dart_format_line_length: 80, skip_add_mod_to_lib: false, llvm_path: ["/opt/homebrew/opt/llvm", "/usr/local/opt/llvm", "/usr/lib/llvm-9", "/usr/lib/llvm-10", "/usr/lib/llvm-11", "/usr/lib/llvm-12", "/usr/lib/llvm-13", "/usr/lib/llvm-14", "/usr/lib/", "/usr/lib64/", "C:/Program Files/llvm", "C:/msys64/mingw64"], llvm_compiler_opts: "", manifest_path: "/Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/Cargo.toml", dart_root: Some("/Users/justin/something/mobile/packages/api_client"), build_runner: true, block_index: BlockIndex(0), skip_deps_check: false, wasm_enabled: false, inline_rust: false }
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Phase: Parse source code to AST, then to IR
[2022-11-01T10:47:04Z WARN lib_flutter_rust_bridge_codegen::source_graph] Skipping unresolvable module io (tried /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/io.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/io/mod.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/bridge_generated/io.rs, /Users/justin/something/mobile/packages/api_client/lib/src/rust_bridge/src/bridge_generated/io/mod.rs, )
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Phase: Transform IR
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Rust code
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Phase: Generate Dart code
[2022-11-01T10:47:04Z INFO lib_flutter_rust_bridge_codegen] Phase: Generating Dart bindings for Rust
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "flutter pub get" again.
pub finished with exit code 65
[2022-11-01T10:47:05Z WARN lib_flutter_rust_bridge_codegen::commands] command="sh" "-c" "\"flutter\" \"pub\" \"run\" \"ffigen\" \"--config\" \"/var/folders/97/q5fc74fx3zs0rqkk9_9lb5q00000gn/T/.tmpMeTi93\"" stdout= stderr=
[2022-11-01T10:47:05Z ERROR flutter_rust_bridge_codegen] fatal: ffigen failed:
stderr:
stdout:
error: Recipe `gen` failed on line 7 with exit code 1
Hmmm. But I get this same error when comment out Foo
and get_foo
... so maybe this method of installing flutter_gen
isn't right?
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "flutter pub get" again.
The pubspec.lock file has changed since the .dart_tool/package_config.json file was generated, please run "flutter pub get" again.
I re-ran flutter pub get
a few times from apps/app-name
and packages/api_client
and still get the same error.
hmm maybe output debug logs and see what command it runs and see what is the problem. feel free to PR after you find the bug!
The root problem was that I had a conflicting version ffigen
installed by one of my dependencies.
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.
Describe the bug
I have a flutter app where the actual app is in
apps/<app-name>
, which contains a package that usesflutter_rust_bridge
inpackages/api_client/lib/src/rust_bridge
.I have the following enum in
api.rs
:From the
rust_bridge
folder, I attempt to generate bindings with the following command:If the enum isn't nested at all this doesn't happen. For example, the following works just fine:
Codegen logs with
RUST_LOG=debug
environment variableTo Reproduce
No response
Expected behavior
No response
Generated binding code
bridge_generated.dart
: