Unverified Commit 023582db authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Stop trying to thin iOS App.framework (#76834)

parent d099ae60
...@@ -535,7 +535,7 @@ Future<RunResult> createStubAppFramework(File outputFile, String sdkRoot, ...@@ -535,7 +535,7 @@ Future<RunResult> createStubAppFramework(File outputFile, String sdkRoot,
} }
} }
/// Destructively thins the specified executable file to include only the specified architectures. /// Destructively thins the Flutter.framework to include only the specified architectures.
/// ///
/// This target is not fingerprinted and will always run. /// This target is not fingerprinted and will always run.
class ThinIosApplicationFrameworks extends Target { class ThinIosApplicationFrameworks extends Target {
...@@ -560,15 +560,9 @@ class ThinIosApplicationFrameworks extends Target { ...@@ -560,15 +560,9 @@ class ThinIosApplicationFrameworks extends Target {
} }
final Directory frameworkDirectory = environment.outputDir; final Directory frameworkDirectory = environment.outputDir;
final File appFramework = frameworkDirectory.childDirectory('App.framework').childFile('App');
final File flutterFramework = frameworkDirectory.childDirectory('Flutter.framework').childFile('Flutter'); final File flutterFramework = frameworkDirectory.childDirectory('Flutter.framework').childFile('Flutter');
await _thinBinary(appFramework, environment); final String binaryPath = flutterFramework.path;
await _thinBinary(flutterFramework, environment); if (!flutterFramework.existsSync()) {
}
Future<void> _thinBinary(File binary, Environment environment) async {
final String binaryPath = binary.path;
if (!binary.existsSync()) {
throw Exception('Binary $binaryPath does not exist, cannot thin'); throw Exception('Binary $binaryPath does not exist, cannot thin');
} }
final String archs = environment.defines[kIosArchs]; final String archs = environment.defines[kIosArchs];
......
...@@ -321,14 +321,14 @@ void main() { ...@@ -321,14 +321,14 @@ void main() {
throwsA(isA<Exception>().having( throwsA(isA<Exception>().having(
(Exception exception) => exception.toString(), (Exception exception) => exception.toString(),
'description', 'description',
contains('App.framework/App does not exist, cannot thin'), contains('Flutter.framework/Flutter does not exist, cannot thin'),
))); )));
}); });
testWithoutContext('fails when requested archs missing from framework', () async { testWithoutContext('fails when requested archs missing from framework', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true); final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true);
final File appBinary = outputDir.childDirectory('App.framework').childFile('App')..createSync(recursive: true); final File binary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final Environment environment = Environment.test( final Environment environment = Environment.test(
fileSystem.currentDirectory, fileSystem.currentDirectory,
...@@ -346,14 +346,14 @@ void main() { ...@@ -346,14 +346,14 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-info', '-info',
appBinary.path, binary.path,
], stdout: 'Architectures in the fat file:'), ], stdout: 'Architectures in the fat file:'),
); );
processManager.addCommand( processManager.addCommand(
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
appBinary.path, binary.path,
'-verify_arch', '-verify_arch',
'arm64', 'arm64',
'armv7', 'armv7',
...@@ -372,7 +372,7 @@ void main() { ...@@ -372,7 +372,7 @@ void main() {
testWithoutContext('fails when lipo extract fails', () async { testWithoutContext('fails when lipo extract fails', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true); final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true);
final File appBinary = outputDir.childDirectory('App.framework').childFile('App')..createSync(recursive: true); final File binary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final Environment environment = Environment.test( final Environment environment = Environment.test(
fileSystem.currentDirectory, fileSystem.currentDirectory,
...@@ -390,14 +390,14 @@ void main() { ...@@ -390,14 +390,14 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-info', '-info',
appBinary.path, binary.path,
], stdout: 'Architectures in the fat file:'), ], stdout: 'Architectures in the fat file:'),
); );
processManager.addCommand( processManager.addCommand(
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
appBinary.path, binary.path,
'-verify_arch', '-verify_arch',
'arm64', 'arm64',
'armv7', 'armv7',
...@@ -408,12 +408,12 @@ void main() { ...@@ -408,12 +408,12 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-output', '-output',
appBinary.path, binary.path,
'-extract', '-extract',
'arm64', 'arm64',
'-extract', '-extract',
'armv7', 'armv7',
appBinary.path, binary.path,
], exitCode: 1, ], exitCode: 1,
stderr: 'lipo error'), stderr: 'lipo error'),
); );
...@@ -423,15 +423,14 @@ void main() { ...@@ -423,15 +423,14 @@ void main() {
throwsA(isA<Exception>().having( throwsA(isA<Exception>().having(
(Exception exception) => exception.toString(), (Exception exception) => exception.toString(),
'description', 'description',
contains('Failed to extract arm64 armv7 for Runner.app/Frameworks/App.framework/App.\nlipo error\nRunning lipo -info:\nArchitectures in the fat file:'), contains('Failed to extract arm64 armv7 for Runner.app/Frameworks/Flutter.framework/Flutter.\nlipo error\nRunning lipo -info:\nArchitectures in the fat file:'),
))); )));
}); });
testWithoutContext('skips thin frameworks', () async { testWithoutContext('skips thin frameworks', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true); final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true);
final File appBinary = outputDir.childDirectory('App.framework').childFile('App')..createSync(recursive: true); final File binary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final File flutterBinary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final Environment environment = Environment.test( final Environment environment = Environment.test(
fileSystem.currentDirectory, fileSystem.currentDirectory,
...@@ -449,38 +448,20 @@ void main() { ...@@ -449,38 +448,20 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-info', '-info',
appBinary.path, binary.path,
], stdout: 'Non-fat file:'), ], stdout: 'Non-fat file:'),
); );
processManager.addCommand( processManager.addCommand(
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
appBinary.path, binary.path,
'-verify_arch',
'arm64',
]),
);
processManager.addCommand(
FakeCommand(command: <String>[
'lipo',
'-info',
flutterBinary.path,
], stdout: 'Non-fat file:'),
);
processManager.addCommand(
FakeCommand(command: <String>[
'lipo',
flutterBinary.path,
'-verify_arch', '-verify_arch',
'arm64', 'arm64',
]), ]),
); );
await const ThinIosApplicationFrameworks().build(environment); await const ThinIosApplicationFrameworks().build(environment);
expect(logger.traceText, contains('Skipping lipo for non-fat file Runner.app/Frameworks/App.framework/App'));
expect(logger.traceText, contains('Skipping lipo for non-fat file Runner.app/Frameworks/Flutter.framework/Flutter')); expect(logger.traceText, contains('Skipping lipo for non-fat file Runner.app/Frameworks/Flutter.framework/Flutter'));
expect(processManager.hasRemainingExpectations, isFalse); expect(processManager.hasRemainingExpectations, isFalse);
...@@ -489,8 +470,7 @@ void main() { ...@@ -489,8 +470,7 @@ void main() {
testWithoutContext('thins fat frameworks', () async { testWithoutContext('thins fat frameworks', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true); final Directory outputDir = fileSystem.directory('Runner.app').childDirectory('Frameworks')..createSync(recursive: true);
final File appBinary = outputDir.childDirectory('App.framework').childFile('App')..createSync(recursive: true); final File binary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final File flutterBinary = outputDir.childDirectory('Flutter.framework').childFile('Flutter')..createSync(recursive: true);
final Environment environment = Environment.test( final Environment environment = Environment.test(
fileSystem.currentDirectory, fileSystem.currentDirectory,
...@@ -508,45 +488,14 @@ void main() { ...@@ -508,45 +488,14 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-info', '-info',
appBinary.path, binary.path,
], stdout: 'Architectures in the fat file:'),
);
processManager.addCommand(
FakeCommand(command: <String>[
'lipo',
appBinary.path,
'-verify_arch',
'arm64',
'armv7',
]),
);
processManager.addCommand(
FakeCommand(command: <String>[
'lipo',
'-output',
appBinary.path,
'-extract',
'arm64',
'-extract',
'armv7',
appBinary.path,
]),
);
processManager.addCommand(
FakeCommand(command: <String>[
'lipo',
'-info',
flutterBinary.path,
], stdout: 'Architectures in the fat file:'), ], stdout: 'Architectures in the fat file:'),
); );
processManager.addCommand( processManager.addCommand(
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
flutterBinary.path, binary.path,
'-verify_arch', '-verify_arch',
'arm64', 'arm64',
'armv7', 'armv7',
...@@ -557,12 +506,12 @@ void main() { ...@@ -557,12 +506,12 @@ void main() {
FakeCommand(command: <String>[ FakeCommand(command: <String>[
'lipo', 'lipo',
'-output', '-output',
flutterBinary.path, binary.path,
'-extract', '-extract',
'arm64', 'arm64',
'-extract', '-extract',
'armv7', 'armv7',
flutterBinary.path, binary.path,
]), ]),
); );
......
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