Write macOS universal gen_snapshot binaries to a separate output directory (#164667)

Also use the name "gen_snapshot" when building for Android targets
instead of appending a target architecture to the filename.

This allows flutter_tools to find the universal gen_snapshot binary when
using a locally built engine. Previously the tools would search
directories like "clang_x64" and find build outputs that may not match
the host architecture.

Moving the universal gen_snapshot binary to a separate directory avoids
conflicts with Dart's gen_snapshot binary, which is placed at the root
of the target output directory.
This commit is contained in:
Jason Simmons
2025-03-12 19:02:55 +00:00
committed by GitHub
parent f0992e0965
commit a7a4d0bd2b
6 changed files with 30 additions and 13 deletions

View File

@@ -1366,6 +1366,7 @@ class CachedLocalEngineArtifacts implements Artifacts {
String _genSnapshotPath(Artifact artifact) {
const List<String> clangDirs = <String>[
'.',
'universal',
'clang_x64',
'clang_x86',
'clang_i386',

View File

@@ -288,6 +288,7 @@ void main() {
late Cache cache;
late FileSystem fileSystem;
late Platform platform;
late FakeProcessManager processManager;
setUp(() {
fileSystem = MemoryFileSystem.test();
@@ -301,6 +302,7 @@ void main() {
osUtils: FakeOperatingSystemUtils(),
artifacts: <ArtifactSet>[],
);
processManager = FakeProcessManager.any();
artifacts = CachedLocalWebSdkArtifacts(
parent: CachedLocalEngineArtifacts(
fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'host_debug_unopt'),
@@ -312,7 +314,7 @@ void main() {
cache: cache,
fileSystem: fileSystem,
platform: platform,
processManager: FakeProcessManager.any(),
processManager: processManager,
operatingSystemUtils: FakeOperatingSystemUtils(),
),
webSdkPath: fileSystem.path.join(fileSystem.currentDirectory.path, 'out', 'wasm_release'),
@@ -511,6 +513,12 @@ void main() {
artifacts.getHostArtifact(HostArtifact.libtessellator).path,
fileSystem.path.join('/out', 'host_debug_unopt', 'libtessellator.so'),
);
processManager.excludedExecutables.add('/out/android_debug_unopt/./gen_snapshot');
expect(
artifacts.getArtifactPath(Artifact.genSnapshot),
fileSystem.path.join('/out', 'android_debug_unopt', 'universal', 'gen_snapshot'),
);
});
testWithoutContext(