Commit 36a7c657 authored by Chinmay Garde's avatar Chinmay Garde

Perform an engine version check on start and update the Xcode project if necessary

parent 77103c01
......@@ -560,8 +560,8 @@ String _getIOSEngineRevision(ApplicationPackage app) {
}
Future<bool> _buildIOSXcodeProject(ApplicationPackage app, { bool buildForDevice }) async {
if (!FileSystemEntity.isDirectorySync(app.localPath)) {
printTrace('Path "${path.absolute(app.localPath)}" does not exist. Initializing the Xcode project.');
if (xcodeProjectRequiresUpdate()) {
printTrace('Initializing the Xcode project.');
if ((await setupXcodeProjectHarness()) != 0) {
printError('Could not initialize the Xcode project.');
return false;
......
......@@ -111,6 +111,25 @@ void _setupXcodeProjXcconfig(String filePath) {
localsFile.writeAsStringSync(localsBuffer.toString());
}
bool xcodeProjectRequiresUpdate() {
File revisionFile = new File(path.join(Directory.current.path, 'ios', '.generated', 'REVISION'));
// If the revision stamp does not exist, the Xcode project definitely requires
// an update
if (!revisionFile.existsSync()) {
printTrace("A revision stamp does not exist. The Xcode project has never been initialized.");
return true;
}
if (revisionFile.readAsStringSync() != ArtifactStore.engineRevision) {
printTrace("The revision stamp and the Flutter engine revision differ. Project needs to be updated.");
return true;
}
printTrace("Xcode project is up to date.");
return false;
}
Future<int> setupXcodeProjectHarness() async {
// Step 1: Fetch the archive from the cloud
String iosFilesPath = path.join(Directory.current.path, 'ios');
......
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