Repository navigation
[flutter_tools] remove globals from compilers - #59184
Conversation
| } | ||
|
|
||
|
|
||
| class _TestArtifacts implements Artifacts { |
There was a problem hiding this comment.
I got tired of mocking Artifacts when I don't actually care about the contents. This should trivially generate unique-ish artifact paths for testing
| this.pid = 1, | ||
| Future<int> exitCode, | ||
| Stream<List<int>> stdin, | ||
| IOSink stdin, |
There was a problem hiding this comment.
this type was wrong and the case is bogus
| // Override the filesystem scheme so that the frontend_server can find | ||
| // the generated entrypoint code. | ||
| fileSystemScheme: 'org-dartlang-app', | ||
| compilerMessageConsumer: |
There was a problem hiding this comment.
@annagrin I need to remove this because it prevents regular compiler errors from showing up on the web
There was a problem hiding this comment.
I need to understand this better. I added this to communicate compiler errors to the debugger during evaluation, so something might break there...
There was a problem hiding this comment.
This is only printing trace messages, how is the debugger using printed messages?
There was a problem hiding this comment.
For expression evaluation, the debugger does not need messages printed to the console, but instead is handing them specially, depending on the context (watch window, hover over, expression evaluation box, conditional compilation all need their own error handling). Not sure how the debugger is getting the error messages though, will find it out and update.
I tried the change and figured out that if we suppress the compilation messages in compile.dart :
Future<CompilerOutput> _compileExpressionToJs(_CompileExpressionToJsRequest request) async {
_stdoutHandler.reset(suppressCompilerMessages: **false**, expectSources: false);
then we get the desired effect - the error messages are still propagating to the debugger but the printing is gone.
There was a problem hiding this comment.
Ahh, awesome - I will make that change!
There was a problem hiding this comment.
Figured out how debugger gets compilation errors:
So as long as the generator writes them to the file, the debugger should get them:
And the errors table is filled by:
This a bit too complicated, may need revisiting and simplification...
…ms/flutter into resident_runner_dependencies
| } | ||
| } | ||
|
|
||
| void _reportCompilerMessage(String message, {bool emphasis, TerminalColor color}) { |
There was a problem hiding this comment.
Rather than printing this message after a bunch of compilation failures, the new test compiler checks for a dependency before compiling and exits early. This gives a much clearer instruction on how to resolve the error too
| <<stderr>> | ||
| <<skip until matching line>> | ||
| Failed to load test harness\. +Are you missing a dependency on flutter_test\? No newline at end of file | ||
| Error: cannot run without a dependency on "package:flutter_test". Ensure the following lines are present in your pubspec.yaml: |
There was a problem hiding this comment.
By checking the package config we know definitely there is a missing dependency. Added instructions on how to fix
jmagman
left a comment
There was a problem hiding this comment.
nit: CompilerMessageConsumer typedef is unused, remove.
LGTM
| @@ -68,10 +76,6 @@ void main() { | |||
| verifyNoMoreInteractions(mockFrontendServerStdIn); | |||
There was a problem hiding this comment.
Can any of these use testWithoutContext?
| verify(residentCompiler.shutdown()).called(1); | ||
| })); | ||
|
|
||
| test('Reports an error when there is no dependency on flutter_test', () => testbed.run(() async { |
There was a problem hiding this comment.
not until these tests are re-written.
|
Fixes #59510 |
Refactors KernelCompiler and ResidentCompiler to no longer use globals (except as a fallback for g3 migration). Improves the compilation error when running flutter test on a package without a flutter_test dependency. Updates machine mode to output trace text to stderr
Refactors KernelCompiler and ResidentCompiler to no longer use globals (except as a fallback for g3 migration). Improves the compilation error when running flutter test on a package without a flutter_test dependency. Updates machine mode to output trace text to stderr
Description
Refactors KernelCompiler and ResidentCompiler to no longer use globals (except as a fallback for g3 migration). Improves the compilation error when running
flutter teston a package without a flutter_test dependency.Fixes #59510