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']);
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
PODFILE CHECKSUM: 638dc8f58cade4b6f922e82e3c1008f507581efd
|
||||
|
||||
COCOAPODS: 1.2.0
|
||||
@@ -161,14 +161,11 @@
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||
buildPhases = (
|
||||
AB1344B0443C71CD721E1BB7 /* [CP] Check Pods Manifest.lock */,
|
||||
9740EEB61CF901F6004384FC /* Run Script */,
|
||||
97C146EA1CF9000F007C117D /* Sources */,
|
||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||
97C146EC1CF9000F007C117D /* Resources */,
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
95BB15E9E1769C0D146AA592 /* [CP] Embed Pods Frameworks */,
|
||||
532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
);
|
||||
buildRules = (
|
||||
@@ -246,36 +243,6 @@
|
||||
shellPath = /bin/sh;
|
||||
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 */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
@@ -290,21 +257,6 @@
|
||||
shellPath = /bin/sh;
|
||||
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 */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
|
||||
Reference in New Issue
Block a user