Unverified Commit 9ed3e5be authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] use correct sdk path for analysis (#58871)

flutter analyze was unconditionally using the cached dart-sdk for analysis, and was not running with the built SDK during local engine. This broke when trying to update the analyzer for null safety, since it required us to wait for the dart change to roll into the framework first.
parent 5eb4917d
......@@ -75,6 +75,7 @@ Future<void> main(List<String> args) async {
processManager: globals.processManager,
logger: globals.logger,
terminal: globals.terminal,
artifacts: globals.artifacts,
),
AssembleCommand(),
AttachCommand(verboseHelp: verboseHelp),
......
......@@ -10,7 +10,6 @@ import 'base/platform.dart';
import 'base/utils.dart';
import 'build_info.dart';
import 'cache.dart';
import 'dart/sdk.dart';
import 'globals.dart' as globals;
enum Artifact {
......@@ -339,9 +338,9 @@ class CachedArtifacts extends Artifacts {
final String platformDirName = getNameForTargetPlatform(platform);
return _fileSystem.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact, platform, mode));
case Artifact.engineDartSdkPath:
return dartSdkPath;
return _dartSdkPath(_fileSystem);
case Artifact.engineDartBinary:
return _fileSystem.path.join(dartSdkPath, 'bin', _artifactToFileName(artifact, platform));
return _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', _artifactToFileName(artifact, platform));
case Artifact.platformKernelDill:
return _fileSystem.path.join(_getFlutterPatchedSdkPath(mode), _artifactToFileName(artifact));
case Artifact.platformLibrariesJson:
......@@ -355,11 +354,11 @@ class CachedArtifacts extends Artifacts {
case Artifact.webPlatformKernelDill:
return _fileSystem.path.join(_getFlutterWebSdkPath(), 'kernel', _artifactToFileName(artifact));
case Artifact.dart2jsSnapshot:
return _fileSystem.path.join(dartSdkPath, 'bin', 'snapshots', _artifactToFileName(artifact));
return _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', _artifactToFileName(artifact));
case Artifact.dartdevcSnapshot:
return _fileSystem.path.join(dartSdkPath, 'bin', 'snapshots', _artifactToFileName(artifact));
return _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', _artifactToFileName(artifact));
case Artifact.kernelWorkerSnapshot:
return _fileSystem.path.join(dartSdkPath, 'bin', 'snapshots', _artifactToFileName(artifact));
return _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', _artifactToFileName(artifact));
case Artifact.flutterMacOSFramework:
case Artifact.linuxDesktopPath:
case Artifact.windowsDesktopPath:
......@@ -528,7 +527,7 @@ class LocalEngineArtifacts extends Artifacts {
case Artifact.dart2jsSnapshot:
return _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', artifactFileName);
case Artifact.dartdevcSnapshot:
return _fileSystem.path.join(dartSdkPath, 'bin', 'snapshots', artifactFileName);
return _fileSystem.path.join(_dartSdkPath(_fileSystem), 'bin', 'snapshots', artifactFileName);
case Artifact.kernelWorkerSnapshot:
return _fileSystem.path.join(_hostEngineOutPath, 'dart-sdk', 'bin', 'snapshots', artifactFileName);
case Artifact.idevicescreenshot:
......@@ -661,3 +660,8 @@ class OverrideArtifacts implements Artifacts {
@override
bool get isLocalEngine => parent.isLocalEngine;
}
/// Locate the Dart SDK.
String _dartSdkPath(FileSystem fileSystem) {
return fileSystem.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk');
}
......@@ -19,7 +19,6 @@ import '../base/io.dart';
import '../base/logger.dart';
import '../codegen.dart';
import '../dart/pub.dart';
import '../dart/sdk.dart';
import '../globals.dart' as globals;
import '../project.dart';
......@@ -111,7 +110,14 @@ class BuildRunner extends CodeGenerator {
}
scriptIdFile.writeAsBytesSync(appliedBuilderDigest);
final ProcessResult generateResult = await globals.processManager.run(<String>[
sdkBinaryName('pub'), 'run', 'build_runner', 'generate-build-script',
globals.fs.path.join(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
'bin',
(globals.platform.isWindows) ? 'pub.bat' : 'pub'
),
'run',
'build_runner',
'generate-build-script',
], workingDirectory: syntheticPubspec.parent.path);
if (generateResult.exitCode != 0) {
throwToolExit('Error generating build_script snapshot: ${generateResult.stderr}');
......
......@@ -7,6 +7,7 @@ import 'dart:async';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
import '../artifacts.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
import '../base/platform.dart';
......@@ -21,10 +22,12 @@ class AnalyzeCommand extends FlutterCommand {
this.workingDirectory,
@required FileSystem fileSystem,
@required Platform platform,
@required AnsiTerminal terminal,
@required Terminal terminal,
@required Logger logger,
@required ProcessManager processManager,
}) : _fileSystem = fileSystem,
@required Artifacts artifacts,
}) : _artifacts = artifacts,
_fileSystem = fileSystem,
_processManager = processManager,
_logger = logger,
_terminal = terminal,
......@@ -77,9 +80,10 @@ class AnalyzeCommand extends FlutterCommand {
/// The working directory for testing analysis using dartanalyzer.
final Directory workingDirectory;
final Artifacts _artifacts;
final FileSystem _fileSystem;
final Logger _logger;
final AnsiTerminal _terminal;
final Terminal _terminal;
final ProcessManager _processManager;
final Platform _platform;
......@@ -117,6 +121,7 @@ class AnalyzeCommand extends FlutterCommand {
processManager: _processManager,
terminal: _terminal,
experiments: stringsArg('enable-experiment'),
artifacts: _artifacts,
).analyze();
} else {
await AnalyzeOnce(
......@@ -130,6 +135,7 @@ class AnalyzeCommand extends FlutterCommand {
processManager: _processManager,
terminal: _terminal,
experiments: stringsArg('enable-experiment'),
artifacts: _artifacts,
).analyze();
}
return FlutterCommandResult.success();
......
......@@ -9,6 +9,7 @@ import 'package:meta/meta.dart';
import 'package:process/process.dart';
import 'package:yaml/yaml.dart' as yaml;
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
......@@ -29,6 +30,7 @@ abstract class AnalyzeBase {
@required this.processManager,
@required this.terminal,
@required this.experiments,
@required this.artifacts,
});
/// The parsed argument results for execution.
......@@ -46,9 +48,11 @@ abstract class AnalyzeBase {
@protected
final Platform platform;
@protected
final AnsiTerminal terminal;
final Terminal terminal;
@protected
final List<String> experiments;
@protected
final Artifacts artifacts;
/// Called by [AnalyzeCommand] to start the analysis process.
Future<void> analyze();
......
......@@ -8,6 +8,7 @@ import 'package:args/args.dart';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/io.dart';
......@@ -16,17 +17,17 @@ import '../base/platform.dart';
import '../base/terminal.dart';
import '../base/utils.dart';
import '../dart/analysis.dart';
import '../dart/sdk.dart' as sdk;
import 'analyze_base.dart';
class AnalyzeContinuously extends AnalyzeBase {
AnalyzeContinuously(ArgResults argResults, List<String> repoRoots, List<Directory> repoPackages, {
@required FileSystem fileSystem,
@required Logger logger,
@required AnsiTerminal terminal,
@required Terminal terminal,
@required Platform platform,
@required ProcessManager processManager,
@required List<String> experiments,
@required Artifacts artifacts,
}) : super(
argResults,
repoPackages: repoPackages,
......@@ -37,6 +38,7 @@ class AnalyzeContinuously extends AnalyzeBase {
terminal: terminal,
processManager: processManager,
experiments: experiments,
artifacts: artifacts,
);
String analysisTarget;
......@@ -67,7 +69,8 @@ class AnalyzeContinuously extends AnalyzeBase {
analysisTarget = fileSystem.currentDirectory.path;
}
final String sdkPath = argResults['dart-sdk'] as String ?? sdk.dartSdkPath;
final String sdkPath = argResults['dart-sdk'] as String ??
artifacts.getArtifactPath(Artifact.engineDartSdkPath);
final AnalysisServer server = AnalysisServer(sdkPath, directories,
fileSystem: fileSystem,
......
......@@ -8,6 +8,7 @@ import 'package:args/args.dart';
import 'package:meta/meta.dart';
import 'package:process/process.dart';
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/logger.dart';
......@@ -15,7 +16,6 @@ import '../base/platform.dart';
import '../base/terminal.dart';
import '../base/utils.dart';
import '../dart/analysis.dart';
import '../dart/sdk.dart' as sdk;
import 'analyze.dart';
import 'analyze_base.dart';
......@@ -29,8 +29,9 @@ class AnalyzeOnce extends AnalyzeBase {
@required Logger logger,
@required Platform platform,
@required ProcessManager processManager,
@required AnsiTerminal terminal,
@required Terminal terminal,
@required List<String> experiments,
@required Artifacts artifacts,
this.workingDirectory,
}) : super(
argResults,
......@@ -42,6 +43,7 @@ class AnalyzeOnce extends AnalyzeBase {
processManager: processManager,
terminal: terminal,
experiments: experiments,
artifacts: artifacts,
);
/// The working directory for testing analysis using dartanalyzer.
......@@ -89,7 +91,8 @@ class AnalyzeOnce extends AnalyzeBase {
final Completer<void> analysisCompleter = Completer<void>();
final List<AnalysisError> errors = <AnalysisError>[];
final String sdkPath = argResults['dart-sdk'] as String ?? sdk.dartSdkPath;
final String sdkPath = argResults['dart-sdk'] as String ??
artifacts.getArtifactPath(Artifact.engineDartSdkPath);
final AnalysisServer server = AnalysisServer(
sdkPath,
......
......@@ -12,12 +12,12 @@ import 'package:webdriver/async_io.dart' as async_io;
import '../android/android_device.dart';
import '../application_package.dart';
import '../artifacts.dart';
import '../base/common.dart';
import '../base/file_system.dart';
import '../base/process.dart';
import '../build_info.dart';
import '../dart/package_map.dart';
import '../dart/sdk.dart';
import '../device.dart';
import '../globals.dart' as globals;
import '../project.dart';
......@@ -505,11 +505,9 @@ Future<void> _runTests(List<String> testArgs, Map<String, String> environment) a
globals.printTrace('Running driver tests.');
globalPackagesPath = globals.fs.path.normalize(globals.fs.path.absolute(globalPackagesPath));
final String dartVmPath = globals.fs.path.join(dartSdkPath, 'bin', 'dart');
final int result = await processUtils.stream(
<String>[
dartVmPath,
...dartVmFlags,
globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
...testArgs,
'--packages=$globalPackagesPath',
'-rexpanded',
......
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import '../cache.dart';
import '../globals.dart' as globals;
/// Locate the Dart SDK.
String get dartSdkPath {
return globals.fs.path.join(Cache.flutterRoot, 'bin', 'cache', 'dart-sdk');
}
/// The required Dart language flags
const List<String> dartVmFlags = <String>[];
/// Return the platform specific name for the given Dart SDK binary. So, `pub`
/// ==> `pub.bat`. The default SDK location can be overridden with a specified
/// [sdkLocation].
String sdkBinaryName(String name, { String sdkLocation }) {
return globals.fs.path.absolute(
globals.fs.path.join(sdkLocation ?? dartSdkPath, 'bin', globals.platform.isWindows ? '$name.bat' : name));
}
......@@ -4,15 +4,18 @@
import 'dart:async';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:mockito/mockito.dart';
import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/logger.dart';
import 'package:flutter_tools/src/base/platform.dart';
import 'package:flutter_tools/src/base/terminal.dart';
import 'package:flutter_tools/src/commands/analyze.dart';
import 'package:flutter_tools/src/dart/analysis.dart';
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/dart/sdk.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
import 'package:process/process.dart';
......@@ -76,7 +79,9 @@ void main() {
);
await pub.get(context: PubContext.flutterTests, directory: tempDir.path);
server = AnalysisServer(dartSdkPath, <String>[tempDir.path],
server = AnalysisServer(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
<String>[tempDir.path],
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
......@@ -109,14 +114,16 @@ void main() {
);
await pub.get(context: PubContext.flutterTests, directory: tempDir.path);
server = AnalysisServer(dartSdkPath, <String>[tempDir.path],
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
logger: logger,
terminal: terminal,
experiments: <String>[],
);
server = AnalysisServer(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
<String>[tempDir.path],
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
logger: logger,
terminal: terminal,
experiments: <String>[],
);
int errorCount = 0;
final Future<bool> onDone = server.onAnalyzing.where((bool analyzing) => analyzing == false).first;
......@@ -133,7 +140,9 @@ void main() {
testUsingContext('Returns no errors when source is error-free', () async {
const String contents = "StringBuffer bar = StringBuffer('baz');";
tempDir.childFile('main.dart').writeAsStringSync(contents);
server = AnalysisServer(dartSdkPath, <String>[tempDir.path],
server = AnalysisServer(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
<String>[tempDir.path],
fileSystem: fileSystem,
platform: platform,
processManager: processManager,
......@@ -187,4 +196,121 @@ void main() {
await server.start();
});
testUsingContext('Can run AnalysisService with customized cache location', () async {
final Completer<void> completer = Completer<void>();
final StreamController<List<int>> stdin = StreamController<List<int>>();
final FakeProcessManager processManager = FakeProcessManager.list(
<FakeCommand>[
FakeCommand(
command: const <String>[
'custom-dart-sdk/bin/dart',
'custom-dart-sdk/bin/snapshots/analysis_server.dart.snapshot',
'--disable-server-feature-completion',
'--disable-server-feature-search',
'--sdk',
'custom-dart-sdk',
],
completer: completer,
stdin: IOSink(stdin.sink),
),
]);
final Artifacts artifacts = MockArtifacts();
when(artifacts.getArtifactPath(Artifact.engineDartSdkPath))
.thenReturn('custom-dart-sdk');
final AnalyzeCommand command = AnalyzeCommand(
terminal: Terminal.test(),
artifacts: artifacts,
logger: BufferLogger.test(),
platform: FakePlatform(operatingSystem: 'linux'),
fileSystem: MemoryFileSystem.test(),
processManager: processManager,
);
final TestFlutterCommandRunner commandRunner = TestFlutterCommandRunner();
commandRunner.addCommand(command);
unawaited(commandRunner.run(<String>['analyze', '--watch']));
await stdin.stream.first;
expect(processManager.hasRemainingExpectations, false);
});
testUsingContext('Can run AnalysisService with customized cache location --watch', () async {
final Completer<void> completer = Completer<void>();
final StreamController<List<int>> stdin = StreamController<List<int>>();
final FakeProcessManager processManager = FakeProcessManager.list(
<FakeCommand>[
FakeCommand(
command: const <String>[
'custom-dart-sdk/bin/dart',
'custom-dart-sdk/bin/snapshots/analysis_server.dart.snapshot',
'--disable-server-feature-completion',
'--disable-server-feature-search',
'--sdk',
'custom-dart-sdk',
],
completer: completer,
stdin: IOSink(stdin.sink),
),
]);
final Artifacts artifacts = MockArtifacts();
when(artifacts.getArtifactPath(Artifact.engineDartSdkPath))
.thenReturn('custom-dart-sdk');
final AnalyzeCommand command = AnalyzeCommand(
terminal: Terminal.test(),
artifacts: artifacts,
logger: BufferLogger.test(),
platform: FakePlatform(operatingSystem: 'linux'),
fileSystem: MemoryFileSystem.test(),
processManager: processManager,
);
final TestFlutterCommandRunner commandRunner = TestFlutterCommandRunner();
commandRunner.addCommand(command);
unawaited(commandRunner.run(<String>['analyze', '--watch']));
await stdin.stream.first;
expect(processManager.hasRemainingExpectations, false);
});
testWithoutContext('Can forward null-safety experiments to the AnalysisServer', () async {
final Completer<void> completer = Completer<void>();
final StreamController<List<int>> stdin = StreamController<List<int>>();
const String fakeSdkPath = 'dart-sdk';
final FakeCommand fakeCommand = FakeCommand(
command: const <String>[
'dart-sdk/bin/dart',
'dart-sdk/bin/snapshots/analysis_server.dart.snapshot',
'--enable-experiment',
'non-nullable',
'--disable-server-feature-completion',
'--disable-server-feature-search',
'--sdk',
'dart-sdk',
],
completer: completer,
stdin: IOSink(stdin.sink),
);
server = AnalysisServer(fakeSdkPath, <String>[''],
fileSystem: MemoryFileSystem.test(),
platform: FakePlatform(),
processManager: FakeProcessManager.list(<FakeCommand>[
fakeCommand,
]),
logger: BufferLogger.test(),
terminal: Terminal.test(),
experiments: <String>[
'non-nullable'
],
);
await server.start();
});
}
class MockArtifacts extends Mock implements Artifacts {}
......@@ -4,6 +4,8 @@
import 'dart:async';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/common.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
......@@ -32,6 +34,7 @@ void main() {
Directory tempDir;
String projectPath;
File libMain;
Artifacts artifacts;
Future<void> runCommand({
FlutterCommand command,
......@@ -92,6 +95,11 @@ flutter_project:lib/
terminal: terminal,
);
analyzerSeparator = platform.isWindows ? '-' : '•';
artifacts = CachedArtifacts(
cache: globals.cache,
fileSystem: fileSystem,
platform: platform,
);
});
setUp(() {
......@@ -122,6 +130,7 @@ flutter_project:lib/
platform: platform,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>['No issues found!'],
......@@ -137,6 +146,7 @@ flutter_project:lib/
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub', libMain.path],
toolExit: true,
......@@ -175,6 +185,7 @@ flutter_project:lib/
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>[
......@@ -220,6 +231,7 @@ flutter_project:lib/
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>[
......@@ -266,6 +278,7 @@ void bar() {
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>[
......@@ -296,6 +309,7 @@ StringBuffer bar = StringBuffer('baz');
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>['No issues found!'],
......@@ -322,6 +336,7 @@ int? bar;
logger: logger,
processManager: processManager,
terminal: terminal,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub', '--enable-experiment=non-nullable'],
statusTextContains: <String>['No issues found!'],
......@@ -349,6 +364,7 @@ StringBuffer bar = StringBuffer('baz');
processManager: processManager,
logger: logger,
fileSystem: fileSystem,
artifacts: artifacts,
),
arguments: <String>['analyze', '--no-pub'],
statusTextContains: <String>['No issues found!'],
......
......@@ -7,6 +7,7 @@ import 'dart:convert';
import 'dart:typed_data';
import 'package:args/command_runner.dart';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/base/net.dart';
......@@ -15,7 +16,6 @@ import 'package:flutter_tools/src/build_info.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/commands/create.dart';
import 'package:flutter_tools/src/dart/pub.dart';
import 'package:flutter_tools/src/dart/sdk.dart';
import 'package:flutter_tools/src/features.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import 'package:flutter_tools/src/project.dart';
......@@ -830,7 +830,11 @@ void main() {
final String original = file.readAsStringSync();
final Process process = await Process.start(
sdkBinaryName('dartfmt'),
globals.fs.path.join(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
'bin',
globals.platform.isWindows ? 'dartfmt.bat' : 'dartfmt',
),
<String>[file.path],
workingDirectory: projectDir.path,
);
......@@ -928,7 +932,11 @@ void main() {
final String original = file.readAsStringSync();
final Process process = await Process.start(
sdkBinaryName('dartfmt'),
globals.fs.path.join(
globals.artifacts.getArtifactPath(Artifact.engineDartSdkPath),
'bin',
globals.platform.isWindows ? 'dartfmt.bat' : 'dartfmt',
),
<String>[file.path],
workingDirectory: projectDir.path,
);
......@@ -1532,7 +1540,6 @@ Future<void> _ensureFlutterToolsSnapshot() async {
}
final List<String> snapshotArgs = <String>[
...dartVmFlags,
'--snapshot=$flutterToolsSnapshotPath',
'--packages=$dotPackages',
flutterToolsPath,
......@@ -1576,13 +1583,12 @@ Future<void> _analyzeProject(String workingDir) async {
));
final List<String> args = <String>[
...dartVmFlags,
flutterToolsSnapshotPath,
'analyze',
];
final ProcessResult exec = await Process.run(
'$dartSdkPath/bin/dart',
globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
args,
workingDirectory: workingDir,
);
......@@ -1605,9 +1611,8 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
// While flutter test does get packages, it doesn't write version
// files anymore.
await Process.run(
'$dartSdkPath/bin/dart',
globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
<String>[
...dartVmFlags,
flutterToolsSnapshotPath,
'packages',
'get',
......@@ -1616,7 +1621,6 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
);
final List<String> args = <String>[
...dartVmFlags,
flutterToolsSnapshotPath,
'test',
'--no-color',
......@@ -1624,7 +1628,7 @@ Future<void> _runFlutterTest(Directory workingDir, { String target }) async {
];
final ProcessResult exec = await Process.run(
'$dartSdkPath/bin/dart',
globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
args,
workingDirectory: workingDir.path,
);
......
......@@ -5,10 +5,10 @@
import 'dart:async';
import 'dart:convert';
import 'package:flutter_tools/src/artifacts.dart';
import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/cache.dart';
import 'package:flutter_tools/src/dart/sdk.dart';
import 'package:flutter_tools/src/globals.dart' as globals;
import '../../src/common.dart';
......@@ -302,7 +302,6 @@ Future<ProcessResult> _runFlutterTest(
}
final List<String> args = <String>[
...dartVmFlags,
globals.fs.path.absolute(globals.fs.path.join('bin', 'flutter_tools.dart')),
'test',
'--no-color',
......@@ -319,7 +318,7 @@ Future<ProcessResult> _runFlutterTest(
_testExclusionLock = testExclusionCompleter.future;
try {
return await Process.run(
globals.fs.path.join(dartSdkPath, 'bin', 'dart'),
globals.artifacts.getArtifactPath(Artifact.engineDartBinary),
args,
workingDirectory: workingDirectory,
stdoutEncoding: utf8,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment