Skip to content

Commit 22ccb74

Browse files
Check all possible output directories to find a locally built gen_snapshot (flutter#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.
1 parent 87445e5 commit 22ccb74

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

packages/flutter_tools/lib/src/artifacts.dart

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class LocalEngineArtifacts extends Artifacts {
192192
case Artifact.snapshotDart:
193193
return fs.path.join(_engineSrcPath, 'flutter', 'lib', 'snapshot', _artifactToFileName(artifact));
194194
case Artifact.genSnapshot:
195-
return _genSnapshotPath(platform, mode);
195+
return _genSnapshotPath();
196196
case Artifact.flutterTester:
197197
return _flutterTesterPath(platform);
198198
case Artifact.isolateSnapshotData:
@@ -210,14 +210,15 @@ class LocalEngineArtifacts extends Artifacts {
210210
return fs.path.basename(engineOutPath);
211211
}
212212

213-
String _genSnapshotPath(TargetPlatform platform, BuildMode mode) {
214-
String clang;
215-
if (platform == TargetPlatform.ios) {
216-
clang = 'clang_x64';
217-
} else {
218-
clang = getCurrentHostPlatform() == HostPlatform.darwin_x64 ? 'clang_i386' : 'clang_x86';
213+
String _genSnapshotPath() {
214+
const List<String> clangDirs = const <String>['clang_x86', 'clang_x64', 'clang_i386'];
215+
final String genSnapshotName = _artifactToFileName(Artifact.genSnapshot);
216+
for (String clangDir in clangDirs) {
217+
final String genSnapshotPath = fs.path.join(engineOutPath, clangDir, genSnapshotName);
218+
if (fs.file(genSnapshotPath).existsSync())
219+
return genSnapshotPath;
219220
}
220-
return fs.path.join(engineOutPath, clang, _artifactToFileName(Artifact.genSnapshot));
221+
throw new Exception('Unable to find $genSnapshotName');
221222
}
222223

223224
String _flutterTesterPath(TargetPlatform platform) {

0 commit comments

Comments
 (0)