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}');
|
||||
}
|
||||
|
||||
final File resultBundleFile = tempDir.childFile(_kResultBundlePath);
|
||||
final Directory resultBundleDirectory = tempDir.childDirectory(_kResultBundlePath);
|
||||
buildCommands.addAll(<String>[
|
||||
'-resultBundlePath',
|
||||
resultBundleFile.absolute.path,
|
||||
resultBundleDirectory.absolute.path,
|
||||
'-resultBundleVersion',
|
||||
_kResultBundleVersion,
|
||||
]);
|
||||
@ -382,7 +382,7 @@ Future<XcodeBuildResult> buildXcodeProject({
|
||||
final Stopwatch sw = Stopwatch()..start();
|
||||
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.
|
||||
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 remainingTries = 8;
|
||||
|
||||
RunResult? buildResult;
|
||||
while (remainingTries > 0) {
|
||||
if (resultBundleFile.existsSync()) {
|
||||
resultBundleFile.deleteSync(recursive: true);
|
||||
if (resultBundleDirectory.existsSync()) {
|
||||
resultBundleDirectory.deleteSync(recursive: true);
|
||||
}
|
||||
remainingTries--;
|
||||
buildRetryDelaySeconds *= 2;
|
||||
|
@ -117,7 +117,7 @@ void main() {
|
||||
'xcresulttool',
|
||||
'get',
|
||||
'--path',
|
||||
_xcBundleFilePath,
|
||||
_xcBundleDirectoryPath,
|
||||
'--format',
|
||||
'json',
|
||||
],
|
||||
@ -173,7 +173,7 @@ void main() {
|
||||
'-destination',
|
||||
'generic/platform=iOS',
|
||||
],
|
||||
'-resultBundlePath', _xcBundleFilePath,
|
||||
'-resultBundlePath', _xcBundleDirectoryPath,
|
||||
'-resultBundleVersion', '3',
|
||||
'FLUTTER_SUPPRESS_ANALYTICS=true',
|
||||
'COMPILER_INDEX_STORE_ENABLE=NO',
|
||||
@ -461,7 +461,7 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(),
|
||||
setUpRsyncCommand(),
|
||||
@ -495,7 +495,7 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}, stdout: 'Lots of spew from Xcode',
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||
@ -530,7 +530,7 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssuesToBeDiscarded),
|
||||
setUpRsyncCommand(),
|
||||
@ -594,7 +594,7 @@ void main() {
|
||||
ProcessManager: () => FakeProcessManager.list(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(exitCode: 1, onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||
setUpRsyncCommand(),
|
||||
@ -628,7 +628,7 @@ void main() {
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
||||
@ -661,17 +661,17 @@ void main() {
|
||||
exitCode: 1,
|
||||
stdout: '$kConcurrentRunFailureMessage1 $kConcurrentRunFailureMessage2',
|
||||
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.
|
||||
setUpFakeXcodeBuildHandler(
|
||||
onRun: () {
|
||||
// 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);
|
||||
}
|
||||
fileSystem.systemTempDirectory.childFile(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).childFile('result.xcresult').createSync(recursive: true);
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
||||
@ -709,7 +709,7 @@ void main() {
|
||||
Runner requires a provisioning profile. Select a provisioning profile in the Signing & Capabilities editor
|
||||
''',
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
||||
@ -743,7 +743,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
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
|
||||
''',
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonNoIssues),
|
||||
@ -815,7 +815,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonInvalidIssuesMap),
|
||||
@ -850,7 +850,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithNoProvisioningProfileIssue),
|
||||
@ -885,7 +885,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
setUpFakeXcodeBuildHandler(
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
}
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithProvisionIssue),
|
||||
@ -922,7 +922,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
setUpXCResultCommand(),
|
||||
@ -958,7 +958,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
setUpXCResultCommand(stdout: kSampleResultJsonWithIssues),
|
||||
@ -996,7 +996,7 @@ Runner requires a provisioning profile. Select a provisioning profile in the Sig
|
||||
simulator: true,
|
||||
exitCode: 1,
|
||||
onRun: () {
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleFilePath).createSync();
|
||||
fileSystem.systemTempDirectory.childDirectory(_xcBundleDirectoryPath).createSync();
|
||||
},
|
||||
),
|
||||
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 {
|
||||
@override
|
||||
|
Loading…
Reference in New Issue
Block a user