From 23c632ab87a0deebc0f6117b2b459bd6383a7206 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Thu, 11 Feb 2016 18:39:25 -0800 Subject: [PATCH] iOS: Write a default .gitignore file for the "Generated" directory --- packages/flutter_tools/lib/src/commands/ios.dart | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/flutter_tools/lib/src/commands/ios.dart b/packages/flutter_tools/lib/src/commands/ios.dart index 5348b53111..1075584a0c 100644 --- a/packages/flutter_tools/lib/src/commands/ios.dart +++ b/packages/flutter_tools/lib/src/commands/ios.dart @@ -167,19 +167,27 @@ class IOSCommand extends FlutterCommand { return 1; } - // Step 3: Setup default user editable files if this is the first run of + // Step 3: The generated project should NOT be checked into the users + // version control system. Be nice and write a gitignore for them if + // one does not exist. + File generatedGitignore = new File(path.join(iosFilesPath, ".gitignore")); + if (!generatedGitignore.existsSync()) { + generatedGitignore.writeAsStringSync("Generated/\n"); + } + + // Step 4: Setup default user editable files if this is the first run of // the init command. _writeUserEditableFilesIfNecessary(iosFilesPath); - // Step 3: Populate the Local.xcconfig with project specific paths + // Step 5: Populate the Local.xcconfig with project specific paths _setupXcodeProjXcconfig(path.join(xcodeprojPath, "Local.xcconfig")); - // Step 4: Write the REVISION file + // Step 6: Write the REVISION file File revisionFile = new File(path.join(xcodeprojPath, "REVISION")); revisionFile.createSync(); revisionFile.writeAsStringSync(ArtifactStore.engineRevision); - // Step 5: Tell the user the location of the generated project. + // Step 7: Tell the user the location of the generated project. printStatus("An Xcode project has been placed in 'ios/'."); printStatus("You may edit it to modify iOS specific configuration."); return 0;