Fix update_static_error_tests.dart after recent binary removals.
We no longer build separate binaries for `dartanalyzer` and `dart2js`,
so we need to do something different.
For `dartanalyzer`, we just run the `dartanalyzer` script directly
(because the features we need for testing aren't available directly
from `dart analyze`). For `dart2js`, we run in the new way (`dart
compile js`).
Change-Id: I7e34052a9e6ad62596279ca32604e32291a45953
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251842
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart
index a66e98c..2259c4a 100644
--- a/pkg/test_runner/tool/update_static_error_tests.dart
+++ b/pkg/test_runner/tool/update_static_error_tests.dart
@@ -21,8 +21,7 @@
"Usage: dart update_static_error_tests.dart [flags...] <path glob>";
final _dartPath = _findBinary("dart", "exe");
-final _analyzerPath = _findBinary("dartanalyzer", "bat");
-final _dart2jsPath = _findBinary("dart2js", "bat");
+final _analyzerPath = p.join('pkg', 'analyzer_cli', 'bin', 'analyzer.dart');
Future<void> main(List<String> args) async {
var sources = ErrorSource.all.map((e) => e.marker).toList();
@@ -210,7 +209,8 @@
// TODO(rnystrom): Running the analyzer command line each time is very slow.
// Either import the analyzer as a library, or at least invoke it in a batch
// mode.
- var result = await Process.run(_analyzerPath, [
+ var result = await Process.run(_dartPath, [
+ _analyzerPath,
...options,
"--format=json",
file.absolute.path,
@@ -265,7 +265,9 @@
/// Invoke dart2js on [file] and gather all static errors it reports.
Future<List<StaticError>> runDart2js(
File file, List<String> options, List<StaticError> cfeErrors) async {
- var result = await Process.run(_dart2jsPath, [
+ var result = await Process.run(_dartPath, [
+ 'compile',
+ 'js',
...options,
"-o",
"dev:null", // Output is only created for file URIs.