Commit 1a4bf9b6 authored by xster's avatar xster Committed by GitHub

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
parent ffa8483f
...@@ -9,6 +9,8 @@ import 'package:file/file.dart'; ...@@ -9,6 +9,8 @@ import 'package:file/file.dart';
import 'package:file/local.dart' as io; import 'package:file/local.dart' as io;
import 'package:path/path.dart' as path; import 'package:path/path.dart' as path;
import 'utils.dart';
const String _kProvisioningConfigFileEnvironmentVariable = 'FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG'; const String _kProvisioningConfigFileEnvironmentVariable = 'FLUTTER_DEVICELAB_XCODE_PROVISIONING_CONFIG';
const String _kTestXcconfigFileName = 'TestConfig.xcconfig'; const String _kTestXcconfigFileName = 'TestConfig.xcconfig';
const FileSystem _fs = const io.LocalFileSystem(); const FileSystem _fs = const io.LocalFileSystem();
...@@ -23,6 +25,11 @@ Future<Null> prepareProvisioningCertificates(String flutterProjectPath) async { ...@@ -23,6 +25,11 @@ Future<Null> prepareProvisioningCertificates(String flutterProjectPath) async {
await testXcconfig.writeAsString(certificateConfig); 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 { Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
final List<File> xcconfigFiles = <File>[ final List<File> xcconfigFiles = <File>[
_fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')), _fs.file(path.join(flutterProjectPath, 'ios/Flutter/Flutter.xcconfig')),
......
...@@ -72,6 +72,9 @@ TaskFunction createFlutterViewStartupTest() { ...@@ -72,6 +72,9 @@ TaskFunction createFlutterViewStartupTest() {
return new StartupTest( return new StartupTest(
'${flutterDirectory.path}/examples/flutter_view', '${flutterDirectory.path}/examples/flutter_view',
reportMetrics: false, 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() { ...@@ -79,10 +82,14 @@ TaskFunction createFlutterViewStartupTest() {
class StartupTest { class StartupTest {
static const Duration _startupTimeout = const Duration(minutes: 5); 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 String testDirectory;
final bool reportMetrics; 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 { Future<TaskResult> call() async {
return await inDirectory(testDirectory, () async { return await inDirectory(testDirectory, () async {
...@@ -90,6 +97,8 @@ class StartupTest { ...@@ -90,6 +97,8 @@ class StartupTest {
await flutter('packages', options: <String>['get']); await flutter('packages', options: <String>['get']);
if (deviceOperatingSystem == DeviceOperatingSystem.ios) { if (deviceOperatingSystem == DeviceOperatingSystem.ios) {
if (runPodInstall)
await runPodInstallForCustomPodfile(testDirectory);
await prepareProvisioningCertificates(testDirectory); await prepareProvisioningCertificates(testDirectory);
// This causes an Xcode project to be created. // This causes an Xcode project to be created.
await flutter('build', options: <String>['ios', '--profile']); await flutter('build', options: <String>['ios', '--profile']);
......
PODFILE CHECKSUM: 638dc8f58cade4b6f922e82e3c1008f507581efd
COCOAPODS: 1.2.0
...@@ -161,14 +161,11 @@ ...@@ -161,14 +161,11 @@
isa = PBXNativeTarget; isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = ( buildPhases = (
AB1344B0443C71CD721E1BB7 /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */, 9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */, 97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */, 97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */, 97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
95BB15E9E1769C0D146AA592 /* [CP] Embed Pods Frameworks */,
532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
); );
buildRules = ( buildRules = (
...@@ -246,36 +243,6 @@ ...@@ -246,36 +243,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
}; };
532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
95BB15E9E1769C0D146AA592 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = { 9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
...@@ -290,21 +257,6 @@ ...@@ -290,21 +257,6 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
AB1344B0443C71CD721E1BB7 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */ /* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment