-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Augment output in dart compile to clarify null safety compilation mode #44234
Comments
The CFE never reads the pubspec.yaml. Only the package_config.json (through package:package_config). |
Should this be a warning? Maybe the AI is to make it more obvious what mode we're running in? |
@mit-mit What are your thoughts on this? |
From a discussion in the language team, we think this should not be a warning shown when running dart code (e.g. running But, we still think it's worth adjusting the output of commands that build release-mode artifacts to state which form of null safety was used. Concretely we'd like to suggest we adjust the output of
WDYT @jonahwilliams @bkonyi @devoncarew ? |
Consider highlighting the unsound version: Compiling Dart code with sound null safety. vs. Compiling Dart code with unsound null safety. |
Or even: Compiling Dart code with unsound null safety (see dart.dev/... for more information). |
I'm fairly certain I saw |
The proposal in #44234 (comment) makes sense to me. Please file an issue in the Flutter issue tracker for the work needed on the Flutter tool. Thanks! |
Thanks @zanderso, opened flutter/flutter#72279 for the warning in |
Updating the present issue to track the change in
|
I'm uncertain as to which level in the stack should be outputting this information, but I'm thinking it needs to be done in each compilation pipeline. cc/ @dcharkes for |
Agree this cannot be handled in dart-cli, but in each underlying compiler since the information necessary for this is available much later in time. One alternative could be to share the logic in the CFE. To clarify on the earlier comments, this wouldn't require reading the pubspec.yaml, it would just mean to report a warning if the main entrypoint is in a library that is using legacy semantics. Doing this in the CFE may be nice since the CFE already reports errors that are similar in nature when the app is in sound mode (e.g. complaining if you import an opted-out library). Currently we already have |
Generally the CFE doesn't know the context for its invocation, meaning that any messaging provided for one context will be misleading/wrong/confusing for another. Besides this case, we for instance mention updating For this reason I'd like to add support for passing an identification of this context to CFE and use this to guide its messaging. |
@johnniwinther it sounds like you have a good handle on what needs to be done here. Can I get you to drive this work? |
I will. |
Should the message be reported as a warning (i.e. with colors and "Warning: " prefix) ? |
No, I think I would classify this as an information message, not a warning. |
Flutter work (flutter/flutter#72279) is now complete. |
Code review in https://dart-review.googlesource.com/c/sdk/+/178982 |
This adds a new messages kind 'info' to the CFE for showing general information during compilation. A 'configuration' options is added to `CompilerOptions` for telling the CFE how it is run. The configuration 'compile' is added for when the CFE is invoked to produces an "executable" as when running `dart compile`. When configuration is set, the CFE emits an info message about the null safety compilation mode. Support for `dart compile exe` and `dart compile js` is added in this CL. Support for `dart compile kernel|app-jit|aot` is not included. In response to #44234 TEST=pkg/dartdev/test/commands/compile_test.dart Change-Id: I08f51e2a3f5ad4841c4d703bcd266b7afb63c7c6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178982 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Jens Johansen <jensj@google.com>
This reverts commit f8b0d26. Reason for revert: Multiple test failures in app-jit and simarm(64) Original change's description: > [vm] Pass snapshot flag to kernel_service > > Enable reporting of null safety compilation mode when running > `dart compile aot-snapshot`, `dart compile jit-snapshot`, > and `dart compile kernel`. > > Closes #44234 > > TEST=pkg/dartdev/test/commands/compile_test.dart > > Change-Id: I0d4b35c6ccb4167c0c7539a4eb24a5139e29cf53 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/178990 > Commit-Queue: Johnni Winther <johnniwinther@google.com> > Reviewed-by: Ben Konyi <bkonyi@google.com> TBR=bkonyi@google.com,johnniwinther@google.com Change-Id: I83aeaa8620c640d02d5ccfd1fe8112d8209a9ad4 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179773 Auto-Submit: Aske Simon Christensen <askesc@google.com> Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reopening due to revert. |
@bkonyi can you take a look at this? - the app-jit/simarm failures are bit out of my scope. |
Yes, I'll take a look. |
@johnniwinther it looks like most of these failures can just be approved as the tests are failing due to stdout not matching the test expectations. However, the app_jitk-linux-debug-x64 assertion failures don't look good. @alexmarkov might be the right person to look at that since it's in the compiler. |
Relanding the reverted change will be blocked until #44714 is resolved. |
@johnniwinther as discussed yesterday, we should rephrase the 'unsound' message a bit, as it is shown both for projects with a 2.12 constraint & an entry-point opt-out, and for projects with a 2.9 constraint. I suggest:
|
In response to #44234 (comment) Change-Id: I88ab66199217e817edead394ccc74a3f3b49ba15 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180143 Reviewed-by: Michael Thomsen <mit@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
"Compiling without sound null safety" UI string change landed in 134a437 |
#44714 is closed |
The reverted CL is ready to reland: https://dart-review.googlesource.com/c/sdk/+/180187 |
I got confused when retrying a migration. I'd accidently left a
@dart = 2.10
in my entry point but migrated the rest of the app and the pubspec.Might be worth emitting a warning that the mode disagrees with the pubspec.
Also not sure if this is best done in CFE or flutter tool - @mit-mit @johnniwinther @jonahwilliams
The text was updated successfully, but these errors were encountered: