Commit 22ccb74e authored by Jason Simmons's avatar Jason Simmons Committed by GitHub

Check all possible output directories to find a locally built gen_snapshot (#11417)

The output location of gen_snapshot differs based on the engine's target
platform, and we don't know the target platform when building a
platform-independent FLX in JIT mode.
parent 87445e59
...@@ -192,7 +192,7 @@ class LocalEngineArtifacts extends Artifacts { ...@@ -192,7 +192,7 @@ class LocalEngineArtifacts extends Artifacts {
case Artifact.snapshotDart: case Artifact.snapshotDart:
return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact)); return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
case Artifact.genSnapshot: case Artifact.genSnapshot:
return _genSnapshotPath(platform, mode); return _genSnapshotPath();
case Artifact.flutterTester: case Artifact.flutterTester:
return _flutterTesterPath(platform); return _flutterTesterPath(platform);
case Artifact.isolateSnapshotData: case Artifact.isolateSnapshotData:
...@@ -210,14 +210,15 @@ class LocalEngineArtifacts extends Artifacts { ...@@ -210,14 +210,15 @@ class LocalEngineArtifacts extends Artifacts {
return fs.path.basename(engineOutPath); return fs.path.basename(engineOutPath);
} }
String _genSnapshotPath(TargetPlatform platform, BuildMode mode) { String _genSnapshotPath() {
String clang; const List<String> clangDirs = const <String>['clang_x86', 'clang_x64', 'clang_i386'];
if (platform == TargetPlatform.ios) { final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot);
clang = 'clang_x64'; for (String clangDir in clangDirs) {
} else { final String genSnapshotPath = fs.path.join(engineOutPath, clangDir, genSnapshotName);
clang = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86'; if (fs.file(genSnapshotPath).existsSync())
return genSnapshotPath;
} }
return fs.path.join(engineOutPath, clang, _artifactToFileName(Artifact.genSnapshot)); throw new Exception('Unable to find $genSnapshotName');
} }
String _flutterTesterPath(TargetPlatform platform) { String _flutterTesterPath(TargetPlatform platform) {
......
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