mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Change resultBundlePath representation from File to Directory (#130156)
`resultBundlePath` is meant to be a directory. In the `xcodebuild --help`, it describes it as a directory: ``` -resultBundlePath PATH specifies the directory where a result bundle describing what occurred will be placed ``` This PR changes our usage of it from a file to a directory so that it gets deleted correctly between reruns. Fixes https://github.com/flutter/flutter/issues/129954.
This commit is contained in:
parent
99a47c8460
commit
6c2023162f
@ -357,10 +357,10 @@ Future<XcodeBuildResult> buildXcodeProject({
|
|||||||
buildCommands.add('SCRIPT_OUTPUT_STREAM_FILE=${scriptOutputPipeFile.absolute.path}');
|
buildCommands.add('SCRIPT_OUTPUT_STREAM_FILE=${scriptOutputPipeFile.absolute.path}');
|
||||||
}
|
}
|
||||||
|
|
||||||
final File resultBundleFile = tempDir.childFile(_kResultBundlePath);
|
final Directory resultBundleDirectory = tempDir.childDirectory(_kResultBundlePath);
|
||||||
buildCommands.addAll(<String>[
|
buildCommands.addAll(<String>[
|
||||||
'-resultBundlePath',
|
'-resultBundlePath',
|
||||||
resultBundleFile.absolute.path,
|
resultBundleDirectory.absolute.path,
|
||||||
'-resultBundleVersion',
|
'-resultBundleVersion',
|
||||||
_kResultBundleVersion,
|
_kResultBundleVersion,
|
||||||
]);
|
]);
|
||||||
@ -382,7 +382,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
|||||||
final Stopwatch sw = Stopwatch()..start();
|
final Stopwatch sw = Stopwatch()..start();
|
||||||
initialBuildStatus = globals.logger.startProgress('Running Xcode build...');
|
initialBuildStatus = globals.logger.startProgress('Running Xcode build...');
|
||||||
|
|
||||||
buildResult = await _runBuildWithRetries(buildCommands, app, resultBundleFile);
|
buildResult = await _runBuildWithRetries(buildCommands, app, resultBundleDirectory);
|
||||||
|
|
||||||
// Notifies listener that no more output is coming.
|
// Notifies listener that no more output is coming.
|
||||||
scriptOutputPipeFile?.writeAsStringSync('all done');
|
scriptOutputPipeFile?.writeAsStringSync('all done');
|
||||||
@ -512,14 +512,14 @@ Future<void> removeFinderExtendedAttributes(FileSystemEntity projectDirectory, P
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<RunResult?> _runBuildWithRetries(List<String> buildCommands, BuildableIOSApp app, File resultBundleFile) async {
|
Future<RunResult?> _runBuildWithRetries(List<String> buildCommands, BuildableIOSApp app, Directory resultBundleDirectory) async {
|
||||||
int buildRetryDelaySeconds = 1;
|
int buildRetryDelaySeconds = 1;
|
||||||
int remainingTries = 8;
|
int remainingTries = 8;
|
||||||
|
|
||||||
RunResult? buildResult;
|
RunResult? buildResult;
|
||||||
while (remainingTries > 0) {
|
while (remainingTries > 0) {
|
||||||
if (resultBundleFile.existsSync()) {
|
if (resultBundleDirectory.existsSync()) {
|
||||||
resultBundleFile.deleteSync(recursive: true);
|
resultBundleDirectory.deleteSync(recursive: true);
|
||||||
}
|
}
|
||||||
remainingTries--;
|
remainingTries--;
|
||||||
buildRetryDelaySeconds *= 2;
|
buildRetryDelaySeconds *= 2;
|
||||||
|
@ -117,7 +117,7 @@ void main() {
|
|||||||
'xcresulttool',
|
'xcresulttool',
|
||||||
'get',
|
'get',
|
||||||
'--path',
|
'--path',
|
||||||
_xcBundleFilePath,
|
_xcBundleDirectoryPath,
|
||||||
'--format',
|
'--format',
|
||||||
'json',
|
'json',
|
||||||
],
|
],
|
||||||
@ -173,7 +173,7 @@ void main() {
|
|||||||
'-destination',
|
'-destination',
|
||||||
'generic/platform=iOS',
|
'generic/platform=iOS',
|
||||||
],
|
],
|
||||||
'-resultBundlePath', _xcBundleFilePath,
|
'-resultBundlePath', _xcBundleDirectoryPath,
|
||||||
'-resultBundleVersion', '3',
|
'-resultBundleVersion', '3',
|
||||||
'FLUTTER_SUPPRESS_ANALYTICS=true',
|
'FLUTTER_SUPPRESS_ANALYTICS=true',
|
||||||
'COMPILER_INDEX_STORE_ENABLE=NO',
|
'COMPILER_INDEX_STORE_ENABLE=NO',
|
||||||
@ -461,7 +461,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
xattrCommand,
|
xattrCommand,
|
||||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}),
|
}),
|
||||||
setUpXCResultCommand(),
|
setUpXCResultCommand(),
|
||||||
setUpRsyncCommand(),
|
setUpRsyncCommand(),
|
||||||
@ -495,7 +495,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
xattrCommand,
|
xattrCommand,
|
||||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}, stdout: 'Lots of spew from Xcode',
|
}, stdout: 'Lots of spew from Xcode',
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||||
@ -530,7 +530,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
xattrCommand,
|
xattrCommand,
|
||||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}),
|
}),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
||||||
setUpRsyncCommand(),
|
setUpRsyncCommand(),
|
||||||
@ -594,7 +594,7 @@ void main() {
|
|||||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||||
xattrCommand,
|
xattrCommand,
|
||||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}),
|
}),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||||
setUpRsyncCommand(),
|
setUpRsyncCommand(),
|
||||||
@ -628,7 +628,7 @@ void main() {
|
|||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
||||||
@ -661,17 +661,17 @@ void main() {
|
|||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
stdout: '$kConcurrentRunFailureMessage1 $kConcurrentRunFailureMessage2',
|
stdout: '$kConcurrentRunFailureMessage1 $kConcurrentRunFailureMessage2',
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childFile(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).childFile('result.xcresult').createSync(recursive: true);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
// The second xcodebuild is triggered due to above concurrent run failure message.
|
// The second xcodebuild is triggered due to above concurrent run failure message.
|
||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
onRun: () {
|
onRun: () {
|
||||||
// If the file is not cleaned, throw an error, test failure.
|
// If the file is not cleaned, throw an error, test failure.
|
||||||
if (fileSystem.systemTempDirectory.childFile(_xcBundleFilePath).existsSync()) {
|
if (fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).existsSync()) {
|
||||||
throwToolExit('xcresult bundle file existed.', exitCode: 2);
|
throwToolExit('xcresult bundle file existed.', exitCode: 2);
|
||||||
}
|
}
|
||||||
fileSystem.systemTempDirectory.childFile(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).childFile('result.xcresult').createSync(recursive: true);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
||||||
@ -709,7 +709,7 @@ void main() {
|
|||||||
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
||||||
''',
|
''',
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
||||||
@ -743,7 +743,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
||||||
@ -780,7 +780,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
||||||
''',
|
''',
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
||||||
@ -815,7 +815,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
||||||
@ -850,7 +850,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
||||||
@ -885,7 +885,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
setUpFakeXcodeBuildHandler(
|
setUpFakeXcodeBuildHandler(
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||||
@ -922,7 +922,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
simulator: true,
|
simulator: true,
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(),
|
setUpXCResultCommand(),
|
||||||
@ -958,7 +958,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
simulator: true,
|
simulator: true,
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||||
@ -996,7 +996,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
simulator: true,
|
simulator: true,
|
||||||
exitCode: 1,
|
exitCode: 1,
|
||||||
onRun: () {
|
onRun: () {
|
||||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
||||||
@ -1040,7 +1040,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const String _xcBundleFilePath = '/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle';
|
const String _xcBundleDirectoryPath = '/.tmp_rand0/flutter_ios_build_temp_dirrand0/temporary_xcresult_bundle';
|
||||||
|
|
||||||
class FakeAndroidSdk extends Fake implements AndroidSdk {
|
class FakeAndroidSdk extends Fake implements AndroidSdk {
|
||||||
@override
|
@override
|
||||||
|
Loading…
Reference in New Issue
Block a user