Replace the checked flag in DebuggingOptions with the build mode (#3901)
This also fixes some related problems affecting "flutter run": * FLXes built during AndroidDevice.startApp need to match the build mode * APKs should always be rebuilt if the build mode uses AOT compilation
This commit is contained in:
parent
0628c64b79
commit
c192a7e4ca
@ -269,7 +269,7 @@ class AndroidDevice extends Device {
|
|||||||
if (route != null)
|
if (route != null)
|
||||||
cmd.addAll(<String>['--es', 'route', route]);
|
cmd.addAll(<String>['--es', 'route', route]);
|
||||||
if (options.debuggingEnabled) {
|
if (options.debuggingEnabled) {
|
||||||
if (options.checked)
|
if (options.buildMode == BuildMode.debug)
|
||||||
cmd.addAll(<String>['--ez', 'enable-checked-mode', 'true']);
|
cmd.addAll(<String>['--ez', 'enable-checked-mode', 'true']);
|
||||||
if (options.startPaused)
|
if (options.startPaused)
|
||||||
cmd.addAll(<String>['--ez', 'start-paused', 'true']);
|
cmd.addAll(<String>['--ez', 'start-paused', 'true']);
|
||||||
@ -334,6 +334,7 @@ class AndroidDevice extends Device {
|
|||||||
|
|
||||||
String localBundlePath = await flx.buildFlx(
|
String localBundlePath = await flx.buildFlx(
|
||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
|
precompiledSnapshot: isAotBuildMode(debuggingOptions.buildMode),
|
||||||
includeRobotoFonts: false
|
includeRobotoFonts: false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -452,7 +452,10 @@ Future<int> buildAndroid(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!force && !_needsRebuild(outputFile, manifest, extraFiles)) {
|
// In debug (JIT) mode, the snapshot lives in the FLX, and we can skip the APK
|
||||||
|
// rebuild if none of the resources in the APK are stale.
|
||||||
|
// In AOT modes, the snapshot lives in the APK, so the APK must be rebuilt.
|
||||||
|
if (!isAotBuildMode(buildMode) && !force && !_needsRebuild(outputFile, manifest, extraFiles)) {
|
||||||
printTrace('APK up to date; skipping build step.');
|
printTrace('APK up to date; skipping build step.');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -269,8 +269,7 @@ Future<int> startApp(DriveCommand command, BuildMode buildMode) async {
|
|||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
route: command.route,
|
route: command.route,
|
||||||
debuggingOptions: new DebuggingOptions.enabled(
|
debuggingOptions: new DebuggingOptions.enabled(
|
||||||
// TODO(devoncarew): Change this to 'buildMode == BuildMode.debug'.
|
buildMode,
|
||||||
checked: command.argResults['checked'],
|
|
||||||
startPaused: true,
|
startPaused: true,
|
||||||
observatoryPort: command.debugPort
|
observatoryPort: command.debugPort
|
||||||
),
|
),
|
||||||
|
@ -8,7 +8,6 @@ import 'dart:io';
|
|||||||
import '../base/os.dart';
|
import '../base/os.dart';
|
||||||
import '../base/process.dart';
|
import '../base/process.dart';
|
||||||
import '../device.dart';
|
import '../device.dart';
|
||||||
import '../build_info.dart';
|
|
||||||
import '../globals.dart';
|
import '../globals.dart';
|
||||||
import 'run.dart';
|
import 'run.dart';
|
||||||
|
|
||||||
@ -63,7 +62,7 @@ class ListenCommand extends RunCommandBase {
|
|||||||
target: target,
|
target: target,
|
||||||
install: firstTime,
|
install: firstTime,
|
||||||
stop: true,
|
stop: true,
|
||||||
debuggingOptions: new DebuggingOptions.enabled(checked: getBuildMode() == BuildMode.debug),
|
debuggingOptions: new DebuggingOptions.enabled(getBuildMode()),
|
||||||
traceStartup: traceStartup,
|
traceStartup: traceStartup,
|
||||||
route: route
|
route: route
|
||||||
);
|
);
|
||||||
|
@ -24,13 +24,6 @@ abstract class RunCommandBase extends FlutterCommand {
|
|||||||
RunCommandBase() {
|
RunCommandBase() {
|
||||||
addBuildModeFlags();
|
addBuildModeFlags();
|
||||||
|
|
||||||
// TODO(devoncarew): Remove in favor of --debug/--profile/--release.
|
|
||||||
argParser.addFlag('checked',
|
|
||||||
negatable: true,
|
|
||||||
defaultsTo: true,
|
|
||||||
help: 'Run the application in checked ("slow") mode.\n'
|
|
||||||
'Note: this flag will be removed in favor of the --debug/--profile/--release flags.');
|
|
||||||
|
|
||||||
argParser.addFlag('trace-startup',
|
argParser.addFlag('trace-startup',
|
||||||
negatable: true,
|
negatable: true,
|
||||||
defaultsTo: false,
|
defaultsTo: false,
|
||||||
@ -112,11 +105,10 @@ class RunCommand extends RunCommandBase {
|
|||||||
DebuggingOptions options;
|
DebuggingOptions options;
|
||||||
|
|
||||||
if (getBuildMode() != BuildMode.debug) {
|
if (getBuildMode() != BuildMode.debug) {
|
||||||
options = new DebuggingOptions.disabled();
|
options = new DebuggingOptions.disabled(getBuildMode());
|
||||||
} else {
|
} else {
|
||||||
options = new DebuggingOptions.enabled(
|
options = new DebuggingOptions.enabled(
|
||||||
// TODO(devoncarew): Change this to 'getBuildMode() == BuildMode.debug'.
|
getBuildMode(),
|
||||||
checked: argResults['checked'],
|
|
||||||
startPaused: argResults['start-paused'],
|
startPaused: argResults['start-paused'],
|
||||||
observatoryPort: debugPort
|
observatoryPort: debugPort
|
||||||
);
|
);
|
||||||
|
@ -225,23 +225,21 @@ abstract class Device {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class DebuggingOptions {
|
class DebuggingOptions {
|
||||||
DebuggingOptions.enabled({
|
DebuggingOptions.enabled(this.buildMode, {
|
||||||
this.checked: true,
|
|
||||||
this.startPaused: false,
|
this.startPaused: false,
|
||||||
this.observatoryPort,
|
this.observatoryPort,
|
||||||
this.diagnosticPort
|
this.diagnosticPort
|
||||||
}) : debuggingEnabled = true;
|
}) : debuggingEnabled = true;
|
||||||
|
|
||||||
DebuggingOptions.disabled() :
|
DebuggingOptions.disabled(this.buildMode) :
|
||||||
debuggingEnabled = false,
|
debuggingEnabled = false,
|
||||||
checked = false,
|
|
||||||
startPaused = false,
|
startPaused = false,
|
||||||
observatoryPort = null,
|
observatoryPort = null,
|
||||||
diagnosticPort = null;
|
diagnosticPort = null;
|
||||||
|
|
||||||
final bool debuggingEnabled;
|
final bool debuggingEnabled;
|
||||||
|
|
||||||
final bool checked;
|
final BuildMode buildMode;
|
||||||
final bool startPaused;
|
final bool startPaused;
|
||||||
final int observatoryPort;
|
final int observatoryPort;
|
||||||
final int diagnosticPort;
|
final int diagnosticPort;
|
||||||
|
@ -457,7 +457,7 @@ class IOSSimulator extends Device {
|
|||||||
];
|
];
|
||||||
|
|
||||||
if (debuggingOptions.debuggingEnabled) {
|
if (debuggingOptions.debuggingEnabled) {
|
||||||
if (debuggingOptions.checked)
|
if (debuggingOptions.buildMode == BuildMode.debug)
|
||||||
args.add("--enable-checked-mode");
|
args.add("--enable-checked-mode");
|
||||||
if (debuggingOptions.startPaused)
|
if (debuggingOptions.startPaused)
|
||||||
args.add("--start-paused");
|
args.add("--start-paused");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user