Make flutter build ios --simulator default to debug builds (#5540)

This commit is contained in:
Todd Volkert
2016-08-22 17:14:30 -07:00
committed by GitHub
parent bfbbef108d
commit 5f44b2d4e5
2 changed files with 17 additions and 3 deletions

View File

@@ -17,7 +17,15 @@ import 'build.dart';
class BuildIOSCommand extends BuildSubCommand {
BuildIOSCommand() {
usesTargetOption();
addBuildModeFlags();
argParser.addFlag('debug',
negatable: false,
help: 'Build a debug version of your app (default mode for iOS simulator builds).');
argParser.addFlag('profile',
negatable: false,
help: 'Build a version of your app specialized for performance profiling.');
argParser.addFlag('release',
negatable: false,
help: 'Build a release version of your app (default mode for device builds).');
argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device.');
argParser.addFlag('codesign', negatable: true, defaultsTo: true,
help: 'Codesign the application bundle (only available on device builds).');
@@ -31,6 +39,9 @@ class BuildIOSCommand extends BuildSubCommand {
@override
Future<int> runInProject() async {
bool forSimulator = argResults['simulator'];
defaultBuildMode = forSimulator ? BuildMode.debug : BuildMode.release;
await super.runInProject();
if (getCurrentHostPlatform() != HostPlatform.darwin_x64) {
printError('Building for iOS is only supported on the Mac.');
@@ -44,7 +55,6 @@ class BuildIOSCommand extends BuildSubCommand {
return 1;
}
bool forSimulator = argResults['simulator'];
bool shouldCodesign = argResults['codesign'];
if (!forSimulator && !shouldCodesign) {

View File

@@ -70,7 +70,7 @@ abstract class FlutterCommand extends Command {
}
void addBuildModeFlags({ bool defaultToRelease: true }) {
_defaultBuildMode = defaultToRelease ? BuildMode.release : BuildMode.debug;
defaultBuildMode = defaultToRelease ? BuildMode.release : BuildMode.debug;
argParser.addFlag('debug',
negatable: false,
@@ -83,6 +83,10 @@ abstract class FlutterCommand extends Command {
help: 'Build a release version of your app${defaultToRelease ? ' (default mode)' : ''}.');
}
set defaultBuildMode(BuildMode buildMode) {
_defaultBuildMode = buildMode;
}
BuildMode getBuildMode() {
List<bool> modeFlags = <bool>[argResults['debug'], argResults['profile'], argResults['release']];
if (modeFlags.where((bool flag) => flag).length > 1)