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

[cfe] process .dart_tool/build/generated folder #51105

Closed
asashour opened this issue Jan 23, 2023 · 4 comments
Closed

[cfe] process .dart_tool/build/generated folder #51105

asashour opened this issue Jan 23, 2023 · 4 comments
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.

Comments

@asashour
Copy link
Contributor

asashour commented Jan 23, 2023

This is the CFE part of #51087, to support build

The below cases don't find the part, on running main(), taken from the sample package:

// example/foo.dart
part 'foo.g.dart';

void main() {
  print(_abc);
}
// .dart_tool/build/generated/<project_name>/example/foo.g.dart
part of 'foo.dart';

var _abc = 'hello';
error
example/foo.dart:1:6: Error: Error when reading 'example/foo.g.dart': The system cannot find the file specified.

part 'foo.g.dart';
     ^
example/foo.dart:1:6: Error: Can't use 'example/foo.g.dart' as a part, because it has no 'part of' declaration.
part 'foo.g.dart';
     ^
example/foo.dart:4:9: Error: Undefined name '_abc'.
  print(_abc);
        ^^^^

Having library also gives similar error.

// example/foo_lib.dart
library foo_library;

part 'foo_lib.g.dart';

void main() {
  print(_abc);
}
// .dart_tool/build/generated/example/foo_lib.g.dart
part of 'foo_lib.dart';

var _abc = 'hello';

/cc @greglittlefield-wf

@a-siva a-siva added the area-front-end Use area-front-end for front end / CFE / kernel format related issues. label Jan 25, 2023
@johnniwinther
Copy link
Member

@asashour @jakemac53 Where is it specified that we are supposed to handle this?

@jakemac53
Copy link
Contributor

jakemac53 commented Jan 25, 2023

@johnniwinther I am not aware of any plan to support this in the CFE (if we were going to do that I would probably try and do it through some feature in the package_config.json so it was more general).

@jakemac53
Copy link
Contributor

Note that you should be able to use dart run build_runner run <script> instead of dart <script> and that should work for build to cache files.

@asashour
Copy link
Contributor Author

should be able to use dart run build_runner run <script> instead

You are right, sorry that I didn't test it this way.

Apologies for the disturbance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-front-end Use area-front-end for front end / CFE / kernel format related issues.
Projects
None yet
Development

No branches or pull requests

4 participants