Fix flutter view project's automated tests (#9712)
Remove checked in .lock, remove checked in cocoapods scripts in xcode project, let the automated test run pod install specifically for this test
This commit is contained in:
@@ -9,6 +9,8 @@ import 'package:file/file.dart';
|
||||
import 'package:file/local.dart' as io;
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
import 'utils.dart';
|
||||
|
||||
const String _kProvisioningConfigFileEnvironmentVariable = 'FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG';
|
||||
const String _kTestXcconfigFileName = 'TestConfig.xcconfig';
|
||||
const FileSystem _fs = const io.LocalFileSystem();
|
||||
@@ -23,6 +25,11 @@ Future<Null> prepareProvisioningCertificates(String flutterProjectPath) async {
|
||||
await testXcconfig.writeAsString(certificateConfig);
|
||||
}
|
||||
|
||||
Future<Null> runPodInstallForCustomPodfile(String flutterProjectPath) async {
|
||||
final String iosPath = path.join(flutterProjectPath, 'ios');
|
||||
exec('pod', <String>['install', '--project-directory=$iosPath']);
|
||||
}
|
||||
|
||||
Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
|
||||
final List<File> xcconfigFiles = <File>[
|
||||
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')),
|
||||
|
||||
@@ -72,6 +72,9 @@ TaskFunction createFlutterViewStartupTest() {
|
||||
return new StartupTest(
|
||||
'${flutterDirectory.path}/examples/flutter_view',
|
||||
reportMetrics: false,
|
||||
// This project has a non-standard CocoaPods Podfile. Run pod install
|
||||
// before building the project.
|
||||
runPodInstall: true,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -79,10 +82,14 @@ TaskFunction createFlutterViewStartupTest() {
|
||||
class StartupTest {
|
||||
static const Duration _startupTimeout = const Duration(minutes: 5);
|
||||
|
||||
StartupTest(this.testDirectory, { this.reportMetrics: true });
|
||||
StartupTest(this.testDirectory, { this.reportMetrics: true, this.runPodInstall: false });
|
||||
|
||||
final String testDirectory;
|
||||
final bool reportMetrics;
|
||||
/// Used to trigger a `pod install` when the project has a custom Podfile and
|
||||
/// flutter build ios won't automatically run `pod install` via the managed
|
||||
/// plugin system.
|
||||
final bool runPodInstall;
|
||||
|
||||
Future<TaskResult> call() async {
|
||||
return await inDirectory(testDirectory, () async {
|
||||
@@ -90,6 +97,8 @@ class StartupTest {
|
||||
await flutter('packages', options: <String>['get']);
|
||||
|
||||
if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
|
||||
if (runPodInstall)
|
||||
await runPodInstallForCustomPodfile(testDirectory);
|
||||
await prepareProvisioningCertificates(testDirectory);
|
||||
// This causes an Xcode project to be created.
|
||||
await flutter('build', options: <String>['ios', '--profile']);
|
||||
|
||||
Reference in New Issue
Block a user