Add a profile build mode flag for building APKs with AOT compilation (#3526)

This is currently hidden for development use.  It will select artifacts from
the android_{Debug,Release}_Deploy output in a local engine build.
diff --git a/packages/flutter_tools/lib/src/build_configuration.dart b/packages/flutter_tools/lib/src/build_configuration.dart
index 924ec31..abe98aa 100644
--- a/packages/flutter_tools/lib/src/build_configuration.dart
+++ b/packages/flutter_tools/lib/src/build_configuration.dart
@@ -15,11 +15,10 @@
   debug,
 }
 
-/// The type of build - `debug` or `release`.
-///
-/// TODO(devoncarew): Add a `profile` mode.
+/// The type of build - `debug`, `profile`, or `release`.
 enum BuildMode {
   debug,
+  profile,
   release
 }
 
diff --git a/packages/flutter_tools/lib/src/runner/flutter_command.dart b/packages/flutter_tools/lib/src/runner/flutter_command.dart
index 406858c..432682e6 100644
--- a/packages/flutter_tools/lib/src/runner/flutter_command.dart
+++ b/packages/flutter_tools/lib/src/runner/flutter_command.dart
@@ -64,16 +64,23 @@
     argParser.addFlag('debug',
       negatable: false,
       help: 'Build a debug version of your app (the default).');
+    argParser.addFlag('profile',
+      hide: true,
+      negatable: false,
+      help: 'Build a profile (ahead of time compilation) version of your app.');
     argParser.addFlag('release',
       negatable: false,
       help: 'Build a release version of your app.');
   }
 
   BuildMode getBuildMode() {
-    if (argResults['debug'] && argResults['release'])
-      throw new UsageException('Only one of --debug or --release should be specified.', null);
+    List<bool> modeFlags = [argResults['debug'], argResults['profile'], argResults['release']];
+    if (modeFlags.where((bool flag) => flag).length > 1)
+      throw new UsageException('Only one of --debug, --profile, or --release should be specified.', null);
 
     BuildMode mode = BuildMode.debug;
+    if (argResults['profile'])
+      mode = BuildMode.profile;
     if (argResults['release'])
       mode = BuildMode.release;
     return mode;
diff --git a/packages/flutter_tools/lib/src/toolchain.dart b/packages/flutter_tools/lib/src/toolchain.dart
index 74a05c3..0e25ef0 100644
--- a/packages/flutter_tools/lib/src/toolchain.dart
+++ b/packages/flutter_tools/lib/src/toolchain.dart
@@ -159,7 +159,11 @@
       }
 
       // Return something like 'out/android_Release'.
-      return new Directory(path.join(engineSrcPath, 'out/${type}_$_modeStr'));
+      String buildOutputPath = 'out/${type}_$_modeStr';
+      if (mode == BuildMode.profile)
+        buildOutputPath += '_Deploy';
+
+      return new Directory(path.join(engineSrcPath, buildOutputPath));
     } else {
       // For now, only suffix for deploy variants.
       String suffix = mode == BuildMode.release ? '-${getModeName(mode)}' : '';