Run "build ios-framework" processes async (#49657)

This commit is contained in:
Jenn Magder 2020-02-04 14:17:53 -08:00 committed by GitHub
parent 9b3e1639db
commit 6e605f3fdc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -312,7 +312,7 @@ end
'-output', '-output',
fatFlutterFrameworkBinary.path fatFlutterFrameworkBinary.path
]; ];
final RunResult lipoResult = processUtils.runSync( final RunResult lipoResult = await processUtils.run(
lipoCommand, lipoCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );
@ -327,7 +327,7 @@ end
status.stop(); status.stop();
} }
_produceXCFramework(mode, fatFlutterFrameworkCopy); await _produceXCFramework(mode, fatFlutterFrameworkCopy);
} }
Future<void> _produceAppFramework(BuildMode mode, Directory iPhoneBuildOutput, Directory simulatorBuildOutput, Directory modeDirectory) async { Future<void> _produceAppFramework(BuildMode mode, Directory iPhoneBuildOutput, Directory simulatorBuildOutput, Directory modeDirectory) async {
@ -365,7 +365,7 @@ end
} finally { } finally {
status.stop(); status.stop();
} }
_produceXCFramework(mode, destinationAppFrameworkDirectory); await _produceXCFramework(mode, destinationAppFrameworkDirectory);
} }
Future<void> _produceStubAppFrameworkIfNeeded(BuildMode mode, Directory iPhoneBuildOutput, Directory simulatorBuildOutput, Directory destinationAppFrameworkDirectory) async { Future<void> _produceStubAppFrameworkIfNeeded(BuildMode mode, Directory iPhoneBuildOutput, Directory simulatorBuildOutput, Directory destinationAppFrameworkDirectory) async {
@ -393,7 +393,7 @@ end
destinationAppFrameworkDirectory.childFile(binaryName).path destinationAppFrameworkDirectory.childFile(binaryName).path
]; ];
final RunResult lipoResult = processUtils.runSync( final RunResult lipoResult = await processUtils.run(
lipoCommand, lipoCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );
@ -465,7 +465,7 @@ end
'ONLY_ACTIVE_ARCH=NO' // No device targeted, so build all valid architectures. 'ONLY_ACTIVE_ARCH=NO' // No device targeted, so build all valid architectures.
]; ];
RunResult buildPluginsResult = processUtils.runSync( RunResult buildPluginsResult = await processUtils.run(
pluginsBuildCommand, pluginsBuildCommand,
workingDirectory: _project.ios.hostAppRoot.childDirectory('Pods').path, workingDirectory: _project.ios.hostAppRoot.childDirectory('Pods').path,
allowReentrantFlutter: false, allowReentrantFlutter: false,
@ -490,7 +490,7 @@ end
// No device targeted, so build all valid architectures. // No device targeted, so build all valid architectures.
]; ];
buildPluginsResult = processUtils.runSync( buildPluginsResult = await processUtils.run(
pluginsBuildCommand, pluginsBuildCommand,
workingDirectory: _project.ios.hostAppRoot workingDirectory: _project.ios.hostAppRoot
.childDirectory('Pods') .childDirectory('Pods')
@ -542,7 +542,7 @@ end
modeDirectory.childDirectory(podFrameworkName).childFile(binaryName).path modeDirectory.childDirectory(podFrameworkName).childFile(binaryName).path
]; ];
final RunResult pluginsLipoResult = processUtils.runSync( final RunResult pluginsLipoResult = await processUtils.run(
lipoCommand, lipoCommand,
workingDirectory: outputDirectory.path, workingDirectory: outputDirectory.path,
allowReentrantFlutter: false, allowReentrantFlutter: false,
@ -573,7 +573,7 @@ end
modeDirectory.childFile('$binaryName.xcframework').path modeDirectory.childFile('$binaryName.xcframework').path
]; ];
final RunResult xcframeworkResult = processUtils.runSync( final RunResult xcframeworkResult = await processUtils.run(
xcframeworkCommand, xcframeworkCommand,
workingDirectory: outputDirectory.path, workingDirectory: outputDirectory.path,
allowReentrantFlutter: false, allowReentrantFlutter: false,
@ -592,7 +592,7 @@ end
} }
} }
void _produceXCFramework(BuildMode mode, Directory fatFramework) { Future<void> _produceXCFramework(BuildMode mode, Directory fatFramework) async {
if (boolArg('xcframework')) { if (boolArg('xcframework')) {
final String frameworkBinaryName = globals.fs.path.basenameWithoutExtension( final String frameworkBinaryName = globals.fs.path.basenameWithoutExtension(
fatFramework.basename); fatFramework.basename);
@ -603,9 +603,9 @@ end
); );
try { try {
if (mode == BuildMode.debug) { if (mode == BuildMode.debug) {
_produceDebugXCFramework(fatFramework, frameworkBinaryName); await _produceDebugXCFramework(fatFramework, frameworkBinaryName);
} else { } else {
_produceNonDebugXCFramework(mode, fatFramework, frameworkBinaryName); await _produceNonDebugXCFramework(mode, fatFramework, frameworkBinaryName);
} }
} finally { } finally {
status.stop(); status.stop();
@ -617,7 +617,7 @@ end
} }
} }
void _produceDebugXCFramework(Directory fatFramework, String frameworkBinaryName) { Future<void> _produceDebugXCFramework(Directory fatFramework, String frameworkBinaryName) async {
final String frameworkFileName = fatFramework.basename; final String frameworkFileName = fatFramework.basename;
final File fatFlutterFrameworkBinary = fatFramework.childFile( final File fatFlutterFrameworkBinary = fatFramework.childFile(
frameworkBinaryName, frameworkBinaryName,
@ -650,7 +650,7 @@ end
armFlutterFrameworkBinary.path armFlutterFrameworkBinary.path
]; ];
RunResult lipoResult = processUtils.runSync( RunResult lipoResult = await processUtils.run(
lipoCommand, lipoCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );
@ -676,7 +676,7 @@ end
simulatorFlutterFrameworkBinary.path simulatorFlutterFrameworkBinary.path
]; ];
lipoResult = processUtils.runSync( lipoResult = await processUtils.run(
lipoCommand, lipoCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );
@ -698,7 +698,7 @@ end
.path .path
]; ];
final RunResult xcframeworkResult = processUtils.runSync( final RunResult xcframeworkResult = await processUtils.run(
xcframeworkCommand, xcframeworkCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );
@ -713,11 +713,11 @@ end
} }
} }
void _produceNonDebugXCFramework( Future<void> _produceNonDebugXCFramework(
BuildMode mode, BuildMode mode,
Directory fatFramework, Directory fatFramework,
String frameworkBinaryName, String frameworkBinaryName,
) { ) async {
// Simulator is only supported in Debug mode. // Simulator is only supported in Debug mode.
// "Fat" framework here must only contain arm. // "Fat" framework here must only contain arm.
final List<String> xcframeworkCommand = <String>[ final List<String> xcframeworkCommand = <String>[
@ -730,7 +730,7 @@ end
.path .path
]; ];
final RunResult xcframeworkResult = processUtils.runSync( final RunResult xcframeworkResult = await processUtils.run(
xcframeworkCommand, xcframeworkCommand,
allowReentrantFlutter: false, allowReentrantFlutter: false,
); );