[flutter_tools] ensure track-widget-creation can be changed on devcompiler (#56564)

Workaround for cached web builds with --[no-]track-widget-creation flags.
Similar PR: #23299
This commit is contained in:
Bogdan Lukin 2020-05-08 08:58:43 +07:00 committed by GitHub
parent d56af3ca5e
commit 80a14af582
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 17 deletions

View file

@ -814,14 +814,12 @@ tasks:
stage: devicelab
required_agent_capabilities: ["linux-vm"]
# TODO(jonahwilliams): This should stay off until
# https://github.com/flutter/flutter/issues/56212 is fixed.
# web_enable_twc:
# description: >
# Verifies that track-widget-creation can be enabled and disabled.
# stage: devicelab
# required_agent_capabilities: ["linux-vm"]
# flaky: true
web_enable_twc:
description: >
Verifies that track-widget-creation can be enabled and disabled.
stage: devicelab
required_agent_capabilities: ["linux-vm"]
flaky: true
# run_without_leak_linux:
# description: >

View file

@ -640,7 +640,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
pathToReload: getReloadPath(fullRestart: fullRestart),
invalidatedFiles: invalidationResult.uris,
packageConfig: invalidationResult.packageConfig,
trackWidgetCreation: true,
trackWidgetCreation: debuggingOptions.buildInfo.trackWidgetCreation,
);
devFSStatus.stop();
globals.printTrace('Synced ${getSizeAsMB(report.syncedBytes)}.');

View file

@ -34,6 +34,13 @@ String getDefaultApplicationKernelPath({ @required bool trackWidgetCreation }) {
);
}
String getDefaultCachedKernelPath({ @required bool trackWidgetCreation }) {
return getKernelPathForTransformerOptions(
globals.fs.path.join(getBuildDirectory(), 'cache.dill'),
trackWidgetCreation: trackWidgetCreation,
);
}
String getKernelPathForTransformerOptions(
String path, {
@required bool trackWidgetCreation,

View file

@ -21,6 +21,7 @@ import 'base/signals.dart';
import 'base/terminal.dart';
import 'base/utils.dart';
import 'build_info.dart';
import 'bundle.dart';
import 'codegen.dart';
import 'compile.dart';
import 'convert.dart';
@ -98,7 +99,9 @@ class FlutterDevice {
compilerMessageConsumer:
(String message, {bool emphasis, TerminalColor color, }) =>
globals.printTrace(message),
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'),
initializeFromDill: getDefaultCachedKernelPath(
trackWidgetCreation: buildInfo.trackWidgetCreation,
),
targetModel: TargetModel.dartdevc,
experimentalFlags: experimentalFlags,
platformDill: globals.fs.file(globals.artifacts
@ -123,7 +126,9 @@ class FlutterDevice {
targetModel: targetModel,
experimentalFlags: experimentalFlags,
dartDefines: buildInfo.dartDefines,
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'),
initializeFromDill: getDefaultCachedKernelPath(
trackWidgetCreation: buildInfo.trackWidgetCreation,
),
packagesPath: globalPackagesPath,
);
}
@ -723,6 +728,7 @@ abstract class ResidentRunner {
bool get supportsServiceProtocol => isRunningDebug || isRunningProfile;
bool get supportsCanvasKit => false;
bool get supportsWriteSkSL => supportsServiceProtocol;
bool get trackWidgetCreation => debuggingOptions.buildInfo.trackWidgetCreation;
// Returns the Uri of the first connected device for mobile,
// and only connected device for web.
@ -1156,10 +1162,11 @@ abstract class ResidentRunner {
Future<void> preExit() async {
// If _dillOutputPath is null, we created a temporary directory for the dill.
if (_dillOutputPath == null && artifactDirectory.existsSync()) {
final File outputDill = artifactDirectory.childFile('app.dill');
final File outputDill = globals.fs.file(dillOutputPath);
if (outputDill.existsSync()) {
artifactDirectory.childFile('app.dill')
.copySync(globals.fs.path.join(getBuildDirectory(), 'cache.dill'));
outputDill.copySync(getDefaultCachedKernelPath(
trackWidgetCreation: trackWidgetCreation,
));
}
artifactDirectory.deleteSync(recursive: true);
}

View file

@ -141,7 +141,7 @@ void main() {
projectRootPath: anyNamed('projectRootPath'),
pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'),
trackWidgetCreation: true,
trackWidgetCreation: anyNamed('trackWidgetCreation'),
packageConfig: anyNamed('packageConfig'),
)).thenAnswer((Invocation _) async {
return UpdateFSReport(success: true, syncedBytes: 0)..invalidatedModules = <String>[];
@ -583,7 +583,7 @@ void main() {
pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'),
packageConfig: anyNamed('packageConfig'),
trackWidgetCreation: true,
trackWidgetCreation: anyNamed('trackWidgetCreation'),
)).thenAnswer((Invocation _) async {
return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[];
});
@ -646,7 +646,7 @@ void main() {
pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'),
packageConfig: anyNamed('packageConfig'),
trackWidgetCreation: true,
trackWidgetCreation: anyNamed('trackWidgetCreation'),
)).thenAnswer((Invocation _) async {
return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[];
});