Merge pull request #3140 from chinmaygarde/master

Add a `--no-codesign` option to `ios build` to disable code signing.
diff --git a/packages/flutter_tools/lib/src/ios/mac.dart b/packages/flutter_tools/lib/src/ios/mac.dart
index 7a71226..42e1f5f 100644
--- a/packages/flutter_tools/lib/src/ios/mac.dart
+++ b/packages/flutter_tools/lib/src/ios/mac.dart
@@ -97,7 +97,7 @@
 }
 
 Future<bool> buildIOSXcodeProject(ApplicationPackage app,
-    { bool buildForDevice, Directory buildDirectory }) async {
+    { bool buildForDevice, Directory buildDirectory, bool codesign: true }) async {
   String flutterProjectPath = Directory.current.path;
 
   if (xcodeProjectRequiresUpdate()) {
@@ -125,6 +125,8 @@
     '/usr/bin/env',
     'xcrun',
     'xcodebuild',
+    'clean',
+    'build',
     '-target', 'Runner',
     '-configuration', 'Release',
     'ONLY_ACTIVE_ARCH=YES',
@@ -141,6 +143,15 @@
 
   if (buildForDevice) {
     commands.addAll(<String>['-sdk', 'iphoneos', '-arch', 'arm64']);
+    if (!codesign) {
+      commands.addAll(
+        <String>[
+          'CODE_SIGNING_ALLOWED=NO',
+          'CODE_SIGNING_REQUIRED=NO',
+          'CODE_SIGNING_IDENTITY=""'
+        ]
+      );
+    }
   } else {
     commands.addAll(<String>['-sdk', 'iphonesimulator', '-arch', 'x86_64']);
   }