Unverified Commit fe00598a authored by Alexander Aprelev's avatar Alexander Aprelev Committed by GitHub

Reintroduce engineDartSdkPath artifact. (#14742)

This is needed to support running with local engine's dart sdk.

This is follow-up to https://github.com/flutter/flutter/pull/14702.
parent aa7e9637
...@@ -9,6 +9,7 @@ import 'base/file_system.dart'; ...@@ -9,6 +9,7 @@ import 'base/file_system.dart';
import 'base/platform.dart'; import 'base/platform.dart';
import 'base/process_manager.dart'; import 'base/process_manager.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'dart/sdk.dart';
import 'globals.dart'; import 'globals.dart';
enum Artifact { enum Artifact {
...@@ -24,6 +25,7 @@ enum Artifact { ...@@ -24,6 +25,7 @@ enum Artifact {
platformLibrariesJson, platformLibrariesJson,
flutterPatchedSdkPath, flutterPatchedSdkPath,
frontendServerSnapshotForEngineDartSdk, frontendServerSnapshotForEngineDartSdk,
engineDartSdkPath,
} }
String _artifactToFileName(Artifact artifact) { String _artifactToFileName(Artifact artifact) {
...@@ -51,6 +53,8 @@ String _artifactToFileName(Artifact artifact) { ...@@ -51,6 +53,8 @@ String _artifactToFileName(Artifact artifact) {
case Artifact.flutterPatchedSdkPath: case Artifact.flutterPatchedSdkPath:
assert(false, 'No filename for sdk path, should not be invoked'); assert(false, 'No filename for sdk path, should not be invoked');
return null; return null;
case Artifact.engineDartSdkPath:
return 'dart-sdk';
case Artifact.frontendServerSnapshotForEngineDartSdk: case Artifact.frontendServerSnapshotForEngineDartSdk:
return 'frontend_server.dart.snapshot'; return 'frontend_server.dart.snapshot';
} }
...@@ -164,6 +168,8 @@ class CachedArtifacts extends Artifacts { ...@@ -164,6 +168,8 @@ class CachedArtifacts extends Artifacts {
final String engineArtifactsPath = cache.getArtifactDirectory('engine').path; final String engineArtifactsPath = cache.getArtifactDirectory('engine').path;
final String platformDirName = getNameForTargetPlatform(platform); final String platformDirName = getNameForTargetPlatform(platform);
return fs.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact)); return fs.path.join(engineArtifactsPath, platformDirName, _artifactToFileName(artifact));
case Artifact.engineDartSdkPath:
return dartSdkPath;
case Artifact.platformKernelDill: case Artifact.platformKernelDill:
return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact)); return fs.path.join(_getFlutterPatchedSdkPath(), _artifactToFileName(artifact));
case Artifact.platformLibrariesJson: case Artifact.platformLibrariesJson:
...@@ -244,6 +250,8 @@ class LocalEngineArtifacts extends Artifacts { ...@@ -244,6 +250,8 @@ class LocalEngineArtifacts extends Artifacts {
return _getFlutterPatchedSdkPath(); return _getFlutterPatchedSdkPath();
case Artifact.frontendServerSnapshotForEngineDartSdk: case Artifact.frontendServerSnapshotForEngineDartSdk:
return fs.path.join(_hostEngineOutPath, 'gen', _artifactToFileName(artifact)); return fs.path.join(_hostEngineOutPath, 'gen', _artifactToFileName(artifact));
case Artifact.engineDartSdkPath:
return fs.path.join(_hostEngineOutPath, 'dart-sdk');
} }
assert(false, 'Invalid artifact $artifact.'); assert(false, 'Invalid artifact $artifact.');
return null; return null;
......
...@@ -8,14 +8,22 @@ import 'dart:convert'; ...@@ -8,14 +8,22 @@ import 'dart:convert';
import 'package:usage/uuid/uuid.dart'; import 'package:usage/uuid/uuid.dart';
import 'artifacts.dart'; import 'artifacts.dart';
import 'base/common.dart';
import 'base/file_system.dart'; import 'base/file_system.dart';
import 'base/io.dart'; import 'base/io.dart';
import 'base/process_manager.dart'; import 'base/process_manager.dart';
import 'dart/sdk.dart';
import 'globals.dart'; import 'globals.dart';
String _dartExecutable() { String _dartExecutable() {
return fs.path.join(dartSdkPath, 'bin', 'dart'); final String engineDartSdkPath = artifacts.getArtifactPath(
Artifact.engineDartSdkPath
);
if (!fs.isDirectorySync(engineDartSdkPath)) {
throwToolExit('No dart sdk Flutter host engine build found at $engineDartSdkPath.\n'
'Note that corresponding host engine build is required even when targeting particular device platforms.',
exitCode: 2);
}
return fs.path.join(engineDartSdkPath, 'bin', 'dart');
} }
class _StdoutHandler { class _StdoutHandler {
......
...@@ -89,6 +89,10 @@ void main() { ...@@ -89,6 +89,10 @@ void main() {
artifacts.getArtifactPath(Artifact.flutterTester), artifacts.getArtifactPath(Artifact.flutterTester),
fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'flutter_tester') fs.path.join(tempDir.path, 'out', 'android_debug_unopt', 'flutter_tester')
); );
expect(
artifacts.getArtifactPath(Artifact.engineDartSdkPath),
fs.path.join(tempDir.path, 'out', 'host_debug_unopt', 'dart-sdk')
);
}, overrides: <Type, Generator> { }, overrides: <Type, Generator> {
Platform: () => new FakePlatform(operatingSystem: 'linux') Platform: () => new FakePlatform(operatingSystem: 'linux')
}); });
......
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