Unverified Commit 80a14af5 authored by Bogdan Lukin's avatar Bogdan Lukin Committed by GitHub

[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
parent d56af3ca
...@@ -814,14 +814,12 @@ tasks: ...@@ -814,14 +814,12 @@ tasks:
stage: devicelab stage: devicelab
required_agent_capabilities: ["linux-vm"] required_agent_capabilities: ["linux-vm"]
# TODO(jonahwilliams): This should stay off until web_enable_twc:
# https://github.com/flutter/flutter/issues/56212 is fixed. description: >
# web_enable_twc: Verifies that track-widget-creation can be enabled and disabled.
# description: > stage: devicelab
# Verifies that track-widget-creation can be enabled and disabled. required_agent_capabilities: ["linux-vm"]
# stage: devicelab flaky: true
# required_agent_capabilities: ["linux-vm"]
# flaky: true
# run_without_leak_linux: # run_without_leak_linux:
# description: > # description: >
......
...@@ -640,7 +640,7 @@ class _ResidentWebRunner extends ResidentWebRunner { ...@@ -640,7 +640,7 @@ class _ResidentWebRunner extends ResidentWebRunner {
pathToReload: getReloadPath(fullRestart: fullRestart), pathToReload: getReloadPath(fullRestart: fullRestart),
invalidatedFiles: invalidationResult.uris, invalidatedFiles: invalidationResult.uris,
packageConfig: invalidationResult.packageConfig, packageConfig: invalidationResult.packageConfig,
trackWidgetCreation: true, trackWidgetCreation: debuggingOptions.buildInfo.trackWidgetCreation,
); );
devFSStatus.stop(); devFSStatus.stop();
globals.printTrace('Synced ${getSizeAsMB(report.syncedBytes)}.'); globals.printTrace('Synced ${getSizeAsMB(report.syncedBytes)}.');
......
...@@ -34,6 +34,13 @@ String getDefaultApplicationKernelPath({ @required bool trackWidgetCreation }) { ...@@ -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 getKernelPathForTransformerOptions(
String path, { String path, {
@required bool trackWidgetCreation, @required bool trackWidgetCreation,
......
...@@ -21,6 +21,7 @@ import 'base/signals.dart'; ...@@ -21,6 +21,7 @@ import 'base/signals.dart';
import 'base/terminal.dart'; import 'base/terminal.dart';
import 'base/utils.dart'; import 'base/utils.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'bundle.dart';
import 'codegen.dart'; import 'codegen.dart';
import 'compile.dart'; import 'compile.dart';
import 'convert.dart'; import 'convert.dart';
...@@ -98,7 +99,9 @@ class FlutterDevice { ...@@ -98,7 +99,9 @@ class FlutterDevice {
compilerMessageConsumer: compilerMessageConsumer:
(String message, {bool emphasis, TerminalColor color, }) => (String message, {bool emphasis, TerminalColor color, }) =>
globals.printTrace(message), globals.printTrace(message),
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'), initializeFromDill: getDefaultCachedKernelPath(
trackWidgetCreation: buildInfo.trackWidgetCreation,
),
targetModel: TargetModel.dartdevc, targetModel: TargetModel.dartdevc,
experimentalFlags: experimentalFlags, experimentalFlags: experimentalFlags,
platformDill: globals.fs.file(globals.artifacts platformDill: globals.fs.file(globals.artifacts
...@@ -123,7 +126,9 @@ class FlutterDevice { ...@@ -123,7 +126,9 @@ class FlutterDevice {
targetModel: targetModel, targetModel: targetModel,
experimentalFlags: experimentalFlags, experimentalFlags: experimentalFlags,
dartDefines: buildInfo.dartDefines, dartDefines: buildInfo.dartDefines,
initializeFromDill: globals.fs.path.join(getBuildDirectory(), 'cache.dill'), initializeFromDill: getDefaultCachedKernelPath(
trackWidgetCreation: buildInfo.trackWidgetCreation,
),
packagesPath: globalPackagesPath, packagesPath: globalPackagesPath,
); );
} }
...@@ -723,6 +728,7 @@ abstract class ResidentRunner { ...@@ -723,6 +728,7 @@ abstract class ResidentRunner {
bool get supportsServiceProtocol => isRunningDebug || isRunningProfile; bool get supportsServiceProtocol => isRunningDebug || isRunningProfile;
bool get supportsCanvasKit => false; bool get supportsCanvasKit => false;
bool get supportsWriteSkSL => supportsServiceProtocol; bool get supportsWriteSkSL => supportsServiceProtocol;
bool get trackWidgetCreation => debuggingOptions.buildInfo.trackWidgetCreation;
// Returns the Uri of the first connected device for mobile, // Returns the Uri of the first connected device for mobile,
// and only connected device for web. // and only connected device for web.
...@@ -1156,10 +1162,11 @@ abstract class ResidentRunner { ...@@ -1156,10 +1162,11 @@ abstract class ResidentRunner {
Future<void> preExit() async { Future<void> preExit() async {
// If _dillOutputPath is null, we created a temporary directory for the dill. // If _dillOutputPath is null, we created a temporary directory for the dill.
if (_dillOutputPath == null && artifactDirectory.existsSync()) { if (_dillOutputPath == null && artifactDirectory.existsSync()) {
final File outputDill = artifactDirectory.childFile('app.dill'); final File outputDill = globals.fs.file(dillOutputPath);
if (outputDill.existsSync()) { if (outputDill.existsSync()) {
artifactDirectory.childFile('app.dill') outputDill.copySync(getDefaultCachedKernelPath(
.copySync(globals.fs.path.join(getBuildDirectory(), 'cache.dill')); trackWidgetCreation: trackWidgetCreation,
));
} }
artifactDirectory.deleteSync(recursive: true); artifactDirectory.deleteSync(recursive: true);
} }
......
...@@ -141,7 +141,7 @@ void main() { ...@@ -141,7 +141,7 @@ void main() {
projectRootPath: anyNamed('projectRootPath'), projectRootPath: anyNamed('projectRootPath'),
pathToReload: anyNamed('pathToReload'), pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'), invalidatedFiles: anyNamed('invalidatedFiles'),
trackWidgetCreation: true, trackWidgetCreation: anyNamed('trackWidgetCreation'),
packageConfig: anyNamed('packageConfig'), packageConfig: anyNamed('packageConfig'),
)).thenAnswer((Invocation _) async { )).thenAnswer((Invocation _) async {
return UpdateFSReport(success: true, syncedBytes: 0)..invalidatedModules = <String>[]; return UpdateFSReport(success: true, syncedBytes: 0)..invalidatedModules = <String>[];
...@@ -583,7 +583,7 @@ void main() { ...@@ -583,7 +583,7 @@ void main() {
pathToReload: anyNamed('pathToReload'), pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'), invalidatedFiles: anyNamed('invalidatedFiles'),
packageConfig: anyNamed('packageConfig'), packageConfig: anyNamed('packageConfig'),
trackWidgetCreation: true, trackWidgetCreation: anyNamed('trackWidgetCreation'),
)).thenAnswer((Invocation _) async { )).thenAnswer((Invocation _) async {
return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[]; return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[];
}); });
...@@ -646,7 +646,7 @@ void main() { ...@@ -646,7 +646,7 @@ void main() {
pathToReload: anyNamed('pathToReload'), pathToReload: anyNamed('pathToReload'),
invalidatedFiles: anyNamed('invalidatedFiles'), invalidatedFiles: anyNamed('invalidatedFiles'),
packageConfig: anyNamed('packageConfig'), packageConfig: anyNamed('packageConfig'),
trackWidgetCreation: true, trackWidgetCreation: anyNamed('trackWidgetCreation'),
)).thenAnswer((Invocation _) async { )).thenAnswer((Invocation _) async {
return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[]; return UpdateFSReport(success: false, syncedBytes: 0)..invalidatedModules = <String>[];
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment