Fall back to global cache and platform if null when injected into constructor (#50370)

This commit is contained in:
Jenn Magder
2020-02-07 15:28:45 -08:00
committed by GitHub
parent ef74572e76
commit 082ae838bd
5 changed files with 168 additions and 77 deletions

View File

@@ -298,6 +298,56 @@ Future<void> main() async {
}
}
// This builds all build modes' frameworks by default
section('Build podspec');
const String cocoapodsOutputDirectoryName = 'flutter-frameworks-cocoapods';
await inDirectory(projectDir, () async {
await flutter(
'build',
options: <String>[
'ios-framework',
'--cocoapods',
'--force', // Allow podspec creation on master.
'--output=$cocoapodsOutputDirectoryName'
],
);
});
final String cocoapodsOutputPath = path.join(projectDir.path, cocoapodsOutputDirectoryName);
for (final String mode in <String>['Debug', 'Profile', 'Release']) {
checkFileExists(path.join(
cocoapodsOutputPath,
mode,
'Flutter.podspec',
));
checkDirectoryExists(path.join(
cocoapodsOutputPath,
mode,
'App.framework',
));
checkDirectoryExists(path.join(
cocoapodsOutputPath,
mode,
'FlutterPluginRegistrant.framework',
));
checkDirectoryExists(path.join(
cocoapodsOutputPath,
mode,
'device_info.framework',
));
checkDirectoryExists(path.join(
cocoapodsOutputPath,
mode,
'package_info.framework',
));
}
return TaskResult.success(null);
} on TaskResult catch (taskResult) {
return taskResult;

View File

@@ -641,6 +641,13 @@ void checkFileNotExists(String file) {
}
}
/// Checks that the directory exists, otherwise throws a [FileSystemException].
void checkDirectoryExists(String directory) {
if (!exists(Directory(directory))) {
throw FileSystemException('Expected directory to exist.', directory);
}
}
/// Check that `collection` contains all entries in `values`.
void checkCollectionContains<T>(Iterable<T> values, Iterable<T> collection) {
for (final T value in values) {