Description
I wanted to test how the resident compiler handled running totally different apps back to back, and how quickly it could recompile them (hopefully re-using shared deps, and ideally not throwing away stuff that isn't shared either).
In doing so I managed to get into a bad state where the resident compiler is failing to resolve packages, and I cannot get out of that state.
Repro instructions:
dart create repro
cd repro
dart pub upgrade
dart run -r test --help
dart pub add build_runner --dev
dart pub upgrade
dart run -r build_runner --help
The second command fails, with errors like:
Error: Couldn't resolve the package 'args' in 'package:args/args.dart'.
Error: Couldn't resolve the package 'args' in 'package:args/command_runner.dart'.
Error: Couldn't resolve the package 'build_runner' in 'package:build_runner/src/build_script_generate/bootstrap.dart'.
Error: Couldn't resolve the package 'build_runner' in 'package:build_runner/src/entrypoint/options.dart'.
Error: Couldn't resolve the package 'build_runner' in 'package:build_runner/src/entrypoint/runner.dart'.
Error: Couldn't resolve the package 'build_runner' in 'package:build_runner/src/logging/std_io_logging.dart'.
Error: Couldn't resolve the package 'build_runner_core' in 'package:build_runner_core/build_runner_core.dart'.
Error: Couldn't resolve the package 'io' in 'package:io/ansi.dart'.
Error: Couldn't resolve the package 'io' in 'package:io/io.dart'.
Error: Couldn't resolve the package 'logging' in 'package:logging/logging.dart'.
Note that many of these packages are shared across the two apps (both test
and build_runner
use package:args), and removing the -r
flag makes both commands succeed. I can also see these packages in my package config.
And now, I am in a state where I actually cannot run any apps at all using the -r
method, from seemingly any package, even after shutting down the compiler.
We should probably also add a clean
command or something to reset all caches.