If xcode_backend.sh script fails or substitute variables are missing, fail the host Xcode build (#37449)
This commit is contained in:
@@ -276,6 +276,33 @@ Future<void> main() async {
|
||||
);
|
||||
}
|
||||
|
||||
section('Fail building existing iOS app if flutter script fails');
|
||||
int xcodebuildExitCode = 0;
|
||||
await inDirectory(hostApp, () async {
|
||||
xcodebuildExitCode = await exec(
|
||||
'xcodebuild',
|
||||
<String>[
|
||||
'-workspace',
|
||||
'Host.xcworkspace',
|
||||
'-scheme',
|
||||
'Host',
|
||||
'-configuration',
|
||||
'Debug',
|
||||
'ARCHS=i386', // i386 is not supported in Debug mode.
|
||||
'CODE_SIGNING_ALLOWED=NO',
|
||||
'CODE_SIGNING_REQUIRED=NO',
|
||||
'CODE_SIGN_IDENTITY=-',
|
||||
'EXPANDED_CODE_SIGN_IDENTITY=-',
|
||||
'CONFIGURATION_BUILD_DIR=${tempDir.path}',
|
||||
],
|
||||
canFail: true
|
||||
);
|
||||
});
|
||||
|
||||
if (xcodebuildExitCode != 65) { // 65 returned on PhaseScriptExecution failure.
|
||||
return TaskResult.failure('Host app build succeeded though flutter script failed');
|
||||
}
|
||||
|
||||
return TaskResult.success(null);
|
||||
} catch (e) {
|
||||
return TaskResult.failure(e.toString());
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objectVersion = 51;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
@@ -338,7 +338,7 @@
|
||||
name = "[CP-User] Run Flutter Build Script";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "source \"${SRCROOT}/flutterapp/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build";
|
||||
shellScript = "set -e\nset -u\nsource \"${SRCROOT}/flutterapp/.ios/Flutter/flutter_export_environment.sh\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build\n";
|
||||
};
|
||||
DE5CDCD8B3565EAB9F38F455 /* [CP] Check Pods Manifest.lock */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
|
||||
@@ -89,7 +89,7 @@ def install_flutter_application_pod(flutter_application_path)
|
||||
|
||||
flutter_export_environment_path = File.join('${SRCROOT}', relative, 'flutter_export_environment.sh');
|
||||
script_phase :name => 'Run Flutter Build Script',
|
||||
:script => "source \"#{flutter_export_environment_path}\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build",
|
||||
:script => "set -e\nset -u\nsource \"#{flutter_export_environment_path}\"\n\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/xcode_backend.sh build",
|
||||
:input_files => [
|
||||
File.join('${SRCROOT}', flutter_application_path, '.metadata'),
|
||||
File.join('${SRCROOT}', relative, 'App.framework', 'App'),
|
||||
|
||||
Reference in New Issue
Block a user