Set ARCHS to single-arch for local engine macOS builds (#100917)
This commit is contained in:
parent
912873baa7
commit
a452c92d5d
@ -184,10 +184,15 @@ Future<List<String>> _xcodeBuildSettingsLines({
|
|||||||
// NOTE: this assumes that local engine binary paths are consistent with
|
// NOTE: this assumes that local engine binary paths are consistent with
|
||||||
// the conventions uses in the engine: 32-bit iOS engines are built to
|
// the conventions uses in the engine: 32-bit iOS engines are built to
|
||||||
// paths ending in _arm, 64-bit builds are not.
|
// paths ending in _arm, 64-bit builds are not.
|
||||||
//
|
|
||||||
// Skip this step for macOS builds.
|
|
||||||
if (!useMacOSConfig) {
|
|
||||||
String arch;
|
String arch;
|
||||||
|
if (useMacOSConfig) {
|
||||||
|
if (localEngineName.contains('_arm64')) {
|
||||||
|
arch = 'arm64';
|
||||||
|
} else {
|
||||||
|
arch = 'x86_64';
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if (localEngineName.endsWith('_arm')) {
|
if (localEngineName.endsWith('_arm')) {
|
||||||
arch = 'armv7';
|
arch = 'armv7';
|
||||||
} else if (localEngineName.contains('_arm64')) {
|
} else if (localEngineName.contains('_arm64')) {
|
||||||
@ -197,8 +202,8 @@ Future<List<String>> _xcodeBuildSettingsLines({
|
|||||||
} else {
|
} else {
|
||||||
arch = 'arm64';
|
arch = 'arm64';
|
||||||
}
|
}
|
||||||
xcodeBuildSettings.add('ARCHS=$arch');
|
|
||||||
}
|
}
|
||||||
|
xcodeBuildSettings.add('ARCHS=$arch');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useMacOSConfig) {
|
if (!useMacOSConfig) {
|
||||||
|
@ -677,13 +677,13 @@ Information about project "Runner":
|
|||||||
});
|
});
|
||||||
|
|
||||||
group('updateGeneratedXcodeProperties', () {
|
group('updateGeneratedXcodeProperties', () {
|
||||||
Artifacts localArtifacts;
|
Artifacts localIosArtifacts;
|
||||||
FakePlatform macOS;
|
FakePlatform macOS;
|
||||||
FileSystem fs;
|
FileSystem fs;
|
||||||
|
|
||||||
setUp(() {
|
setUp(() {
|
||||||
fs = MemoryFileSystem.test();
|
fs = MemoryFileSystem.test();
|
||||||
localArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm');
|
localIosArtifacts = Artifacts.test(localEngine: 'out/ios_profile_arm');
|
||||||
macOS = FakePlatform(operatingSystem: 'macos');
|
macOS = FakePlatform(operatingSystem: 'macos');
|
||||||
fs.file(xcodebuild).createSync(recursive: true);
|
fs.file(xcodebuild).createSync(recursive: true);
|
||||||
});
|
});
|
||||||
@ -746,7 +746,7 @@ Build settings for action build and target plugin2:
|
|||||||
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n'));
|
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386\n'));
|
||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => localArtifacts,
|
Artifacts: () => localIosArtifacts,
|
||||||
Platform: () => macOS,
|
Platform: () => macOS,
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => fakeProcessManager,
|
ProcessManager: () => fakeProcessManager,
|
||||||
@ -790,7 +790,7 @@ Build settings for action build and target plugin2:
|
|||||||
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
|
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
|
||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => localArtifacts,
|
Artifacts: () => localIosArtifacts,
|
||||||
Platform: () => macOS,
|
Platform: () => macOS,
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => fakeProcessManager,
|
ProcessManager: () => fakeProcessManager,
|
||||||
@ -846,7 +846,7 @@ Build settings for action build and target plugin2:
|
|||||||
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
|
expect(config.readAsStringSync(), contains('EXCLUDED_ARCHS[sdk=iphonesimulator*]=i386 arm64\n'));
|
||||||
expect(fakeProcessManager, hasNoRemainingExpectations);
|
expect(fakeProcessManager, hasNoRemainingExpectations);
|
||||||
}, overrides: <Type, Generator>{
|
}, overrides: <Type, Generator>{
|
||||||
Artifacts: () => localArtifacts,
|
Artifacts: () => localIosArtifacts,
|
||||||
Platform: () => macOS,
|
Platform: () => macOS,
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => fakeProcessManager,
|
ProcessManager: () => fakeProcessManager,
|
||||||
@ -856,14 +856,14 @@ Build settings for action build and target plugin2:
|
|||||||
|
|
||||||
void testUsingOsxContext(String description, dynamic Function() testMethod) {
|
void testUsingOsxContext(String description, dynamic Function() testMethod) {
|
||||||
testUsingContext(description, testMethod, overrides: <Type, Generator>{
|
testUsingContext(description, testMethod, overrides: <Type, Generator>{
|
||||||
Artifacts: () => localArtifacts,
|
Artifacts: () => localIosArtifacts,
|
||||||
Platform: () => macOS,
|
Platform: () => macOS,
|
||||||
FileSystem: () => fs,
|
FileSystem: () => fs,
|
||||||
ProcessManager: () => FakeProcessManager.any(),
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
|
testUsingOsxContext('sets ARCHS=armv7 when armv7 local iOS engine is set', () async {
|
||||||
const BuildInfo buildInfo = BuildInfo.debug;
|
const BuildInfo buildInfo = BuildInfo.debug;
|
||||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
||||||
await updateGeneratedXcodeProperties(
|
await updateGeneratedXcodeProperties(
|
||||||
@ -886,6 +886,60 @@ Build settings for action build and target plugin2:
|
|||||||
expect(buildPhaseScriptContents.contains('EXCLUDED_ARCHS'), isFalse);
|
expect(buildPhaseScriptContents.contains('EXCLUDED_ARCHS'), isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('sets ARCHS=arm64 when arm64 local host engine is set', () async {
|
||||||
|
const BuildInfo buildInfo = BuildInfo.debug;
|
||||||
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
||||||
|
await updateGeneratedXcodeProperties(
|
||||||
|
project: project,
|
||||||
|
buildInfo: buildInfo,
|
||||||
|
useMacOSConfig: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
final File config = fs.file('path/to/project/macos/Flutter/ephemeral/Flutter-Generated.xcconfig');
|
||||||
|
expect(config.existsSync(), isTrue);
|
||||||
|
|
||||||
|
final String contents = config.readAsStringSync();
|
||||||
|
expect(contents.contains('ARCHS=arm64\n'), isTrue);
|
||||||
|
|
||||||
|
final File buildPhaseScript = fs.file('path/to/project/macos/Flutter/ephemeral/flutter_export_environment.sh');
|
||||||
|
expect(buildPhaseScript.existsSync(), isTrue);
|
||||||
|
|
||||||
|
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
|
||||||
|
expect(buildPhaseScriptContents.contains('export "ARCHS=arm64"'), isTrue);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => Artifacts.test(localEngine: 'out/host_profile_arm64'),
|
||||||
|
Platform: () => macOS,
|
||||||
|
FileSystem: () => fs,
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
});
|
||||||
|
|
||||||
|
testUsingContext('sets ARCHS=x86_64 when x64 local host engine is set', () async {
|
||||||
|
const BuildInfo buildInfo = BuildInfo.debug;
|
||||||
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
||||||
|
await updateGeneratedXcodeProperties(
|
||||||
|
project: project,
|
||||||
|
buildInfo: buildInfo,
|
||||||
|
useMacOSConfig: true,
|
||||||
|
);
|
||||||
|
|
||||||
|
final File config = fs.file('path/to/project/macos/Flutter/ephemeral/Flutter-Generated.xcconfig');
|
||||||
|
expect(config.existsSync(), isTrue);
|
||||||
|
|
||||||
|
final String contents = config.readAsStringSync();
|
||||||
|
expect(contents.contains('ARCHS=x86_64\n'), isTrue);
|
||||||
|
|
||||||
|
final File buildPhaseScript = fs.file('path/to/project/macos/Flutter/ephemeral/flutter_export_environment.sh');
|
||||||
|
expect(buildPhaseScript.existsSync(), isTrue);
|
||||||
|
|
||||||
|
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
|
||||||
|
expect(buildPhaseScriptContents.contains('export "ARCHS=x86_64"'), isTrue);
|
||||||
|
}, overrides: <Type, Generator>{
|
||||||
|
Artifacts: () => Artifacts.test(localEngine: 'out/host_profile'),
|
||||||
|
Platform: () => macOS,
|
||||||
|
FileSystem: () => fs,
|
||||||
|
ProcessManager: () => FakeProcessManager.any(),
|
||||||
|
});
|
||||||
|
|
||||||
testUsingOsxContext('does not exclude arm64 simulator when there are no plugins', () async {
|
testUsingOsxContext('does not exclude arm64 simulator when there are no plugins', () async {
|
||||||
const BuildInfo buildInfo = BuildInfo.debug;
|
const BuildInfo buildInfo = BuildInfo.debug;
|
||||||
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
final FlutterProject project = FlutterProject.fromDirectoryTest(fs.directory('path/to/project'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user