[flutter_tools] add support for --bundle-sksl-path to flutter run
/ flutter drive
(#80885)
This commit is contained in:
parent
5d37df13f9
commit
63ba1b23ca
@ -823,7 +823,7 @@ class PerfTestWithSkSL extends PerfTest {
|
|||||||
await _generateSkSL();
|
await _generateSkSL();
|
||||||
|
|
||||||
// Build the app with SkSL artifacts and run that app
|
// Build the app with SkSL artifacts and run that app
|
||||||
final String observatoryUri = await _buildAndRun();
|
final String observatoryUri = await _runApp(skslPath: _skslJsonFileName);
|
||||||
|
|
||||||
// Attach to the running app and run the final driver test to get metrics.
|
// Attach to the running app and run the final driver test to get metrics.
|
||||||
final TaskResult result = await internalRun(
|
final TaskResult result = await internalRun(
|
||||||
@ -859,7 +859,7 @@ class PerfTestWithSkSL extends PerfTest {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> _runApp({String appBinary, bool cacheSkSL = false}) async {
|
Future<String> _runApp({String appBinary, bool cacheSkSL = false, String skslPath}) async {
|
||||||
if (File(_vmserviceFileName).existsSync()) {
|
if (File(_vmserviceFileName).existsSync()) {
|
||||||
File(_vmserviceFileName).deleteSync();
|
File(_vmserviceFileName).deleteSync();
|
||||||
}
|
}
|
||||||
@ -877,6 +877,7 @@ class PerfTestWithSkSL extends PerfTest {
|
|||||||
'--purge-persistent-cache',
|
'--purge-persistent-cache',
|
||||||
'--no-publish-port',
|
'--no-publish-port',
|
||||||
'--profile',
|
'--profile',
|
||||||
|
if (skslPath != null) '--bundle-sksl-path=$skslPath',
|
||||||
if (cacheSkSL) '--cache-sksl',
|
if (cacheSkSL) '--cache-sksl',
|
||||||
'-d', _device.deviceId,
|
'-d', _device.deviceId,
|
||||||
'-t', testTarget,
|
'-t', testTarget,
|
||||||
@ -894,18 +895,6 @@ class PerfTestWithSkSL extends PerfTest {
|
|||||||
return file.readAsStringSync();
|
return file.readAsStringSync();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the VMService URI.
|
|
||||||
Future<String> _buildAndRun() async {
|
|
||||||
await flutter('build', options: <String>[
|
|
||||||
if (_isAndroid) 'apk' else 'ios',
|
|
||||||
'--profile',
|
|
||||||
'--bundle-sksl-path', _skslJsonFileName,
|
|
||||||
'-t', testTarget,
|
|
||||||
]);
|
|
||||||
|
|
||||||
return _runApp(appBinary: _appBinary);
|
|
||||||
}
|
|
||||||
|
|
||||||
String get _skslJsonFileName => '$testDirectory/flutter_01.sksl.json';
|
String get _skslJsonFileName => '$testDirectory/flutter_01.sksl.json';
|
||||||
String get _vmserviceFileName => '$testDirectory/$_kVmserviceOutFileName';
|
String get _vmserviceFileName => '$testDirectory/$_kVmserviceOutFileName';
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
|||||||
usesFlavorOption();
|
usesFlavorOption();
|
||||||
usesWebRendererOption();
|
usesWebRendererOption();
|
||||||
addNativeNullAssertions(hide: !verboseHelp);
|
addNativeNullAssertions(hide: !verboseHelp);
|
||||||
|
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||||
argParser
|
argParser
|
||||||
..addFlag('trace-startup',
|
..addFlag('trace-startup',
|
||||||
negatable: false,
|
negatable: false,
|
||||||
|
@ -507,6 +507,16 @@ void main() {
|
|||||||
'--no-pub',
|
'--no-pub',
|
||||||
]), throwsA(isA<RPCError>()));
|
]), throwsA(isA<RPCError>()));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testUsingContext('Passes sksl bundle info the build options', () async {
|
||||||
|
final TestRunCommandWithFakeResidentRunner command = TestRunCommandWithFakeResidentRunner();
|
||||||
|
|
||||||
|
await expectLater(() => createTestCommandRunner(command).run(<String>[
|
||||||
|
'run',
|
||||||
|
'--no-pub',
|
||||||
|
'--bundle-sksl-path=foo.json',
|
||||||
|
]), throwsA(isA<ToolExit>().having((ToolExit exit) => exit.message, 'message', contains('No SkSL shader bundle found at foo.json'))));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
class MockCache extends Mock implements Cache {}
|
class MockCache extends Mock implements Cache {}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user