Unverified Commit 22bf19ce authored by Yuqian Li's avatar Yuqian Li Committed by GitHub

Add purge-persistent-cache option to run and drive (#62221)

Fixes https://github.com/flutter/flutter/issues/39526

Needs https://github.com/flutter/engine/pull/20013 to land and roll first.
parent 0c3b0c51
......@@ -654,6 +654,8 @@ class AndroidDevice extends Device {
...<String>['--ez', 'dump-skp-on-shader-compilation', 'true'],
if (debuggingOptions.cacheSkSL)
...<String>['--ez', 'cache-sksl', 'true'],
if (debuggingOptions.purgePersistentCache)
...<String>['--ez', 'purge-persistent-cache', 'true'],
if (debuggingOptions.debuggingEnabled) ...<String>[
if (debuggingOptions.buildInfo.isDebug) ...<String>[
...<String>['--ez', 'enable-checked-mode', 'true'],
......
......@@ -493,6 +493,7 @@ Future<LaunchResult> _startApp(
verboseSystemLogs: command.verboseSystemLogs,
cacheSkSL: command.cacheSkSL,
dumpSkpOnShaderCompilation: command.dumpSkpOnShaderCompilation,
purgePersistentCache: command.purgePersistentCache,
),
platformArgs: platformArgs,
prebuiltApplication: !command.shouldBuild,
......
......@@ -52,6 +52,13 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
'By default, this is not enabled to reduce the overhead. '
'This is only available in profile or debug build. ',
)
..addFlag('purge-persistent-cache',
negatable: false,
help: 'Removes all existing persistent caches. This allows reproducing '
'shader compilation jank that normally only happens the first time '
'an app is run, or for reliable testing of compilation jank fixes '
'(e.g. shader warm-up).',
)
..addOption('route',
help: 'Which route to load when running the app.',
)
......@@ -74,6 +81,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
bool get traceStartup => boolArg('trace-startup');
bool get cacheSkSL => boolArg('cache-sksl');
bool get dumpSkpOnShaderCompilation => boolArg('dump-skp-on-shader-compilation');
bool get purgePersistentCache => boolArg('purge-persistent-cache');
String get route => stringArg('route');
}
......@@ -397,6 +405,7 @@ class RunCommand extends RunCommandBase {
endlessTraceBuffer: boolArg('endless-trace-buffer'),
dumpSkpOnShaderCompilation: dumpSkpOnShaderCompilation,
cacheSkSL: cacheSkSL,
purgePersistentCache: purgePersistentCache,
deviceVmServicePort: deviceVmservicePort,
hostVmServicePort: hostVmservicePort,
verboseSystemLogs: boolArg('verbose-system-logs'),
......
......@@ -774,6 +774,7 @@ class DebuggingOptions {
this.endlessTraceBuffer = false,
this.dumpSkpOnShaderCompilation = false,
this.cacheSkSL = false,
this.purgePersistentCache = false,
this.useTestFonts = false,
this.verboseSystemLogs = false,
this.hostVmServicePort,
......@@ -814,6 +815,7 @@ class DebuggingOptions {
traceSystrace = false,
endlessTraceBuffer = false,
dumpSkpOnShaderCompilation = false,
purgePersistentCache = false,
verboseSystemLogs = false,
hostVmServicePort = null,
deviceVmServicePort = null,
......@@ -836,6 +838,7 @@ class DebuggingOptions {
final bool endlessTraceBuffer;
final bool dumpSkpOnShaderCompilation;
final bool cacheSkSL;
final bool purgePersistentCache;
final bool useTestFonts;
final bool verboseSystemLogs;
/// Whether to invoke webOnlyInitializePlatform in Flutter for web.
......
......@@ -383,6 +383,7 @@ class IOSDevice extends Device {
if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
if (debuggingOptions.verboseSystemLogs) '--verbose-logging',
if (debuggingOptions.cacheSkSL) '--cache-sksl',
if (debuggingOptions.purgePersistentCache) '--purge-persistent-cache',
if (platformArgs['trace-startup'] as bool ?? false) '--trace-startup',
];
......
......@@ -619,6 +619,11 @@ void main() {
'--cache-sksl',
() => debuggingOptions.cacheSkSL,
);
testOptionThatDefaultsToFalse(
'--purge-persistent-cache',
() => debuggingOptions.purgePersistentCache,
);
});
});
......
......@@ -249,6 +249,7 @@ void main() {
'--ez', 'endless-trace-buffer', 'true',
'--ez', 'dump-skp-on-shader-compilation', 'true',
'--ez', 'cache-sksl', 'true',
'--ez', 'purge-persistent-cache', 'true',
'--ez', 'enable-checked-mode', 'true',
'--ez', 'verify-entry-points', 'true',
'--ez', 'start-paused', 'true',
......@@ -277,6 +278,7 @@ void main() {
endlessTraceBuffer: true,
dumpSkpOnShaderCompilation: true,
cacheSkSL: true,
purgePersistentCache: true,
useTestFonts: true,
verboseSystemLogs: true,
),
......
......@@ -329,6 +329,7 @@ void main() {
'--dump-skp-on-shader-compilation',
'--verbose-logging',
'--cache-sksl',
'--purge-persistent-cache',
].join(' '),
], environment: const <String, String>{
'PATH': '/usr/bin:null',
......@@ -382,6 +383,7 @@ void main() {
endlessTraceBuffer: true,
dumpSkpOnShaderCompilation: true,
cacheSkSL: true,
purgePersistentCache: true,
verboseSystemLogs: true,
),
platformArgs: <String, dynamic>{},
......
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