Test Flutter.xcframework directory ios-arm64_armv7 or ios-arm64 (#101592)

This commit is contained in:
Jenn Magder 2022-04-08 16:12:09 -07:00 committed by GitHub
parent 135bb5d4f2
commit 71d52f27fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 10 deletions

View file

@ -111,14 +111,28 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
final String outputPath = path.join(projectDir.path, outputDirectoryName);
checkFileExists(path.join(
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
final String arm64FlutterFramework = path.join(
outputPath,
'Debug',
'Flutter.xcframework',
'ios-arm64',
'Flutter.framework',
);
final String armv7FlutterFramework = path.join(
outputPath,
'Debug',
'Flutter.xcframework',
'ios-arm64_armv7',
'Flutter.framework',
'Flutter',
));
);
final bool arm64FlutterBinaryExists = exists(File(path.join(arm64FlutterFramework, 'Flutter')));
final bool armv7FlutterBinaryExists = exists(File(path.join(armv7FlutterFramework, 'Flutter')));
if (!arm64FlutterBinaryExists && !armv7FlutterBinaryExists) {
throw TaskResult.failure('Expected debug Flutter engine artifact binary to exist');
}
final String debugAppFrameworkPath = path.join(
outputPath,
@ -226,7 +240,17 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
section("Check all modes' engine dylib");
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
final String engineFrameworkPath = path.join(
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
final String arm64EngineBinary = path.join(
outputPath,
mode,
'Flutter.xcframework',
'ios-arm64',
'Flutter.framework',
'Flutter',
);
final String arm64Armv7EngineBinary = path.join(
outputPath,
mode,
'Flutter.xcframework',
@ -235,7 +259,13 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
'Flutter',
);
await _checkBitcode(engineFrameworkPath, mode);
if (exists(File(arm64EngineBinary))) {
await _checkBitcode(arm64EngineBinary, mode);
} else if (exists(File(arm64Armv7EngineBinary))) {
await _checkBitcode(arm64Armv7EngineBinary, mode);
} else {
throw TaskResult.failure('Expected Flutter $mode engine artifact binary to exist');
}
checkFileExists(path.join(
outputPath,

View file

@ -63,7 +63,7 @@ def flutter_additional_ios_build_settings(target)
continue if xcframework_file.start_with?(".") # Hidden file, possibly on external disk.
if xcframework_file.end_with?("-simulator") # ios-arm64_x86_64-simulator
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphonesimulator*]'] = "\"#{configuration_engine_dir}/#{xcframework_file}\" $(inherited)"
elsif xcframework_file.start_with?("ios-") # ios-armv7_arm64
elsif xcframework_file.start_with?("ios-") # ios-arm64
build_configuration.build_settings['FRAMEWORK_SEARCH_PATHS[sdk=iphoneos*]'] = "\"#{configuration_engine_dir}/#{xcframework_file}\" $(inherited)"
else
# Info.plist or another platform.

View file

@ -727,7 +727,7 @@ String _getIosEngineArtifactPath(String engineDirectory,
if (!platformDirectory.basename.startsWith('ios-')) {
continue;
}
// ios-x86_64-simulator, ios-arm64_x86_64-simulator, ios-armv7_arm64 (Xcode 11), or ios-arm64_armv7 (Xcode 12).
// ios-x86_64-simulator, ios-arm64_x86_64-simulator, or ios-arm64.
final bool simulatorDirectory = platformDirectory.basename.endsWith('-simulator');
if ((environmentType == EnvironmentType.simulator && simulatorDirectory) ||
(environmentType == EnvironmentType.physical && !simulatorDirectory)) {

View file

@ -87,6 +87,13 @@ void main() {
.childDirectory('ios-arm64_x86_64-simulator')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-arm64')
.childDirectory('Flutter.framework')
.createSync(recursive: true);
// TODO(jmagman): Remove ios-arm64_armv7 checks when armv7 engine artifacts are removed.
fileSystem
.directory(xcframeworkPath)
.childDirectory('ios-arm64_armv7')
@ -100,10 +107,27 @@ void main() {
fileSystem.path
.join(xcframeworkPath, 'ios-arm64_x86_64-simulator', 'Flutter.framework'),
);
final String actualReleaseFrameworkArtifact = artifacts.getArtifactPath(
Artifact.flutterFramework,
platform: TargetPlatform.ios,
mode: BuildMode.release,
environmentType: EnvironmentType.physical,
);
final String expectedArm64ReleaseFrameworkArtifact = fileSystem.path.join(
xcframeworkPath,
'ios-arm64',
'Flutter.framework',
);
final String expectedArmv7ReleaseFrameworkArtifact = fileSystem.path.join(
xcframeworkPath,
'ios-arm64_armv7',
'Flutter.framework',
);
// TODO(jmagman): Replace with expect(actualReleaseFrameworkArtifact, expectedArm64ReleaseFrameworkArtifact) when armv7 engine artifacts are removed.
expect(
artifacts.getArtifactPath(Artifact.flutterFramework,
platform: TargetPlatform.ios, mode: BuildMode.release, environmentType: EnvironmentType.physical),
fileSystem.path.join(xcframeworkPath, 'ios-arm64_armv7', 'Flutter.framework'),
actualReleaseFrameworkArtifact,
anyOf(expectedArm64ReleaseFrameworkArtifact, expectedArmv7ReleaseFrameworkArtifact),
);
expect(
artifacts.getArtifactPath(Artifact.flutterXcframework, platform: TargetPlatform.ios, mode: BuildMode.release),