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

The current SDK language version does not match your analyzer package language version #2224

Closed
Larpoux opened this issue Aug 6, 2024 · 8 comments
Labels
bug Something isn't working

Comments

@Larpoux
Copy link
Contributor

Larpoux commented Aug 6, 2024

Describe the bug

When I execute :

flutter_rust_bridge_codegen generate

instead of

cargo run --manifest-path ../flutter_rust_bridge/frb_codegen/Cargo.toml -- generate

I have many problems.
My FRB generator is : flutter_rust_bridge_codegen 2.1.0.
One of the problems that I get is :


[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 5.2s

[WARNING] Attempting to enable experiments `[class-modifiers]`, but the current SDK
language version does not match your `analyzer` package language version:

Analyzer language version: 3.4.0
SDK language version: 3.5.0

In order to use experiments you may need to upgrade or downgrade your
`analyzer` package dependency such that its language version matches that of
your current SDK, see https://github.com/dart-lang/build/issues/2685.

Note that you may or may not have a direct dependency on the `analyzer`
package in your `pubspec.yaml`, so you may have to add that. You can see your
current version by running `pub deps`.

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 2.9s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 9 declared outputs which already existed on disk.
 stderr=

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


PathNotFoundException: Cannot delete file, path = '/Volumes/mac-J/larpoux/projmac/tau/tau/example/linux/flutter/ephemeral/.plugin_symlinks/tau/rust/target/frb_dump/generator_text/api_dart/third_party/web_audio_api/context.freezed.dart' (OS Error: No such file or directory, errno = 2)
dart:async                                                          _rootRunUnary
package:build_runner_core/src/asset/file_based.dart 106:9           FileBasedAssetWriter.delete.<fn>
package:pool/pool.dart 127:14                                       Pool.withResource
dart:async                                                          Future.wait.<fn>
package:build_runner_core/src/generate/build_definition.dart 533:7  _Loader._initialBuildCleanup
package:build_runner_core/src/logging/logging.dart 25:18            logTimedAsync
package:build_runner_core/src/generate/build_definition.dart 280:7  _Loader.prepareWorkspace
package:build_runner_core/src/generate/build_impl.dart 114:27       BuildImpl.create
package:build_runner_core/src/generate/build_runner.dart 34:26      BuildRunner.create
package:build_runner/src/generate/build.dart 109:17                 build
package:build_runner/src/entrypoint/build.dart 35:18                BuildCommand._run
package:args/command_runner.dart 212:13                             CommandRunner.runCommand
package:build_runner/src/entrypoint/run.dart 26:18                  run
.dart_tool/build/entrypoint/build.dart 46:16                        main


[2024-08-06T08:03:32.448Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.1.0/src/library/codegen/polisher/mod.rs:88] Fail to execute_build_runner, but continue to run.
Error details: Err(Failed to run build_runner for "/Volumes/mac-J/larpoux/projmac/tau/tau": [INFO] Generating build script...
[INFO] Generating build script completed, took 502ms

[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 5.2s

[WARNING] Attempting to enable experiments `[class-modifiers]`, but the current SDK
language version does not match your `analyzer` package language version:

Analyzer language version: 3.4.0
SDK language version: 3.5.0

In order to use experiments you may need to upgrade or downgrade your
`analyzer` package dependency such that its language version matches that of
your current SDK, see https://github.com/dart-lang/build/issues/2685.

Note that you may or may not have a direct dependency on the `analyzer`
package in your `pubspec.yaml`, so you may have to add that. You can see your
current version by running `pub deps`.

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 2.9s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 9 declared outputs which already existed on disk.
)
[31.4s] Parse  
  └── [30.6s] Cargo expand & syn parse  
  └── [0.5s] Parse HIR  
  └── [0.3s] Parse MIR  
[5.6s] Generate  
[25.4s] Polish  
  └── [21.2s] Run Dart build_runner  
  └── [3.4s] Run Dart formatter  
  └── [0.8s] Run Rust formatter                                                                                                                                                                                                                                                                                                                                                                                            Done!
    Updating crates.io index
^C     Fetch [=================>               ] 142 complete; 9 pending   

Steps to reproduce

run

flutter_rust_bridge_codegen generate

Logs

-

Expected behavior

No response

Generated binding code

No response

OS

No response

Version of flutter_rust_bridge_codegen

No response

Flutter info

No response

Version of clang++

No response

Additional context

No response

@Larpoux Larpoux added the bug Something isn't working label Aug 6, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 6, 2024

Hmm, this looks like a general flutter build_runner related question. Firstly, maybe try to use flutter stable version (instead of master version)

@fzyzcjy fzyzcjy added the awaiting Waiting for responses, PR, further discussions, upstream release, etc label Aug 6, 2024
@Larpoux
Copy link
Contributor Author

Larpoux commented Aug 6, 2024

I switched to the Stable Flutter Channel but it is not very much better.
I confirm that :

cargo run --manifest-path ../flutter_rust_bridge/frb_codegen/Cargo.toml -- generate

works more or less correctely, but :

flutter_rust_bridge_codegen generate

gives me various errors.
Another error that I get is :

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:3589:89
     |
3579 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
3589 |                         0 => api_that_guard = Some(api_that.lockable_decode_async_ref().await),
     |                                                                                         ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:3595:83
     |
3579 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
3595 |                     web_audio_api::context::AudioContext::close(&*api_that_guard).await;
     |                                                                                   ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:5470:89
     |
5460 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
5470 |                         0 => api_that_guard = Some(api_that.lockable_decode_async_ref().await),
     |                                                                                         ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:5476:85
     |
5460 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
5476 |                     web_audio_api::context::AudioContext::suspend(&*api_that_guard).await;
     |                                                                                     ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8207:89
     |
8197 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8207 |                         0 => api_that_guard = Some(api_that.lockable_decode_async_ref().await),
     |                                                                                         ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8213:91
     |
8197 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8213 |                     web_audio_api::context::OfflineAudioContext::resume(&*api_that_guard).await;
     |                                                                                           ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8326:89
     |
8316 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8326 |                         0 => api_that_guard = Some(api_that.lockable_decode_async_ref().await),
     |                                                                                         ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8333:26
     |
8316 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8333 |                         .await,
     |                          ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8474:89
     |
8464 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8474 |                         0 => api_that_guard = Some(api_that.lockable_decode_async_ref().await),
     |                                                                                         ^^^^^ only allowed inside `async` functions and blocks

error[E0728]: `await` is only allowed inside `async` functions and blocks
    --> src/frb_generated.rs:8484:22
     |
8464 |             transform_result_sse::<_, ()>((move || {
     |                                            ------- this is not `async`
...
8484 |                     .await;
     |                      ^^^^^ only allowed inside `async` functions and blocks

For more information about this error, try `rustc --explain E0728`.
error: could not compile `tau` (lib test) due to 10 previous errors
warning: build failed, waiting for other jobs to finish...
error: could not compile `tau` (lib) due to 10 previous errors
Error: ~/bin/generate.sh

And another error that I have some time when using flutter_rust_bridge_codegen generate :

[INFO] Generating build script completed, took 234ms

[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 3.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.8s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 9 declared outputs which already existed on disk.
 stderr=

You have hit a bug in build_runner
Please file an issue with reproduction steps at https://github.com/dart-lang/build/issues


PathNotFoundException: Cannot delete file, path = '/Volumes/mac-J/larpoux/projmac/tau/tau/example/linux/flutter/ephemeral/.plugin_symlinks/tau/example/windows/flutter/ephemeral/.plugin_symlinks/tau/lib/public/rust/third_party/web_audio_api/context.freezed.dart' (OS Error: No such file or directory, errno = 2)
dart:async                                                          _rootRunUnary
package:build_runner_core/src/asset/file_based.dart 106:9           FileBasedAssetWriter.delete.<fn>
package:pool/pool.dart 127:14                                       Pool.withResource
dart:async                                                          Future.wait.<fn>
package:build_runner_core/src/generate/build_definition.dart 533:7  _Loader._initialBuildCleanup
package:build_runner_core/src/logging/logging.dart 25:18            logTimedAsync
package:build_runner_core/src/generate/build_definition.dart 280:7  _Loader.prepareWorkspace
package:build_runner_core/src/generate/build_impl.dart 114:27       BuildImpl.create
package:build_runner_core/src/generate/build_runner.dart 34:26      BuildRunner.create
package:build_runner/src/generate/build.dart 109:17                 build
package:build_runner/src/entrypoint/build.dart 35:18                BuildCommand._run
package:args/command_runner.dart 212:13                             CommandRunner.runCommand
package:build_runner/src/entrypoint/run.dart 26:18                  run
.dart_tool/build/entrypoint/build.dart 46:16                        main


[2024-08-06T11:31:59.790Z WARN /Volumes/mac-J/larpoux/.cargo/registry/src/index.crates.io-6f17d22bba15001f/flutter_rust_bridge_codegen-2.1.0/src/library/codegen/polisher/mod.rs:88] Fail to execute_build_runner, but continue to run.
Error details: Err(Failed to run build_runner for "/Volumes/mac-J/larpoux/projmac/tau/tau": [INFO] Generating build script...
[INFO] Generating build script completed, took 234ms

[INFO] Precompiling build script......
[INFO] Precompiling build script... completed, took 3.0s

[INFO] Initializing inputs
[INFO] Building new asset graph...
[INFO] Building new asset graph completed, took 1.8s

[INFO] Checking for unexpected pre-existing outputs....
[INFO] Deleting 9 declared outputs which already existed on disk.
)
[20.7s] Parse  
  └── [20.1s] Cargo expand & syn parse  

What is weird is that I can have many different errors when using flutter_rust_bridge_codegen generate.
cargo run --manifest-path ../flutter_rust_bridge/frb_codegen/Cargo.toml -- generate works better for me.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 6, 2024

Try

flutter_rust_bridge_codegen --version

Are you using the latest version?

And, is it possible you are using some feature that has not been released?

@Larpoux
Copy link
Contributor Author

Larpoux commented Aug 6, 2024

My FRB generator is : flutter_rust_bridge_codegen 2.1.0.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 6, 2024

Ok, looks like #2190 is merged but not yet released. I will release 2.2.0 probably within a day (after CI of #2228 is green)

@Larpoux
Copy link
Contributor Author

Larpoux commented Aug 6, 2024

No need to hurry. I have many other things to work on ...
Take your time

@fzyzcjy
Copy link
Owner

fzyzcjy commented Aug 12, 2024

2.2.0 has been released before and this should be solved :)

@fzyzcjy fzyzcjy closed this as completed Aug 12, 2024
@fzyzcjy fzyzcjy removed the awaiting Waiting for responses, PR, further discussions, upstream release, etc label Aug 12, 2024
Copy link
Contributor

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 github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants