Improve iOS unpack target's error messages (#154649)
Improves the formatting and error messages of the target that unpacks the Flutter framework in Flutter iOS builds. Follow up to: https://github.com/flutter/flutter/pull/154645 Part of https://github.com/flutter/flutter/issues/151567
This commit is contained in:
parent
9e99675dbe
commit
aea84342eb
@ -258,19 +258,20 @@ abstract class UnpackIOS extends Target {
|
||||
|
||||
@override
|
||||
List<Source> get inputs => <Source>[
|
||||
const Source.pattern(
|
||||
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart'),
|
||||
Source.artifact(
|
||||
Artifact.flutterXcframework,
|
||||
platform: TargetPlatform.ios,
|
||||
mode: buildMode,
|
||||
),
|
||||
];
|
||||
const Source.pattern(
|
||||
'{FLUTTER_ROOT}/packages/flutter_tools/lib/src/build_system/targets/ios.dart',
|
||||
),
|
||||
Source.artifact(
|
||||
Artifact.flutterXcframework,
|
||||
platform: TargetPlatform.ios,
|
||||
mode: buildMode,
|
||||
),
|
||||
];
|
||||
|
||||
@override
|
||||
List<Source> get outputs => const <Source>[
|
||||
Source.pattern('{OUTPUT_DIR}/Flutter.framework/Flutter'),
|
||||
];
|
||||
Source.pattern('{OUTPUT_DIR}/Flutter.framework/Flutter'),
|
||||
];
|
||||
|
||||
@override
|
||||
List<Target> get dependencies => <Target>[];
|
||||
@ -377,7 +378,12 @@ abstract class UnpackIOS extends Target {
|
||||
]);
|
||||
|
||||
if (verifyResult.exitCode != 0) {
|
||||
throw Exception('Binary $frameworkBinaryPath does not contain $archs. Running lipo -info:\n$lipoInfo');
|
||||
throw Exception(
|
||||
'Binary $frameworkBinaryPath does not contain architectures "$archs".\n'
|
||||
'\n'
|
||||
'lipo -info:\n'
|
||||
'$lipoInfo',
|
||||
);
|
||||
}
|
||||
|
||||
// Skip thinning for non-fat executables.
|
||||
@ -400,7 +406,14 @@ abstract class UnpackIOS extends Target {
|
||||
]);
|
||||
|
||||
if (extractResult.exitCode != 0) {
|
||||
throw Exception('Failed to extract $archs for $frameworkBinaryPath.\n${extractResult.stderr}\nRunning lipo -info:\n$lipoInfo');
|
||||
throw Exception(
|
||||
'Failed to extract architectures "$archs" for $frameworkBinaryPath.\n'
|
||||
'\n'
|
||||
'stderr:\n'
|
||||
'${extractResult.stderr}\n\n'
|
||||
'lipo -info:\n'
|
||||
'$lipoInfo',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,10 @@ import '../../../src/context.dart';
|
||||
import '../../../src/fake_process_manager.dart';
|
||||
import '../../../src/fakes.dart';
|
||||
|
||||
final Platform macPlatform = FakePlatform(operatingSystem: 'macos', environment: <String, String>{});
|
||||
final Platform macPlatform = FakePlatform(
|
||||
operatingSystem: 'macos',
|
||||
environment: <String, String>{},
|
||||
);
|
||||
|
||||
const List<String> _kSharedConfig = <String>[
|
||||
'-dynamiclib',
|
||||
@ -715,7 +718,7 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
outputDir: outputDir,
|
||||
defines: <String, String>{
|
||||
kIosArchs: 'arm64 armv7',
|
||||
kIosArchs: 'arm64 x86_64',
|
||||
kSdkRoot: 'path/to/iPhoneOS.sdk',
|
||||
},
|
||||
);
|
||||
@ -732,7 +735,7 @@ void main() {
|
||||
binary.path,
|
||||
'-verify_arch',
|
||||
'arm64',
|
||||
'armv7',
|
||||
'x86_64',
|
||||
], exitCode: 1),
|
||||
]);
|
||||
|
||||
@ -741,7 +744,10 @@ void main() {
|
||||
throwsA(isException.having(
|
||||
(Exception exception) => exception.toString(),
|
||||
'description',
|
||||
contains('does not contain arm64 armv7. Running lipo -info:\nArchitectures in the fat file:'),
|
||||
contains(
|
||||
'does not contain architectures "arm64 x86_64".\n\n'
|
||||
'lipo -info:\nArchitectures in the fat file:',
|
||||
),
|
||||
)),
|
||||
);
|
||||
});
|
||||
@ -757,7 +763,7 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
outputDir: outputDir,
|
||||
defines: <String, String>{
|
||||
kIosArchs: 'arm64 armv7',
|
||||
kIosArchs: 'arm64 x86_64',
|
||||
kSdkRoot: 'path/to/iPhoneOS.sdk',
|
||||
},
|
||||
);
|
||||
@ -774,7 +780,7 @@ void main() {
|
||||
binary.path,
|
||||
'-verify_arch',
|
||||
'arm64',
|
||||
'armv7',
|
||||
'x86_64',
|
||||
]),
|
||||
FakeCommand(command: <String>[
|
||||
'lipo',
|
||||
@ -783,7 +789,7 @@ void main() {
|
||||
'-extract',
|
||||
'arm64',
|
||||
'-extract',
|
||||
'armv7',
|
||||
'x86_64',
|
||||
binary.path,
|
||||
], exitCode: 1,
|
||||
stderr: 'lipo error'),
|
||||
@ -794,7 +800,12 @@ void main() {
|
||||
throwsA(isException.having(
|
||||
(Exception exception) => exception.toString(),
|
||||
'description',
|
||||
contains('Failed to extract arm64 armv7 for output/Flutter.framework/Flutter.\nlipo error\nRunning lipo -info:\nArchitectures in the fat file:'),
|
||||
contains(
|
||||
'Failed to extract architectures "arm64 x86_64" for output/Flutter.framework/Flutter.\n\n'
|
||||
'stderr:\n'
|
||||
'lipo error\n\n'
|
||||
'lipo -info:\nArchitectures in the fat file:',
|
||||
),
|
||||
)),
|
||||
);
|
||||
});
|
||||
@ -840,7 +851,7 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
outputDir: outputDir,
|
||||
defines: <String, String>{
|
||||
kIosArchs: 'arm64 armv7',
|
||||
kIosArchs: 'arm64 x86_64',
|
||||
kSdkRoot: 'path/to/iPhoneOS.sdk',
|
||||
},
|
||||
);
|
||||
@ -857,7 +868,7 @@ void main() {
|
||||
binary.path,
|
||||
'-verify_arch',
|
||||
'arm64',
|
||||
'armv7',
|
||||
'x86_64',
|
||||
]),
|
||||
FakeCommand(command: <String>[
|
||||
'lipo',
|
||||
@ -866,7 +877,7 @@ void main() {
|
||||
'-extract',
|
||||
'arm64',
|
||||
'-extract',
|
||||
'armv7',
|
||||
'x86_64',
|
||||
binary.path,
|
||||
]),
|
||||
xattrCommand,
|
||||
|
Loading…
x
Reference in New Issue
Block a user