mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[flutter_tools] remove SkSL bundling and dump skp on compilation. (#162849)
SkSL precompilation was only ever beneficial for iOS. For other platforms, we recommended against it as Skia generated shaders per target architecture which could be invalid on other devices. It is no longer possible to use Skia on iOS. Delete all Skia shader bundling logic. Fixes https://github.com/flutter/flutter/issues/80091
This commit is contained in:
parent
c89d563944
commit
33a4c95de0
@ -168,9 +168,6 @@ BuildApp() {
|
||||
if [[ -n "$PERFORMANCE_MEASUREMENT_FILE" ]]; then
|
||||
flutter_args+=("--performance-measurement-file=${PERFORMANCE_MEASUREMENT_FILE}")
|
||||
fi
|
||||
if [[ -n "$BUNDLE_SKSL_PATH" ]]; then
|
||||
flutter_args+=("-dBundleSkSLPath=${BUNDLE_SKSL_PATH}")
|
||||
fi
|
||||
if [[ -n "$CODE_SIZE_DIRECTORY" ]]; then
|
||||
flutter_args+=("-dCodeSizeDirectory=${CODE_SIZE_DIRECTORY}")
|
||||
fi
|
||||
|
@ -25,7 +25,6 @@ Future<void> main(List<String> arguments) async {
|
||||
final String? localEngineHost = Platform.environment['LOCAL_ENGINE_HOST'];
|
||||
final String? projectDirectory = Platform.environment['PROJECT_DIR'];
|
||||
final String? splitDebugInfo = Platform.environment['SPLIT_DEBUG_INFO'];
|
||||
final String? bundleSkSLPath = Platform.environment['BUNDLE_SKSL_PATH'];
|
||||
final bool trackWidgetCreation = Platform.environment['TRACK_WIDGET_CREATION'] == 'true';
|
||||
final bool treeShakeIcons = Platform.environment['TREE_SHAKE_ICONS'] == 'true';
|
||||
final bool verbose = Platform.environment['VERBOSE_SCRIPT_LOGGING'] == 'true';
|
||||
@ -94,7 +93,6 @@ or
|
||||
'-dTargetFile=$flutterTarget',
|
||||
'-dTreeShakeIcons="$treeShakeIcons"',
|
||||
'-dDartObfuscation=$dartObfuscation',
|
||||
if (bundleSkSLPath != null) '-dBundleSkSLPath=$bundleSkSLPath',
|
||||
if (codeSizeDirectory != null) '-dCodeSizeDirectory=$codeSizeDirectory',
|
||||
if (splitDebugInfo != null) '-dSplitDebugInfo=$splitDebugInfo',
|
||||
if (dartDefines != null) '--DartDefines=$dartDefines',
|
||||
|
@ -475,10 +475,6 @@ class Context {
|
||||
flutterArgs.add('-dCodesignIdentity=$expandedCodeSignIdentity');
|
||||
}
|
||||
|
||||
if (environment['BUNDLE_SKSL_PATH'] != null && environment['BUNDLE_SKSL_PATH']!.isNotEmpty) {
|
||||
flutterArgs.add('-dBundleSkSLPath=${environment['BUNDLE_SKSL_PATH']}');
|
||||
}
|
||||
|
||||
if (environment['CODE_SIZE_DIRECTORY'] != null &&
|
||||
environment['CODE_SIZE_DIRECTORY']!.isNotEmpty) {
|
||||
flutterArgs.add('-dCodeSizeDirectory=${environment['CODE_SIZE_DIRECTORY']}');
|
||||
|
@ -1220,11 +1220,6 @@ class FlutterPlugin implements Plugin<Project> {
|
||||
if (project.hasProperty(propDartDefines)) {
|
||||
dartDefinesValue = project.property(propDartDefines)
|
||||
}
|
||||
String bundleSkSLPathValue
|
||||
final String propBundleSkslPath = "bundle-sksl-path"
|
||||
if (project.hasProperty(propBundleSkslPath)) {
|
||||
bundleSkSLPathValue = project.property(propBundleSkslPath)
|
||||
}
|
||||
String performanceMeasurementFileValue
|
||||
final String propPerformanceMeasurementFile = "performance-measurement-file"
|
||||
if (project.hasProperty(propPerformanceMeasurementFile)) {
|
||||
@ -1316,7 +1311,6 @@ class FlutterPlugin implements Plugin<Project> {
|
||||
treeShakeIcons(treeShakeIconsOptionsValue)
|
||||
dartObfuscation(dartObfuscationValue)
|
||||
dartDefines(dartDefinesValue)
|
||||
bundleSkSLPath(bundleSkSLPathValue)
|
||||
performanceMeasurementFile(performanceMeasurementFileValue)
|
||||
codeSizeDirectory(codeSizeDirectoryValue)
|
||||
deferredComponents(deferredComponentsValue)
|
||||
@ -1647,9 +1641,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
||||
@Optional @Input
|
||||
String dartDefines
|
||||
|
||||
@Optional @Input
|
||||
String bundleSkSLPath
|
||||
|
||||
@Optional @Input
|
||||
String codeSizeDirectory
|
||||
|
||||
@ -1740,9 +1731,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
||||
if (dartDefines != null) {
|
||||
args("--DartDefines=${dartDefines}")
|
||||
}
|
||||
if (bundleSkSLPath != null) {
|
||||
args("-dBundleSkSLPath=${bundleSkSLPath}")
|
||||
}
|
||||
if (codeSizeDirectory != null) {
|
||||
args("-dCodeSizeDirectory=${codeSizeDirectory}")
|
||||
}
|
||||
|
@ -653,12 +653,6 @@ class AndroidDevice extends Device {
|
||||
if (debuggingOptions.traceSystrace) ...<String>['--ez', 'trace-systrace', 'true'],
|
||||
if (traceToFile != null) ...<String>['--es', 'trace-to-file', traceToFile],
|
||||
if (debuggingOptions.endlessTraceBuffer) ...<String>['--ez', 'endless-trace-buffer', 'true'],
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation) ...<String>[
|
||||
'--ez',
|
||||
'dump-skp-on-shader-compilation',
|
||||
'true',
|
||||
],
|
||||
if (debuggingOptions.cacheSkSL) ...<String>['--ez', 'cache-sksl', 'true'],
|
||||
if (debuggingOptions.purgePersistentCache) ...<String>[
|
||||
'--ez',
|
||||
'purge-persistent-cache',
|
||||
|
@ -47,11 +47,6 @@ class CommandHelp {
|
||||
'debugDumpLayerTree',
|
||||
);
|
||||
|
||||
late final CommandHelpOption M = _makeOption(
|
||||
'M',
|
||||
'Write SkSL shaders to a unique file in the project directory.',
|
||||
);
|
||||
|
||||
late final CommandHelpOption P = _makeOption(
|
||||
'P',
|
||||
'Toggle performance overlay.',
|
||||
|
@ -35,7 +35,6 @@ class BuildInfo {
|
||||
this.splitDebugInfoPath,
|
||||
this.dartObfuscation = false,
|
||||
List<String>? dartDefines,
|
||||
this.bundleSkSLPath,
|
||||
List<String>? dartExperiments,
|
||||
required this.treeShakeIcons,
|
||||
this.performanceMeasurementFile,
|
||||
@ -118,11 +117,6 @@ class BuildInfo {
|
||||
/// Whether to apply dart source code obfuscation.
|
||||
final bool dartObfuscation;
|
||||
|
||||
/// An optional path to a JSON containing object SkSL shaders.
|
||||
///
|
||||
/// Currently this is only supported for Android builds.
|
||||
final String? bundleSkSLPath;
|
||||
|
||||
/// Additional constant values to be made available in the Dart program.
|
||||
///
|
||||
/// These values can be used with the const `fromEnvironment` constructors of
|
||||
@ -294,7 +288,6 @@ class BuildInfo {
|
||||
if (splitDebugInfoPath != null) kSplitDebugInfo: splitDebugInfoPath!,
|
||||
kTrackWidgetCreation: trackWidgetCreation.toString(),
|
||||
kIconTreeShakerFlag: treeShakeIcons.toString(),
|
||||
if (bundleSkSLPath != null) kBundleSkSLPath: bundleSkSLPath!,
|
||||
if (codeSizeDirectory != null) kCodeSizeDirectory: codeSizeDirectory!,
|
||||
if (fileSystemRoots.isNotEmpty) kFileSystemRoots: fileSystemRoots.join(','),
|
||||
if (fileSystemScheme != null) kFileSystemScheme: fileSystemScheme!,
|
||||
@ -323,7 +316,6 @@ class BuildInfo {
|
||||
'TREE_SHAKE_ICONS': treeShakeIcons.toString(),
|
||||
if (performanceMeasurementFile != null)
|
||||
'PERFORMANCE_MEASUREMENT_FILE': performanceMeasurementFile!,
|
||||
if (bundleSkSLPath != null) 'BUNDLE_SKSL_PATH': bundleSkSLPath!,
|
||||
'PACKAGE_CONFIG': packageConfigPath,
|
||||
if (codeSizeDirectory != null) 'CODE_SIZE_DIRECTORY': codeSizeDirectory!,
|
||||
if (flavor != null) 'FLAVOR': flavor!,
|
||||
@ -348,7 +340,6 @@ class BuildInfo {
|
||||
'-Ptree-shake-icons=$treeShakeIcons',
|
||||
if (performanceMeasurementFile != null)
|
||||
'-Pperformance-measurement-file=$performanceMeasurementFile',
|
||||
if (bundleSkSLPath != null) '-Pbundle-sksl-path=$bundleSkSLPath',
|
||||
if (codeSizeDirectory != null) '-Pcode-size-directory=$codeSizeDirectory',
|
||||
for (final String projectArg in androidProjectArgs) '-P$projectArg',
|
||||
];
|
||||
@ -975,9 +966,6 @@ const String kIconTreeShakerFlag = 'TreeShakeIcons';
|
||||
/// Controls whether a web build should use local canvaskit or the CDN
|
||||
const String kUseLocalCanvasKitFlag = 'UseLocalCanvasKit';
|
||||
|
||||
/// The input key for an SkSL bundle path.
|
||||
const String kBundleSkSLPath = 'BundleSkSLPath';
|
||||
|
||||
/// The define to pass build name
|
||||
const String kBuildName = 'BuildName';
|
||||
|
||||
|
@ -8,9 +8,7 @@ import '../../artifacts.dart';
|
||||
import '../../asset.dart';
|
||||
import '../../base/common.dart';
|
||||
import '../../base/file_system.dart';
|
||||
import '../../base/logger.dart';
|
||||
import '../../build_info.dart';
|
||||
import '../../convert.dart';
|
||||
import '../../dart/package_map.dart';
|
||||
import '../../devfs.dart';
|
||||
import '../../flutter_manifest.dart';
|
||||
@ -42,17 +40,6 @@ Future<Depfile> copyAssets(
|
||||
List<File> additionalInputs = const <File>[],
|
||||
String? flavor,
|
||||
}) async {
|
||||
// Check for an SkSL bundle.
|
||||
final String? shaderBundlePath =
|
||||
environment.defines[kBundleSkSLPath] ?? environment.inputs[kBundleSkSLPath];
|
||||
final DevFSContent? skslBundle = processSkSLBundle(
|
||||
shaderBundlePath,
|
||||
engineVersion: environment.engineVersion,
|
||||
fileSystem: environment.fileSystem,
|
||||
logger: environment.logger,
|
||||
targetPlatform: targetPlatform,
|
||||
);
|
||||
|
||||
final File pubspecFile = environment.projectDir.childFile('pubspec.yaml');
|
||||
// Only the default asset bundle style is supported in assemble.
|
||||
final AssetBundle assetBundle =
|
||||
@ -121,12 +108,6 @@ Future<Depfile> copyAssets(
|
||||
),
|
||||
);
|
||||
}),
|
||||
if (skslBundle != null)
|
||||
kSkSLShaderBundlePath: AssetBundleEntry(
|
||||
skslBundle,
|
||||
kind: AssetKind.regular,
|
||||
transformers: const <AssetTransformerEntry>[],
|
||||
),
|
||||
};
|
||||
|
||||
await Future.wait<void>(
|
||||
@ -262,85 +243,9 @@ Future<Depfile> copyAssets(
|
||||
);
|
||||
}
|
||||
final Depfile depfile = Depfile(inputs + assetBundle.additionalDependencies, outputs);
|
||||
if (shaderBundlePath != null) {
|
||||
final File skSLBundleFile = environment.fileSystem.file(shaderBundlePath).absolute;
|
||||
depfile.inputs.add(skSLBundleFile);
|
||||
}
|
||||
return depfile;
|
||||
}
|
||||
|
||||
/// The path of the SkSL JSON bundle included in flutter_assets.
|
||||
const String kSkSLShaderBundlePath = 'io.flutter.shaders.json';
|
||||
|
||||
/// Validate and process an SkSL asset bundle in a [DevFSContent].
|
||||
///
|
||||
/// Returns `null` if the bundle was not provided, otherwise attempts to
|
||||
/// validate the bundle.
|
||||
///
|
||||
/// Throws [Exception] if the bundle is invalid due to formatting issues.
|
||||
///
|
||||
/// If the current target platform is different than the platform constructed
|
||||
/// for the bundle, a warning will be printed.
|
||||
DevFSContent? processSkSLBundle(
|
||||
String? bundlePath, {
|
||||
required TargetPlatform targetPlatform,
|
||||
required FileSystem fileSystem,
|
||||
required Logger logger,
|
||||
String? engineVersion,
|
||||
}) {
|
||||
if (bundlePath == null) {
|
||||
return null;
|
||||
}
|
||||
// Step 1: check that file exists.
|
||||
final File skSLBundleFile = fileSystem.file(bundlePath);
|
||||
if (!skSLBundleFile.existsSync()) {
|
||||
logger.printError('$bundlePath does not exist.');
|
||||
throw Exception('SkSL bundle was invalid.');
|
||||
}
|
||||
|
||||
// Step 2: validate top level bundle structure.
|
||||
Map<String, Object?>? bundle;
|
||||
try {
|
||||
final Object? rawBundle = json.decode(skSLBundleFile.readAsStringSync());
|
||||
if (rawBundle is Map<String, Object?>) {
|
||||
bundle = rawBundle;
|
||||
} else {
|
||||
logger.printError('"$bundle" was not a JSON object: $rawBundle');
|
||||
throw Exception('SkSL bundle was invalid.');
|
||||
}
|
||||
} on FormatException catch (err) {
|
||||
logger.printError('"$bundle" was not a JSON object: $err');
|
||||
throw Exception('SkSL bundle was invalid.');
|
||||
}
|
||||
// Step 3: Validate that:
|
||||
// * The engine revision the bundle was compiled with
|
||||
// is the same as the current revision.
|
||||
// * The target platform is the same (this one is a warning only).
|
||||
final String? bundleEngineRevision = bundle['engineRevision'] as String?;
|
||||
if (bundleEngineRevision != engineVersion) {
|
||||
logger.printError(
|
||||
'Expected Flutter $bundleEngineRevision, but found $engineVersion\n'
|
||||
'The SkSL bundle was produced with a different engine version. It must '
|
||||
'be recreated for the current Flutter version.',
|
||||
);
|
||||
throw Exception('SkSL bundle was invalid');
|
||||
}
|
||||
|
||||
final TargetPlatform? bundlePlatform = switch (bundle['platform'] as String?) {
|
||||
final String platform => getTargetPlatformForName(platform),
|
||||
null => null,
|
||||
};
|
||||
|
||||
if (bundlePlatform != targetPlatform) {
|
||||
logger.printError(
|
||||
'The SkSL bundle was created for $bundlePlatform, but the current '
|
||||
'platform is $targetPlatform. This may lead to less efficient shader '
|
||||
'caching.',
|
||||
);
|
||||
}
|
||||
return DevFSStringContent(json.encode(<String, Object?>{'data': bundle['data']}));
|
||||
}
|
||||
|
||||
/// Copy the assets defined in the flutter manifest into a build directory.
|
||||
class CopyAssets extends Target {
|
||||
const CopyAssets();
|
||||
|
@ -29,7 +29,6 @@ class BuildApkCommand extends BuildSubCommand {
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
|
@ -32,7 +32,6 @@ class BuildAppBundleCommand extends BuildSubCommand {
|
||||
addDartObfuscationOption();
|
||||
usesDartDefineOption();
|
||||
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
usesTrackWidgetCreation(verboseHelp: verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
|
@ -677,7 +677,6 @@ abstract class _BuildIOSSubCommand extends BuildSubCommand {
|
||||
usesExtraDartFlagOptions(verboseHelp: verboseHelp);
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
usesAnalyzeSizeFlag();
|
||||
argParser.addFlag(
|
||||
|
@ -154,12 +154,6 @@ class DriveCommand extends RunCommandBase {
|
||||
'Location of the Chrome binary. '
|
||||
'Works only if "browser-name" is set to "chrome".',
|
||||
)
|
||||
..addOption(
|
||||
'write-sksl-on-exit',
|
||||
help:
|
||||
'Attempts to write an SkSL file when the drive process is finished '
|
||||
'to the provided file, overwriting it if necessary.',
|
||||
)
|
||||
..addMultiOption(
|
||||
'test-arguments',
|
||||
help:
|
||||
@ -381,11 +375,7 @@ class DriveCommand extends RunCommandBase {
|
||||
if (boolArg('keep-app-running')) {
|
||||
_logger.printStatus('Leaving the application running.');
|
||||
} else {
|
||||
final File? skslFile =
|
||||
stringArg('write-sksl-on-exit') != null
|
||||
? _fileSystem.file(stringArg('write-sksl-on-exit'))
|
||||
: null;
|
||||
await driverService.stop(userIdentifier: userIdentifier, writeSkslOnExit: skslFile);
|
||||
await driverService.stop(userIdentifier: userIdentifier);
|
||||
}
|
||||
if (testResult != 0) {
|
||||
throwToolExit(null);
|
||||
|
@ -38,7 +38,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
usesFlavorOption();
|
||||
usesWebResourcesCdnFlag();
|
||||
addNativeNullAssertions(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
usesApplicationBinaryOption();
|
||||
argParser
|
||||
..addFlag(
|
||||
@ -61,20 +60,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
negatable: false,
|
||||
help: 'Include verbose logging from the Flutter engine.',
|
||||
)
|
||||
..addFlag(
|
||||
'cache-sksl',
|
||||
negatable: false,
|
||||
help: 'Cache the shader in the SkSL format instead of in binary or GLSL formats.',
|
||||
)
|
||||
..addFlag(
|
||||
'dump-skp-on-shader-compilation',
|
||||
negatable: false,
|
||||
help:
|
||||
'Automatically dump the skp that triggers new shader compilations. '
|
||||
'This is useful for writing custom ShaderWarmUp to reduce jank. '
|
||||
'By default, this is not enabled as it introduces significant overhead. '
|
||||
'This is only available in profile or debug builds.',
|
||||
)
|
||||
..addFlag(
|
||||
'purge-persistent-cache',
|
||||
negatable: false,
|
||||
@ -240,8 +225,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
|
||||
bool get traceStartup => boolArg('trace-startup');
|
||||
bool get enableDartProfiling => boolArg('enable-dart-profiling');
|
||||
bool get cacheSkSL => boolArg('cache-sksl');
|
||||
bool get dumpSkpOnShaderCompilation => boolArg('dump-skp-on-shader-compilation');
|
||||
bool get purgePersistentCache => boolArg('purge-persistent-cache');
|
||||
bool get disableServiceAuthCodes => boolArg('disable-service-auth-codes');
|
||||
bool get cacheStartupProfile => boolArg('cache-startup-profile');
|
||||
@ -344,8 +327,6 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
|
||||
traceSystrace: boolArg('trace-systrace'),
|
||||
traceToFile: stringArg('trace-to-file'),
|
||||
endlessTraceBuffer: boolArg('endless-trace-buffer'),
|
||||
dumpSkpOnShaderCompilation: dumpSkpOnShaderCompilation,
|
||||
cacheSkSL: cacheSkSL,
|
||||
purgePersistentCache: purgePersistentCache,
|
||||
deviceVmServicePort: deviceVmservicePort,
|
||||
hostVmServicePort: hostVmservicePort,
|
||||
|
@ -291,8 +291,6 @@ class CustomDeviceAppSession {
|
||||
if (debuggingOptions.traceSystrace) 'trace-systrace=true',
|
||||
if (debuggingOptions.traceToFile != null) 'trace-to-file=${debuggingOptions.traceToFile}',
|
||||
if (debuggingOptions.endlessTraceBuffer) 'endless-trace-buffer=true',
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation) 'dump-skp-on-shader-compilation=true',
|
||||
if (debuggingOptions.cacheSkSL) 'cache-sksl=true',
|
||||
if (debuggingOptions.purgePersistentCache) 'purge-persistent-cache=true',
|
||||
if (debuggingOptions.debuggingEnabled) ...<String>[
|
||||
if (debuggingOptions.deviceVmServicePort != null)
|
||||
|
@ -285,12 +285,6 @@ abstract class DesktopDevice extends Device {
|
||||
if (debuggingOptions.endlessTraceBuffer) {
|
||||
addFlag('endless-trace-buffer=true');
|
||||
}
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation) {
|
||||
addFlag('dump-skp-on-shader-compilation=true');
|
||||
}
|
||||
if (debuggingOptions.cacheSkSL) {
|
||||
addFlag('cache-sksl=true');
|
||||
}
|
||||
if (debuggingOptions.purgePersistentCache) {
|
||||
addFlag('purge-persistent-cache=true');
|
||||
}
|
||||
|
@ -938,8 +938,6 @@ class DebuggingOptions {
|
||||
this.traceSystrace = false,
|
||||
this.traceToFile,
|
||||
this.endlessTraceBuffer = false,
|
||||
this.dumpSkpOnShaderCompilation = false,
|
||||
this.cacheSkSL = false,
|
||||
this.purgePersistentCache = false,
|
||||
this.useTestFonts = false,
|
||||
this.verboseSystemLogs = false,
|
||||
@ -1001,7 +999,6 @@ class DebuggingOptions {
|
||||
this.webHeaders = const <String, String>{},
|
||||
WebRendererMode? webRenderer,
|
||||
this.webUseWasm = false,
|
||||
this.cacheSkSL = false,
|
||||
this.traceAllowlist,
|
||||
this.enableImpeller = ImpellerStatus.platformDefault,
|
||||
this.enableVulkanValidation = false,
|
||||
@ -1024,7 +1021,6 @@ class DebuggingOptions {
|
||||
traceSystrace = false,
|
||||
traceToFile = null,
|
||||
endlessTraceBuffer = false,
|
||||
dumpSkpOnShaderCompilation = false,
|
||||
purgePersistentCache = false,
|
||||
verboseSystemLogs = false,
|
||||
hostVmServicePort = null,
|
||||
@ -1061,8 +1057,6 @@ class DebuggingOptions {
|
||||
required this.traceSystrace,
|
||||
required this.traceToFile,
|
||||
required this.endlessTraceBuffer,
|
||||
required this.dumpSkpOnShaderCompilation,
|
||||
required this.cacheSkSL,
|
||||
required this.purgePersistentCache,
|
||||
required this.useTestFonts,
|
||||
required this.verboseSystemLogs,
|
||||
@ -1122,8 +1116,6 @@ class DebuggingOptions {
|
||||
final bool traceSystrace;
|
||||
final String? traceToFile;
|
||||
final bool endlessTraceBuffer;
|
||||
final bool dumpSkpOnShaderCompilation;
|
||||
final bool cacheSkSL;
|
||||
final bool purgePersistentCache;
|
||||
final bool useTestFonts;
|
||||
final bool verboseSystemLogs;
|
||||
@ -1231,9 +1223,7 @@ class DebuggingOptions {
|
||||
if (traceAllowlist != null) '--trace-allowlist="$traceAllowlist"',
|
||||
if (traceSkiaAllowlist != null) '--trace-skia-allowlist="$traceSkiaAllowlist"',
|
||||
if (endlessTraceBuffer) '--endless-trace-buffer',
|
||||
if (dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
|
||||
if (verboseSystemLogs) '--verbose-logging',
|
||||
if (cacheSkSL) '--cache-sksl',
|
||||
if (purgePersistentCache) '--purge-persistent-cache',
|
||||
if (route != null) '--route=$route',
|
||||
if (platformArgs['trace-startup'] as bool? ?? false) '--trace-startup',
|
||||
@ -1268,8 +1258,6 @@ class DebuggingOptions {
|
||||
'traceSystrace': traceSystrace,
|
||||
'traceToFile': traceToFile,
|
||||
'endlessTraceBuffer': endlessTraceBuffer,
|
||||
'dumpSkpOnShaderCompilation': dumpSkpOnShaderCompilation,
|
||||
'cacheSkSL': cacheSkSL,
|
||||
'purgePersistentCache': purgePersistentCache,
|
||||
'useTestFonts': useTestFonts,
|
||||
'verboseSystemLogs': verboseSystemLogs,
|
||||
@ -1313,6 +1301,10 @@ class DebuggingOptions {
|
||||
// the flutter_tools binary that is currently checked into Google3.
|
||||
// Remove this when that binary has been updated.
|
||||
'webUseLocalCanvaskit': false,
|
||||
// See above: these fields are required for backwards compatibility
|
||||
// with the google3 checked in binary.
|
||||
'dumpSkpOnShaderCompilation': false,
|
||||
'cacheSkSL': false,
|
||||
};
|
||||
|
||||
static DebuggingOptions fromJson(Map<String, Object?> json, BuildInfo buildInfo) =>
|
||||
@ -1333,8 +1325,6 @@ class DebuggingOptions {
|
||||
traceSystrace: json['traceSystrace']! as bool,
|
||||
traceToFile: json['traceToFile'] as String?,
|
||||
endlessTraceBuffer: json['endlessTraceBuffer']! as bool,
|
||||
dumpSkpOnShaderCompilation: json['dumpSkpOnShaderCompilation']! as bool,
|
||||
cacheSkSL: json['cacheSkSL']! as bool,
|
||||
purgePersistentCache: json['purgePersistentCache']! as bool,
|
||||
useTestFonts: json['useTestFonts']! as bool,
|
||||
verboseSystemLogs: json['verboseSystemLogs']! as bool,
|
||||
|
@ -18,7 +18,6 @@ import '../base/process.dart';
|
||||
import '../build_info.dart';
|
||||
import '../device.dart';
|
||||
import '../resident_runner.dart';
|
||||
import '../sksl_writer.dart';
|
||||
import '../vmservice.dart';
|
||||
import 'web_driver_service.dart';
|
||||
|
||||
@ -102,11 +101,7 @@ abstract class DriverService {
|
||||
});
|
||||
|
||||
/// Stop the running application and uninstall it from the device.
|
||||
///
|
||||
/// If [writeSkslOnExit] is non-null, will connect to the VM Service
|
||||
/// and write SkSL to the file. This is only supported on mobile and
|
||||
/// desktop devices.
|
||||
Future<void> stop({File? writeSkslOnExit, String? userIdentifier});
|
||||
Future<void> stop({String? userIdentifier});
|
||||
}
|
||||
|
||||
/// An implementation of the driver service that connects to mobile and desktop
|
||||
@ -269,12 +264,7 @@ class FlutterDriverService extends DriverService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> stop({File? writeSkslOnExit, String? userIdentifier}) async {
|
||||
if (writeSkslOnExit != null) {
|
||||
final FlutterView flutterView = (await _vmService.getFlutterViews()).first;
|
||||
final Map<String, Object?>? result = await _vmService.getSkSLs(viewId: flutterView.id);
|
||||
await sharedSkSlWriter(_device!, result, outputFile: writeSkslOnExit, logger: _logger);
|
||||
}
|
||||
Future<void> stop({String? userIdentifier}) async {
|
||||
// If the application package is available, stop and uninstall.
|
||||
final ApplicationPackage? package = _applicationPackage;
|
||||
if (package != null) {
|
||||
|
@ -207,7 +207,7 @@ class WebDriverService extends DriverService {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> stop({File? writeSkslOnExit, String? userIdentifier}) async {
|
||||
Future<void> stop({String? userIdentifier}) async {
|
||||
final bool appDidFinishPrematurely = _runResult != null;
|
||||
await _residentRunner.exitApp();
|
||||
await _residentRunner.cleanupAtFinish();
|
||||
|
@ -140,9 +140,6 @@ class ResidentWebRunner extends ResidentRunner {
|
||||
/// WebServer device is debuggable when running with --start-paused.
|
||||
bool get deviceIsDebuggable => device!.device is! WebServerDevice || debuggingOptions.startPaused;
|
||||
|
||||
@override
|
||||
bool get supportsWriteSkSL => false;
|
||||
|
||||
@override
|
||||
// Web uses a different plugin registry.
|
||||
bool get generateDartPluginRegistry => false;
|
||||
|
@ -39,7 +39,6 @@ import 'project.dart';
|
||||
import 'resident_devtools_handler.dart';
|
||||
import 'run_cold.dart';
|
||||
import 'run_hot.dart';
|
||||
import 'sksl_writer.dart';
|
||||
import 'vmservice.dart';
|
||||
import 'web/chrome.dart';
|
||||
|
||||
@ -260,7 +259,6 @@ class FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
int? hostVmServicePort,
|
||||
@ -336,7 +334,6 @@ class FlutterDevice {
|
||||
reloadSources: reloadSources,
|
||||
restart: restart,
|
||||
compileExpression: compileExpression,
|
||||
getSkSLMethod: getSkSLMethod,
|
||||
flutterProject: FlutterProject.current(),
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
device: device,
|
||||
@ -629,9 +626,6 @@ abstract class ResidentHandlers {
|
||||
/// before enabling it.
|
||||
bool get supportsRestart;
|
||||
|
||||
/// Whether all of the connected devices support gathering SkSL.
|
||||
bool get supportsWriteSkSL;
|
||||
|
||||
/// Whether all of the connected devices support hot reload.
|
||||
bool get canHotReload;
|
||||
|
||||
@ -892,21 +886,6 @@ abstract class ResidentHandlers {
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Write the SkSL shaders to a zip file in build directory.
|
||||
///
|
||||
/// Returns the name of the file, or `null` on failures.
|
||||
Future<String?> writeSkSL() async {
|
||||
if (!supportsWriteSkSL) {
|
||||
throw Exception('writeSkSL is not supported by this runner.');
|
||||
}
|
||||
final FlutterDevice flutterDevice = flutterDevices.first!;
|
||||
final FlutterVmService vmService = flutterDevice.vmService!;
|
||||
final List<FlutterView> views = await vmService.getFlutterViews();
|
||||
final Map<String, Object?>? data = await vmService.getSkSLs(viewId: views.first.id);
|
||||
final Device device = flutterDevice.device!;
|
||||
return sharedSkSlWriter(device, data);
|
||||
}
|
||||
|
||||
/// Take a screenshot on the provided [device].
|
||||
///
|
||||
/// If the device has a connected vmservice, this method will attempt to hide
|
||||
@ -1144,9 +1123,6 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
@override
|
||||
bool get supportsServiceProtocol => isRunningDebug || isRunningProfile;
|
||||
|
||||
@override
|
||||
bool get supportsWriteSkSL => supportsServiceProtocol;
|
||||
|
||||
bool get trackWidgetCreation => debuggingOptions.buildInfo.trackWidgetCreation;
|
||||
|
||||
/// True if the shared Dart plugin registry (which is different than the one
|
||||
@ -1345,7 +1321,6 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
required bool allowExistingDdsInstance,
|
||||
}) async {
|
||||
if (!debuggingOptions.debuggingEnabled) {
|
||||
@ -1361,7 +1336,6 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
compileExpression: compileExpression,
|
||||
allowExistingDdsInstance: allowExistingDdsInstance,
|
||||
hostVmServicePort: debuggingOptions.hostVmServicePort,
|
||||
getSkSLMethod: getSkSLMethod,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLog,
|
||||
);
|
||||
await device.vmService!.getFlutterViews();
|
||||
@ -1522,9 +1496,6 @@ abstract class ResidentRunner extends ResidentHandlers {
|
||||
// Performance related features: `P` should precede `a`, which should precede `M`.
|
||||
commandHelp.P.print();
|
||||
commandHelp.a.print();
|
||||
if (supportsWriteSkSL) {
|
||||
commandHelp.M.print();
|
||||
}
|
||||
if (isRunningDebug) {
|
||||
commandHelp.g.print();
|
||||
}
|
||||
@ -1722,12 +1693,6 @@ class TerminalHandler {
|
||||
case 'o':
|
||||
case 'O':
|
||||
return residentRunner.debugTogglePlatform();
|
||||
case 'M':
|
||||
if (residentRunner.supportsWriteSkSL) {
|
||||
await residentRunner.writeSkSL();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
case 'p':
|
||||
return residentRunner.debugToggleDebugPaintSizeEnabled();
|
||||
case 'P':
|
||||
|
@ -144,10 +144,7 @@ class ColdRunner extends ResidentRunner {
|
||||
}) async {
|
||||
_didAttach = true;
|
||||
try {
|
||||
await connectToServiceProtocol(
|
||||
getSkSLMethod: writeSkSL,
|
||||
allowExistingDdsInstance: allowExistingDdsInstance,
|
||||
);
|
||||
await connectToServiceProtocol(allowExistingDdsInstance: allowExistingDdsInstance);
|
||||
} on Exception catch (error) {
|
||||
globals.printError('Error connecting to the service protocol: $error');
|
||||
return 2;
|
||||
|
@ -253,7 +253,6 @@ class HotRunner extends ResidentRunner {
|
||||
reloadSources: _reloadSourcesService,
|
||||
restart: _restartService,
|
||||
compileExpression: _compileExpressionService,
|
||||
getSkSLMethod: writeSkSL,
|
||||
allowExistingDdsInstance: allowExistingDdsInstance,
|
||||
);
|
||||
// Catches all exceptions, non-Exception objects are rethrown.
|
||||
|
@ -130,7 +130,6 @@ abstract final class FlutterOptions {
|
||||
static const String kDartObfuscationOption = 'obfuscate';
|
||||
static const String kDartDefinesOption = 'dart-define';
|
||||
static const String kDartDefineFromFileOption = 'dart-define-from-file';
|
||||
static const String kBundleSkSLPathOption = 'bundle-sksl-path';
|
||||
static const String kPerformanceMeasurementFile = 'performance-measurement-file';
|
||||
static const String kNullSafety = 'sound-null-safety';
|
||||
static const String kDeviceUser = 'device-user';
|
||||
@ -938,18 +937,6 @@ abstract class FlutterCommand extends Command<void> {
|
||||
);
|
||||
}
|
||||
|
||||
void addBundleSkSLPathOption({required bool hide}) {
|
||||
argParser.addOption(
|
||||
FlutterOptions.kBundleSkSLPathOption,
|
||||
help:
|
||||
'A path to a file containing precompiled SkSL shaders generated '
|
||||
'during "flutter run". These can be included in an application to '
|
||||
'improve the first frame render times.',
|
||||
hide: hide,
|
||||
valueHelp: 'flutter_1.sksl',
|
||||
);
|
||||
}
|
||||
|
||||
void addTreeShakeIconsFlag({bool? enabledByDefault}) {
|
||||
argParser.addFlag(
|
||||
'tree-shake-icons',
|
||||
@ -1142,7 +1129,6 @@ abstract class FlutterCommand extends Command<void> {
|
||||
void addCommonDesktopBuildOptions({required bool verboseHelp}) {
|
||||
addBuildModeFlags(verboseHelp: verboseHelp);
|
||||
addBuildPerformanceFile(hide: !verboseHelp);
|
||||
addBundleSkSLPathOption(hide: !verboseHelp);
|
||||
addDartObfuscationOption();
|
||||
addEnableExperimentation(hide: !verboseHelp);
|
||||
addNullSafetyModeOptions(hide: !verboseHelp);
|
||||
@ -1417,15 +1403,6 @@ abstract class FlutterCommand extends Command<void> {
|
||||
buildMode.isPrecompiled &&
|
||||
boolArg('tree-shake-icons');
|
||||
|
||||
final String? bundleSkSLPath =
|
||||
argParser.options.containsKey(FlutterOptions.kBundleSkSLPathOption)
|
||||
? stringArg(FlutterOptions.kBundleSkSLPathOption)
|
||||
: null;
|
||||
|
||||
if (bundleSkSLPath != null && !globals.fs.isFileSync(bundleSkSLPath)) {
|
||||
throwToolExit('No SkSL shader bundle found at $bundleSkSLPath.');
|
||||
}
|
||||
|
||||
final String? performanceMeasurementFile =
|
||||
argParser.options.containsKey(FlutterOptions.kPerformanceMeasurementFile)
|
||||
? stringArg(FlutterOptions.kPerformanceMeasurementFile)
|
||||
@ -1479,7 +1456,6 @@ abstract class FlutterCommand extends Command<void> {
|
||||
splitDebugInfoPath: splitDebugInfoPath,
|
||||
dartObfuscation: dartObfuscation,
|
||||
dartDefines: dartDefines,
|
||||
bundleSkSLPath: bundleSkSLPath,
|
||||
dartExperiments: experiments,
|
||||
performanceMeasurementFile: performanceMeasurementFile,
|
||||
packageConfigPath: packagesPath ?? packageConfigFile.path,
|
||||
|
@ -1,67 +0,0 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
|
||||
import 'base/file_system.dart';
|
||||
import 'base/logger.dart';
|
||||
import 'build_info.dart';
|
||||
import 'convert.dart';
|
||||
import 'device.dart';
|
||||
import 'globals.dart' as globals;
|
||||
|
||||
Future<String?> sharedSkSlWriter(
|
||||
Device device,
|
||||
Map<String, Object?>? data, {
|
||||
File? outputFile,
|
||||
Logger? logger,
|
||||
}) async {
|
||||
logger ??= globals.logger;
|
||||
if (data == null || data.isEmpty) {
|
||||
logger.printStatus(
|
||||
'No data was received. To ensure SkSL data can be generated use a '
|
||||
'physical device then:\n'
|
||||
' 1. Pass "--cache-sksl" as an argument to flutter run.\n'
|
||||
' 2. Interact with the application to force shaders to be compiled.\n',
|
||||
);
|
||||
return null;
|
||||
}
|
||||
if (outputFile == null) {
|
||||
outputFile = globals.fsUtils.getUniqueFile(globals.fs.currentDirectory, 'flutter', 'sksl.json');
|
||||
} else if (!outputFile.parent.existsSync()) {
|
||||
outputFile.parent.createSync(recursive: true);
|
||||
}
|
||||
// Convert android sub-platforms to single target platform.
|
||||
TargetPlatform targetPlatform = await device.targetPlatform;
|
||||
switch (targetPlatform) {
|
||||
case TargetPlatform.android_arm:
|
||||
case TargetPlatform.android_arm64:
|
||||
case TargetPlatform.android_x64:
|
||||
case TargetPlatform.android_x86:
|
||||
targetPlatform = TargetPlatform.android;
|
||||
case TargetPlatform.android:
|
||||
case TargetPlatform.darwin:
|
||||
case TargetPlatform.ios:
|
||||
case TargetPlatform.fuchsia_arm64:
|
||||
case TargetPlatform.fuchsia_x64:
|
||||
case TargetPlatform.linux_arm64:
|
||||
case TargetPlatform.linux_x64:
|
||||
case TargetPlatform.tester:
|
||||
case TargetPlatform.web_javascript:
|
||||
case TargetPlatform.windows_x64:
|
||||
case TargetPlatform.windows_arm64:
|
||||
break;
|
||||
}
|
||||
final Map<String, Object> manifest = <String, Object>{
|
||||
'platform': getNameForTargetPlatform(targetPlatform),
|
||||
'name': device.name,
|
||||
'engineRevision': globals.flutterVersion.engineRevision,
|
||||
'data': data,
|
||||
};
|
||||
outputFile.writeAsStringSync(json.encode(manifest));
|
||||
logger.printStatus('Wrote SkSL data to ${outputFile.path}.');
|
||||
return outputFile.path;
|
||||
}
|
@ -23,7 +23,6 @@ const String kResultType = 'type';
|
||||
const String kResultTypeSuccess = 'Success';
|
||||
const String kError = 'error';
|
||||
|
||||
const String kGetSkSLsMethod = '_flutter.getSkSLs';
|
||||
const String kSetAssetBundlePathMethod = '_flutter.setAssetBundlePath';
|
||||
const String kFlushUIThreadTasksMethod = '_flutter.flushUIThreadTasks';
|
||||
const String kRunInViewMethod = '_flutter.runInView';
|
||||
@ -38,7 +37,6 @@ const String kHotRestartServiceName = 'hotRestart';
|
||||
const String kFlutterVersionServiceName = 'flutterVersion';
|
||||
const String kCompileExpressionServiceName = 'compileExpression';
|
||||
const String kFlutterMemoryInfoServiceName = 'flutterMemoryInfo';
|
||||
const String kFlutterGetSkSLServiceName = 'flutterGetSkSL';
|
||||
|
||||
/// The error response code from an unrecoverable compilation failure.
|
||||
const int kIsolateReloadBarred = 1005;
|
||||
@ -94,11 +92,6 @@ typedef CompileExpression =
|
||||
bool isStatic,
|
||||
);
|
||||
|
||||
/// A method that pulls an SkSL shader from the device and writes it to a file.
|
||||
///
|
||||
/// The name of the file returned as a result.
|
||||
typedef GetSkSLMethod = Future<String?> Function();
|
||||
|
||||
Future<io.WebSocket> _defaultOpenChannel(
|
||||
String url, {
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
@ -169,7 +162,6 @@ typedef VMServiceConnector =
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression,
|
||||
@ -186,7 +178,6 @@ Future<vm_service.VmService> setUpVmService({
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
Device? device,
|
||||
GetSkSLMethod? skSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required vm_service.VmService vmService,
|
||||
@ -314,24 +305,6 @@ Future<vm_service.VmService> setUpVmService({
|
||||
vmService.registerService(kFlutterMemoryInfoServiceName, kFlutterToolAlias),
|
||||
);
|
||||
}
|
||||
if (skSLMethod != null) {
|
||||
vmService.registerServiceCallback(kFlutterGetSkSLServiceName, (
|
||||
Map<String, Object?> params,
|
||||
) async {
|
||||
final String? filename = await skSLMethod();
|
||||
if (filename == null) {
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{kResultType: kResultTypeSuccess},
|
||||
};
|
||||
}
|
||||
return <String, Object>{
|
||||
'result': <String, Object>{kResultType: kResultTypeSuccess, 'filename': filename},
|
||||
};
|
||||
});
|
||||
registrationRequests.add(
|
||||
vmService.registerService(kFlutterGetSkSLServiceName, kFlutterToolAlias),
|
||||
);
|
||||
}
|
||||
|
||||
if (printStructuredErrorLogMethod != null) {
|
||||
vmService.onExtensionEvent.listen(printStructuredErrorLogMethod);
|
||||
@ -373,7 +346,6 @@ Future<FlutterVmService> connectToVmService(
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
@ -388,7 +360,6 @@ Future<FlutterVmService> connectToVmService(
|
||||
compileExpression: compileExpression,
|
||||
compression: compression,
|
||||
device: device,
|
||||
getSkSLMethod: getSkSLMethod,
|
||||
flutterProject: flutterProject,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
logger: logger,
|
||||
@ -419,7 +390,6 @@ Future<FlutterVmService> _connect(
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
@ -438,7 +408,6 @@ Future<FlutterVmService> _connect(
|
||||
restart: restart,
|
||||
compileExpression: compileExpression,
|
||||
device: device,
|
||||
skSLMethod: getSkSLMethod,
|
||||
flutterProject: flutterProject,
|
||||
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
|
||||
vmService: delegateService,
|
||||
@ -562,21 +531,6 @@ class FlutterVmService {
|
||||
);
|
||||
}
|
||||
|
||||
/// Retrieve the cached SkSL shaders from an attached Flutter view.
|
||||
///
|
||||
/// This method will only return data if `--cache-sksl` was provided as a
|
||||
/// flutter run argument, and only then on physical devices.
|
||||
Future<Map<String, Object?>?> getSkSLs({required String viewId}) async {
|
||||
final vm_service.Response? response = await callMethodWrapper(
|
||||
kGetSkSLsMethod,
|
||||
args: <String, String>{'viewId': viewId},
|
||||
);
|
||||
if (response == null) {
|
||||
return null;
|
||||
}
|
||||
return response.json?['SkSLs'] as Map<String, Object?>?;
|
||||
}
|
||||
|
||||
/// Flush all tasks on the UI thread for an attached Flutter view.
|
||||
///
|
||||
/// This method is currently used only for benchmarking.
|
||||
|
@ -616,7 +616,6 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
||||
setUpMockProjectFilesForBuild();
|
||||
processManager.addCommands(<FakeCommand>[cmakeCommand('release'), ninjaCommand('release')]);
|
||||
fileSystem.file('lib/other.dart').createSync(recursive: true);
|
||||
fileSystem.file('foo/bar.sksl.json').createSync(recursive: true);
|
||||
|
||||
await createTestCommandRunner(command).run(const <String>[
|
||||
'build',
|
||||
@ -630,7 +629,6 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
||||
'--dart-define=foo.bar=2',
|
||||
'--dart-define=fizz.far=3',
|
||||
'--tree-shake-icons',
|
||||
'--bundle-sksl-path=foo/bar.sksl.json',
|
||||
]);
|
||||
|
||||
final File cmakeConfig = fileSystem.currentDirectory
|
||||
@ -663,7 +661,6 @@ ERROR: No file or variants found for asset: images/a_dot_burr.jpeg
|
||||
' "FLUTTER_ROOT=$_kTestFlutterRoot"',
|
||||
' "PROJECT_DIR=${fileSystem.currentDirectory.path}"',
|
||||
' "FLUTTER_TARGET=lib/other.dart"',
|
||||
' "BUNDLE_SKSL_PATH=foo/bar.sksl.json"',
|
||||
]),
|
||||
);
|
||||
},
|
||||
|
@ -460,7 +460,6 @@ STDERR STUFF
|
||||
);
|
||||
createMinimalMockProjectFiles();
|
||||
fileSystem.file('lib/other.dart').createSync(recursive: true);
|
||||
fileSystem.file('foo/bar.sksl.json').createSync(recursive: true);
|
||||
|
||||
await createTestCommandRunner(command).run(const <String>[
|
||||
'build',
|
||||
@ -474,7 +473,6 @@ STDERR STUFF
|
||||
'--dart-define=foo.bar=2',
|
||||
'--dart-define=fizz.far=3',
|
||||
'--tree-shake-icons',
|
||||
'--bundle-sksl-path=foo/bar.sksl.json',
|
||||
]);
|
||||
final List<String> contents =
|
||||
fileSystem.file('./macos/Flutter/ephemeral/Flutter-Generated.xcconfig').readAsLinesSync();
|
||||
@ -494,7 +492,6 @@ STDERR STUFF
|
||||
'SPLIT_DEBUG_INFO=foo/',
|
||||
'TRACK_WIDGET_CREATION=true',
|
||||
'TREE_SHAKE_ICONS=true',
|
||||
'BUNDLE_SKSL_PATH=foo/bar.sksl.json',
|
||||
'PACKAGE_CONFIG=/.dart_tool/package_config.json',
|
||||
'COCOAPODS_PARALLEL_CODE_SIGN=true',
|
||||
]),
|
||||
|
@ -390,7 +390,6 @@ C:\foo\windows\x64\runner\main.cpp(17,1): error C2065: 'Baz': undeclared identif
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
fileSystem.file(fileSystem.path.join('lib', 'other.dart')).createSync(recursive: true);
|
||||
fileSystem.file(fileSystem.path.join('foo', 'bar.sksl.json')).createSync(recursive: true);
|
||||
|
||||
// Relevant portions of an incorrectly generated project, with some
|
||||
// irrelevant details removed for length.
|
||||
@ -533,7 +532,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
buildCommand('Release'),
|
||||
]);
|
||||
fileSystem.file(fileSystem.path.join('lib', 'other.dart')).createSync(recursive: true);
|
||||
fileSystem.file(fileSystem.path.join('foo', 'bar.sksl.json')).createSync(recursive: true);
|
||||
|
||||
await createTestCommandRunner(command).run(const <String>[
|
||||
'windows',
|
||||
@ -545,7 +543,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
r'--split-debug-info=C:\foo\',
|
||||
'--dart-define=foo=a',
|
||||
'--dart-define=bar=b',
|
||||
r'--bundle-sksl-path=foo\bar.sksl.json',
|
||||
r'--target=lib\other.dart',
|
||||
]);
|
||||
|
||||
@ -581,7 +578,6 @@ if %errorlevel% neq 0 goto :VCEnd</Command>
|
||||
r' "FLUTTER_ROOT=C:\\flutter"',
|
||||
r' "PROJECT_DIR=C:\\"',
|
||||
r' "FLUTTER_TARGET=lib\\other.dart"',
|
||||
r' "BUNDLE_SKSL_PATH=foo\\bar.sksl.json"',
|
||||
]),
|
||||
);
|
||||
},
|
||||
|
@ -1309,25 +1309,6 @@ void main() {
|
||||
},
|
||||
);
|
||||
|
||||
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']),
|
||||
throwsToolExit(message: 'No SkSL shader bundle found at foo.json'),
|
||||
);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
Cache: () => Cache.test(processManager: FakeProcessManager.any()),
|
||||
FileSystem: () => MemoryFileSystem.test(),
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
},
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'Configures web connection options to use web sockets by default',
|
||||
() async {
|
||||
|
@ -256,8 +256,6 @@ void main() {
|
||||
'--ez', 'trace-systrace', 'true',
|
||||
'--es', 'trace-to-file', 'path/to/trace.binpb',
|
||||
'--ez', 'endless-trace-buffer', 'true',
|
||||
'--ez', 'dump-skp-on-shader-compilation', 'true',
|
||||
'--ez', 'cache-sksl', 'true',
|
||||
'--ez', 'purge-persistent-cache', 'true',
|
||||
'--ez', 'enable-impeller', 'true',
|
||||
'--ez', 'enable-checked-mode', 'true',
|
||||
@ -289,8 +287,6 @@ void main() {
|
||||
traceSystrace: true,
|
||||
traceToFile: 'path/to/trace.binpb',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
useTestFonts: true,
|
||||
verboseSystemLogs: true,
|
||||
|
@ -40,7 +40,6 @@ void _testMessageLength({
|
||||
|
||||
expect(commandHelp.I.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.L.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.M.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.P.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.R.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
expect(commandHelp.S.toString().length, lessThanOrEqualTo(expectedWidth));
|
||||
@ -89,7 +88,6 @@ void main() {
|
||||
|
||||
expect(commandHelp.I.toString(), startsWith('\x1B[1mI\x1B[22m'));
|
||||
expect(commandHelp.L.toString(), startsWith('\x1B[1mL\x1B[22m'));
|
||||
expect(commandHelp.M.toString(), startsWith('\x1B[1mM\x1B[22m'));
|
||||
expect(commandHelp.P.toString(), startsWith('\x1B[1mP\x1B[22m'));
|
||||
expect(commandHelp.R.toString(), startsWith('\x1B[1mR\x1B[22m'));
|
||||
expect(commandHelp.S.toString(), startsWith('\x1B[1mS\x1B[22m'));
|
||||
@ -196,10 +194,6 @@ void main() {
|
||||
'\x1B[1mL\x1B[22m Dump layer tree to the console. \x1B[90m(debugDumpLayerTree)\x1B[39m\x1B[22m',
|
||||
),
|
||||
);
|
||||
expect(
|
||||
commandHelp.M.toString(),
|
||||
equals('\x1B[1mM\x1B[22m Write SkSL shaders to a unique file in the project directory.'),
|
||||
);
|
||||
expect(
|
||||
commandHelp.P.toString(),
|
||||
equals(
|
||||
@ -304,10 +298,6 @@ void main() {
|
||||
'I Toggle oversized image inversion. (debugInvertOversizedImages)',
|
||||
),
|
||||
);
|
||||
expect(
|
||||
commandHelp.M.toString(),
|
||||
equals('M Write SkSL shaders to a unique file in the project directory.'),
|
||||
);
|
||||
expect(
|
||||
commandHelp.L.toString(),
|
||||
equals(
|
||||
|
@ -232,7 +232,6 @@ void main() {
|
||||
frontendServerStarterPath: 'foo/bar/frontend_server_starter.dart',
|
||||
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
|
||||
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
|
||||
bundleSkSLPath: 'foo/bar/baz.sksl.json',
|
||||
packageConfigPath: 'foo/.dart_tool/package_config.json',
|
||||
codeSizeDirectory: 'foo/code-size',
|
||||
fileSystemRoots: <String>['test5', 'test6'],
|
||||
@ -251,7 +250,6 @@ void main() {
|
||||
'SplitDebugInfo': 'foo/',
|
||||
'TrackWidgetCreation': 'true',
|
||||
'TreeShakeIcons': 'true',
|
||||
'BundleSkSLPath': 'foo/bar/baz.sksl.json',
|
||||
'CodeSizeDirectory': 'foo/code-size',
|
||||
'FileSystemRoots': 'test5,test6',
|
||||
'FileSystemScheme': 'scheme',
|
||||
@ -272,7 +270,6 @@ void main() {
|
||||
frontendServerStarterPath: 'foo/bar/frontend_server_starter.dart',
|
||||
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
|
||||
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
|
||||
bundleSkSLPath: 'foo/bar/baz.sksl.json',
|
||||
packageConfigPath: 'foo/.dart_tool/package_config.json',
|
||||
codeSizeDirectory: 'foo/code-size',
|
||||
// These values are ignored by toEnvironmentConfig
|
||||
@ -288,7 +285,6 @@ void main() {
|
||||
'FRONTEND_SERVER_STARTER_PATH': 'foo/bar/frontend_server_starter.dart',
|
||||
'EXTRA_FRONT_END_OPTIONS': '--enable-experiment=non-nullable,bar',
|
||||
'EXTRA_GEN_SNAPSHOT_OPTIONS': '--enable-experiment=non-nullable,fizz',
|
||||
'BUNDLE_SKSL_PATH': 'foo/bar/baz.sksl.json',
|
||||
'PACKAGE_CONFIG': 'foo/.dart_tool/package_config.json',
|
||||
'CODE_SIZE_DIRECTORY': 'foo/code-size',
|
||||
'FLAVOR': 'strawberry',
|
||||
@ -307,7 +303,6 @@ void main() {
|
||||
frontendServerStarterPath: 'foo/bar/frontend_server_starter.dart',
|
||||
extraFrontEndOptions: <String>['--enable-experiment=non-nullable', 'bar'],
|
||||
extraGenSnapshotOptions: <String>['--enable-experiment=non-nullable', 'fizz'],
|
||||
bundleSkSLPath: 'foo/bar/baz.sksl.json',
|
||||
packageConfigPath: 'foo/.dart_tool/package_config.json',
|
||||
codeSizeDirectory: 'foo/code-size',
|
||||
androidProjectArgs: <String>['foo=bar', 'fizz=bazz'],
|
||||
@ -322,7 +317,6 @@ void main() {
|
||||
'-Psplit-debug-info=foo/',
|
||||
'-Ptrack-widget-creation=true',
|
||||
'-Ptree-shake-icons=true',
|
||||
'-Pbundle-sksl-path=foo/bar/baz.sksl.json',
|
||||
'-Pcode-size-directory=foo/code-size',
|
||||
'-Pfoo=bar',
|
||||
'-Pfizz=bazz',
|
||||
|
@ -12,7 +12,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/android.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
|
||||
import '../../../src/common.dart';
|
||||
import '../../../src/context.dart';
|
||||
@ -84,7 +83,6 @@ void main() {
|
||||
fileSystem.currentDirectory,
|
||||
outputDir: fileSystem.directory('out')..createSync(),
|
||||
defines: <String, String>{kBuildMode: 'debug'},
|
||||
inputs: <String, String>{kBundleSkSLPath: 'bundle.sksl'},
|
||||
processManager: processManager,
|
||||
artifacts: artifacts,
|
||||
fileSystem: fileSystem,
|
||||
@ -92,15 +90,6 @@ void main() {
|
||||
engineVersion: '2',
|
||||
);
|
||||
environment.buildDir.createSync(recursive: true);
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'android',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
}),
|
||||
);
|
||||
|
||||
// create pre-requisites.
|
||||
environment.buildDir.childFile('app.dill').writeAsStringSync('abcd');
|
||||
@ -126,10 +115,6 @@ void main() {
|
||||
fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'kernel_blob.bin')),
|
||||
exists,
|
||||
);
|
||||
expect(
|
||||
fileSystem.file(fileSystem.path.join('out', 'flutter_assets', 'io.flutter.shaders.json')),
|
||||
exists,
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('profile bundle contains expected resources', () async {
|
||||
|
@ -16,8 +16,6 @@ import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/depfile.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/assets.dart';
|
||||
import 'package:flutter_tools/src/cache.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/devfs.dart';
|
||||
import 'package:flutter_tools/src/globals.dart' as globals;
|
||||
|
||||
import '../../../src/common.dart';
|
||||
@ -501,140 +499,4 @@ flutter:
|
||||
ProcessManager: () => FakeProcessManager.any(),
|
||||
},
|
||||
);
|
||||
|
||||
testWithoutContext('processSkSLBundle returns null if there is no path '
|
||||
'to the bundle', () {
|
||||
expect(
|
||||
processSkSLBundle(
|
||||
null,
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
logger: logger,
|
||||
),
|
||||
isNull,
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle throws exception if bundle file is '
|
||||
'missing', () {
|
||||
expect(
|
||||
() => processSkSLBundle(
|
||||
'does_not_exist.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
logger: logger,
|
||||
),
|
||||
throwsException,
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle throws exception if the bundle is not '
|
||||
'valid JSON', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
fileSystem.file('bundle.sksl').writeAsStringSync('{');
|
||||
|
||||
expect(
|
||||
() => processSkSLBundle(
|
||||
'bundle.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
),
|
||||
throwsException,
|
||||
);
|
||||
expect(logger.errorText, contains('was not a JSON object'));
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle throws exception if the bundle is not '
|
||||
'a JSON object', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
fileSystem.file('bundle.sksl').writeAsStringSync('[]');
|
||||
|
||||
expect(
|
||||
() => processSkSLBundle(
|
||||
'bundle.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
),
|
||||
throwsException,
|
||||
);
|
||||
expect(logger.errorText, contains('was not a JSON object'));
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle throws an exception if the engine '
|
||||
'revision is different', () {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(json.encode(<String, String>{'engineRevision': '1'}));
|
||||
|
||||
expect(
|
||||
() => processSkSLBundle(
|
||||
'bundle.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
engineVersion: '2',
|
||||
),
|
||||
throwsException,
|
||||
);
|
||||
expect(logger.errorText, contains('Expected Flutter 1, but found 2'));
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle warns if the bundle target platform is '
|
||||
'different from the current target', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'fuchsia-arm64',
|
||||
'data': <String, Object>{},
|
||||
}),
|
||||
);
|
||||
|
||||
final DevFSContent content =
|
||||
processSkSLBundle(
|
||||
'bundle.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
engineVersion: '2',
|
||||
)!;
|
||||
|
||||
expect(await content.contentsAsBytes(), utf8.encode('{"data":{}}'));
|
||||
expect(logger.errorText, contains('This may lead to less efficient shader caching'));
|
||||
});
|
||||
|
||||
testWithoutContext('processSkSLBundle does not warn and produces bundle', () async {
|
||||
final FileSystem fileSystem = MemoryFileSystem.test();
|
||||
final BufferLogger logger = BufferLogger.test();
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'android',
|
||||
'data': <String, Object>{},
|
||||
}),
|
||||
);
|
||||
|
||||
final DevFSContent content =
|
||||
processSkSLBundle(
|
||||
'bundle.sksl',
|
||||
targetPlatform: TargetPlatform.android,
|
||||
fileSystem: fileSystem,
|
||||
logger: logger,
|
||||
engineVersion: '2',
|
||||
)!;
|
||||
|
||||
expect(await content.contentsAsBytes(), utf8.encode('{"data":{}}'));
|
||||
expect(logger.errorText, isEmpty);
|
||||
});
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/ios.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/reporting/reporting.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
@ -196,7 +195,6 @@ void main() {
|
||||
testUsingContext(
|
||||
'DebugIosApplicationBundle',
|
||||
() async {
|
||||
environment.defines[kBundleSkSLPath] = 'bundle.sksl';
|
||||
environment.defines[kBuildMode] = 'debug';
|
||||
environment.defines[kCodesignIdentity] = 'ABC123';
|
||||
// Precompiled dart data
|
||||
@ -225,16 +223,6 @@ void main() {
|
||||
.childDirectory('App.framework')
|
||||
.childFile('App')
|
||||
.createSync(recursive: true);
|
||||
// sksl bundle
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'ios',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
}),
|
||||
);
|
||||
|
||||
final Directory frameworkDirectory = environment.outputDir.childDirectory('App.framework');
|
||||
final File frameworkDirectoryBinary = frameworkDirectory.childFile('App');
|
||||
@ -271,11 +259,6 @@ void main() {
|
||||
expect(assetDirectory.childFile('AssetManifest.json'), exists);
|
||||
expect(assetDirectory.childFile('vm_snapshot_data'), exists);
|
||||
expect(assetDirectory.childFile('isolate_snapshot_data'), exists);
|
||||
expect(assetDirectory.childFile('io.flutter.shaders.json'), exists);
|
||||
expect(
|
||||
assetDirectory.childFile('io.flutter.shaders.json').readAsStringSync(),
|
||||
'{"data":{"A":"B"}}',
|
||||
);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/common.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/linux.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
|
||||
import '../../../src/common.dart';
|
||||
import '../../../src/context.dart';
|
||||
@ -130,7 +129,6 @@ void main() {
|
||||
final Environment testEnvironment = Environment.test(
|
||||
fileSystem.currentDirectory,
|
||||
defines: <String, String>{kBuildMode: 'debug', kBuildName: '2.0.0', kBuildNumber: '22'},
|
||||
inputs: <String, String>{kBundleSkSLPath: 'bundle.sksl'},
|
||||
artifacts: Artifacts.test(),
|
||||
processManager: FakeProcessManager.any(),
|
||||
fileSystem: fileSystem,
|
||||
@ -143,15 +141,6 @@ void main() {
|
||||
// Create input files.
|
||||
testEnvironment.buildDir.childFile('app.dill').createSync();
|
||||
testEnvironment.buildDir.childFile('native_assets.json').createSync();
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'ios',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
}),
|
||||
);
|
||||
|
||||
await const DebugBundleLinuxAssets(TargetPlatform.linux_x64).build(testEnvironment);
|
||||
|
||||
@ -163,9 +152,6 @@ void main() {
|
||||
final String versionFile = output.childFile('version.json').readAsStringSync();
|
||||
expect(versionFile, contains('"version":"2.0.0"'));
|
||||
expect(versionFile, contains('"build_number":"22"'));
|
||||
// SkSL
|
||||
expect(output.childFile('io.flutter.shaders.json'), exists);
|
||||
expect(output.childFile('io.flutter.shaders.json').readAsStringSync(), '{"data":{"A":"B"}}');
|
||||
|
||||
// No bundled fonts
|
||||
expect(output.childFile('FontManifest.json'), isNot(exists));
|
||||
|
@ -10,7 +10,6 @@ import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/macos.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
|
||||
import '../../../src/common.dart';
|
||||
@ -413,7 +412,6 @@ void main() {
|
||||
artifacts.getArtifactPath(Artifact.flutterMacOSFramework, mode: BuildMode.debug),
|
||||
)
|
||||
.createSync();
|
||||
environment.defines[kBundleSkSLPath] = 'bundle.sksl';
|
||||
fileSystem
|
||||
.file(
|
||||
artifacts.getArtifactPath(
|
||||
@ -433,16 +431,6 @@ void main() {
|
||||
)
|
||||
.createSync(recursive: true);
|
||||
fileSystem.file('${environment.buildDir.path}/App.framework/App').createSync(recursive: true);
|
||||
// sksl bundle
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'ios',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
}),
|
||||
);
|
||||
|
||||
final String inputKernel = '${environment.buildDir.path}/app.dill';
|
||||
fileSystem.file(inputKernel)
|
||||
@ -470,13 +458,6 @@ void main() {
|
||||
fileSystem.file('App.framework/Versions/A/Resources/flutter_assets/isolate_snapshot_data'),
|
||||
exists,
|
||||
);
|
||||
|
||||
final File skslFile = fileSystem.file(
|
||||
'App.framework/Versions/A/Resources/flutter_assets/io.flutter.shaders.json',
|
||||
);
|
||||
|
||||
expect(skslFile, exists);
|
||||
expect(skslFile.readAsStringSync(), '{"data":{"A":"B"}}');
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
|
@ -11,7 +11,6 @@ import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/build_system/build_system.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/common.dart';
|
||||
import 'package:flutter_tools/src/build_system/targets/windows.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
|
||||
import '../../../src/common.dart';
|
||||
import '../../../src/context.dart';
|
||||
@ -157,22 +156,11 @@ void main() {
|
||||
fileSystem: fileSystem,
|
||||
logger: BufferLogger.test(),
|
||||
defines: <String, String>{kBuildMode: 'debug'},
|
||||
inputs: <String, String>{kBundleSkSLPath: 'bundle.sksl'},
|
||||
engineVersion: '2',
|
||||
);
|
||||
|
||||
environment.buildDir.childFile('app.dill').createSync(recursive: true);
|
||||
environment.buildDir.childFile('native_assets.json').createSync(recursive: true);
|
||||
// sksl bundle
|
||||
fileSystem
|
||||
.file('bundle.sksl')
|
||||
.writeAsStringSync(
|
||||
json.encode(<String, Object>{
|
||||
'engineRevision': '2',
|
||||
'platform': 'ios',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
}),
|
||||
);
|
||||
|
||||
await const DebugBundleWindowsAssets(TargetPlatform.windows_x64).build(environment);
|
||||
|
||||
@ -180,11 +168,6 @@ void main() {
|
||||
expect(environment.buildDir.childFile('flutter_assets.d'), exists);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\kernel_blob.bin'), exists);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\AssetManifest.json'), exists);
|
||||
expect(fileSystem.file(r'C:\flutter_assets\io.flutter.shaders.json'), exists);
|
||||
expect(
|
||||
fileSystem.file(r'C:\flutter_assets\io.flutter.shaders.json').readAsStringSync(),
|
||||
'{"data":{"A":"B"}}',
|
||||
);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
|
@ -243,7 +243,6 @@ class TestFlutterDevice extends FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
|
@ -166,18 +166,16 @@ void main() {
|
||||
'FLUTTER_ENGINE_SWITCH_8': 'trace-systrace=true',
|
||||
'FLUTTER_ENGINE_SWITCH_9': 'trace-to-file=path/to/trace.binpb',
|
||||
'FLUTTER_ENGINE_SWITCH_10': 'endless-trace-buffer=true',
|
||||
'FLUTTER_ENGINE_SWITCH_11': 'dump-skp-on-shader-compilation=true',
|
||||
'FLUTTER_ENGINE_SWITCH_12': 'cache-sksl=true',
|
||||
'FLUTTER_ENGINE_SWITCH_13': 'purge-persistent-cache=true',
|
||||
'FLUTTER_ENGINE_SWITCH_14': 'enable-impeller=false',
|
||||
'FLUTTER_ENGINE_SWITCH_15': 'enable-checked-mode=true',
|
||||
'FLUTTER_ENGINE_SWITCH_16': 'verify-entry-points=true',
|
||||
'FLUTTER_ENGINE_SWITCH_17': 'start-paused=true',
|
||||
'FLUTTER_ENGINE_SWITCH_18': 'disable-service-auth-codes=true',
|
||||
'FLUTTER_ENGINE_SWITCH_19': 'dart-flags=--null_assertions',
|
||||
'FLUTTER_ENGINE_SWITCH_20': 'use-test-fonts=true',
|
||||
'FLUTTER_ENGINE_SWITCH_21': 'verbose-logging=true',
|
||||
'FLUTTER_ENGINE_SWITCHES': '21',
|
||||
'FLUTTER_ENGINE_SWITCH_11': 'purge-persistent-cache=true',
|
||||
'FLUTTER_ENGINE_SWITCH_12': 'enable-impeller=false',
|
||||
'FLUTTER_ENGINE_SWITCH_13': 'enable-checked-mode=true',
|
||||
'FLUTTER_ENGINE_SWITCH_14': 'verify-entry-points=true',
|
||||
'FLUTTER_ENGINE_SWITCH_15': 'start-paused=true',
|
||||
'FLUTTER_ENGINE_SWITCH_16': 'disable-service-auth-codes=true',
|
||||
'FLUTTER_ENGINE_SWITCH_17': 'dart-flags=--null_assertions',
|
||||
'FLUTTER_ENGINE_SWITCH_18': 'use-test-fonts=true',
|
||||
'FLUTTER_ENGINE_SWITCH_19': 'verbose-logging=true',
|
||||
'FLUTTER_ENGINE_SWITCHES': '19',
|
||||
},
|
||||
),
|
||||
]);
|
||||
@ -199,8 +197,6 @@ void main() {
|
||||
traceSystrace: true,
|
||||
traceToFile: 'path/to/trace.binpb',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
useTestFonts: true,
|
||||
verboseSystemLogs: true,
|
||||
@ -225,9 +221,8 @@ void main() {
|
||||
'FLUTTER_ENGINE_SWITCH_1': 'enable-dart-profiling=true',
|
||||
'FLUTTER_ENGINE_SWITCH_2': 'trace-startup=true',
|
||||
'FLUTTER_ENGINE_SWITCH_3': 'trace-allowlist=foo,bar',
|
||||
'FLUTTER_ENGINE_SWITCH_4': 'cache-sksl=true',
|
||||
'FLUTTER_ENGINE_SWITCH_5': 'enable-impeller=false',
|
||||
'FLUTTER_ENGINE_SWITCHES': '5',
|
||||
'FLUTTER_ENGINE_SWITCH_4': 'enable-impeller=false',
|
||||
'FLUTTER_ENGINE_SWITCHES': '4',
|
||||
},
|
||||
),
|
||||
]);
|
||||
@ -237,11 +232,7 @@ void main() {
|
||||
package,
|
||||
prebuiltApplication: true,
|
||||
platformArgs: <String, Object>{'trace-startup': true},
|
||||
debuggingOptions: DebuggingOptions.disabled(
|
||||
BuildInfo.debug,
|
||||
traceAllowlist: 'foo,bar',
|
||||
cacheSkSL: true,
|
||||
),
|
||||
debuggingOptions: DebuggingOptions.disabled(BuildInfo.debug, traceAllowlist: 'foo,bar'),
|
||||
);
|
||||
|
||||
expect(result.started, true);
|
||||
|
@ -761,8 +761,6 @@ void main() {
|
||||
traceSystrace: true,
|
||||
traceToFile: 'path/to/trace.binpb',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
verboseSystemLogs: true,
|
||||
enableImpeller: ImpellerStatus.disabled,
|
||||
@ -796,9 +794,7 @@ void main() {
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
@ -895,7 +891,6 @@ void main() {
|
||||
final DebuggingOptions original = DebuggingOptions.disabled(
|
||||
BuildInfo.debug,
|
||||
traceAllowlist: 'foo',
|
||||
cacheSkSL: true,
|
||||
enableImpeller: ImpellerStatus.disabled,
|
||||
);
|
||||
|
||||
@ -910,7 +905,6 @@ void main() {
|
||||
<String>[
|
||||
'--enable-dart-profiling',
|
||||
'--trace-allowlist="foo"',
|
||||
'--cache-sksl',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
'--enable-impeller=false',
|
||||
@ -937,8 +931,6 @@ void main() {
|
||||
traceSystrace: true,
|
||||
traceToFile: 'path/to/trace.binpb',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
verboseSystemLogs: true,
|
||||
enableImpeller: ImpellerStatus.disabled,
|
||||
@ -972,9 +964,7 @@ void main() {
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--route=/test',
|
||||
'--trace-startup',
|
||||
|
@ -5,7 +5,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:file/file.dart';
|
||||
import 'package:file/memory.dart';
|
||||
import 'package:flutter_tools/src/application_package.dart';
|
||||
import 'package:flutter_tools/src/base/dds.dart';
|
||||
import 'package:flutter_tools/src/base/io.dart' as io;
|
||||
@ -13,12 +12,10 @@ import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/base/process.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
import 'package:flutter_tools/src/drive/drive_service.dart';
|
||||
import 'package:flutter_tools/src/project.dart';
|
||||
import 'package:flutter_tools/src/resident_runner.dart';
|
||||
import 'package:flutter_tools/src/version.dart';
|
||||
import 'package:flutter_tools/src/vmservice.dart';
|
||||
import 'package:package_config/package_config_types.dart';
|
||||
import 'package:test/fake.dart';
|
||||
@ -61,15 +58,6 @@ final vm_service.VM fakeVM = vm_service.VM(
|
||||
systemIsolates: <vm_service.IsolateRef>[],
|
||||
);
|
||||
|
||||
final FlutterView fakeFlutterView = FlutterView(id: 'a', uiIsolate: fakeUnpausedIsolate);
|
||||
|
||||
final FakeVmServiceRequest listViews = FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
jsonResponse: <String, Object>{
|
||||
'views': <Object>[fakeFlutterView.toJson()],
|
||||
},
|
||||
);
|
||||
|
||||
final FakeVmServiceRequest getVM = FakeVmServiceRequest(
|
||||
method: 'getVM',
|
||||
args: <String, Object>{},
|
||||
@ -306,51 +294,6 @@ void main() {
|
||||
expect(device.didDispose, true);
|
||||
});
|
||||
|
||||
// FlutterVersion requires context.
|
||||
testUsingContext(
|
||||
'Writes SkSL to file when provided with out file',
|
||||
() async {
|
||||
final MemoryFileSystem fileSystem = MemoryFileSystem.test();
|
||||
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <FakeVmServiceRequest>[
|
||||
listViews,
|
||||
const FakeVmServiceRequest(
|
||||
method: '_flutter.getSkSLs',
|
||||
args: <String, Object>{'viewId': 'a'},
|
||||
jsonResponse: <String, Object>{
|
||||
'SkSLs': <String, Object>{'A': 'B'},
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
final FakeProcessManager processManager = FakeProcessManager.empty();
|
||||
final DriverService driverService = setUpDriverService(
|
||||
processManager: processManager,
|
||||
vmService: fakeVmServiceHost.vmService,
|
||||
);
|
||||
final FakeDevice device = FakeDevice(
|
||||
LaunchResult.succeeded(vmServiceUri: Uri.parse('http://127.0.0.1:63426/1UasC_ihpXY=/')),
|
||||
);
|
||||
|
||||
await driverService.start(
|
||||
BuildInfo.profile,
|
||||
device,
|
||||
DebuggingOptions.enabled(BuildInfo.profile, ipv6: true),
|
||||
);
|
||||
await driverService.stop(writeSkslOnExit: fileSystem.file('out.json'));
|
||||
|
||||
expect(device.didStopApp, true);
|
||||
expect(device.didUninstallApp, true);
|
||||
expect(json.decode(fileSystem.file('out.json').readAsStringSync()), <String, Object>{
|
||||
'platform': 'android',
|
||||
'name': 'test',
|
||||
'engineRevision': 'abcdefghijklmnopqrstuvwxyz',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
});
|
||||
},
|
||||
overrides: <Type, Generator>{FlutterVersion: () => FakeFlutterVersion()},
|
||||
);
|
||||
|
||||
testWithoutContext('Can connect to existing application and stop it during cleanup', () async {
|
||||
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <FakeVmServiceRequest>[
|
||||
@ -500,7 +443,6 @@ FlutterDriverService setUpDriverService({
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
|
||||
|
@ -468,7 +468,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
|
@ -161,7 +161,6 @@ class TestFlutterDevice extends FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
|
@ -139,7 +139,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
@ -166,7 +165,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
@ -202,7 +200,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
@ -237,7 +234,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
@ -262,7 +258,6 @@ void main() {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
|
@ -533,9 +533,7 @@ void main() {
|
||||
'--trace-allowlist="foo"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--enable-impeller=false',
|
||||
'--enable-embedder-api',
|
||||
@ -587,8 +585,6 @@ void main() {
|
||||
traceSystrace: true,
|
||||
traceToFile: 'path/to/trace.binpb',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
verboseSystemLogs: true,
|
||||
enableImpeller: ImpellerStatus.disabled,
|
||||
|
@ -1327,9 +1327,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''',
|
||||
traceAllowlist: 'foo,bar',
|
||||
traceSkiaAllowlist: 'skia.a,skia.b',
|
||||
endlessTraceBuffer: true,
|
||||
dumpSkpOnShaderCompilation: true,
|
||||
verboseSystemLogs: true,
|
||||
cacheSkSL: true,
|
||||
purgePersistentCache: true,
|
||||
dartFlags: '--baz',
|
||||
enableImpeller: ImpellerStatus.disabled,
|
||||
@ -1355,9 +1353,7 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text''',
|
||||
'--trace-allowlist="foo,bar"',
|
||||
'--trace-skia-allowlist="skia.a,skia.b"',
|
||||
'--endless-trace-buffer',
|
||||
'--dump-skp-on-shader-compilation',
|
||||
'--verbose-logging',
|
||||
'--cache-sksl',
|
||||
'--purge-persistent-cache',
|
||||
'--enable-impeller=false',
|
||||
'--dart-flags=--baz,--null_assertions',
|
||||
|
@ -235,7 +235,6 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
@ -285,7 +284,6 @@ class FakeDelegateFlutterDevice extends FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
|
@ -15,7 +15,6 @@ import 'package:flutter_tools/src/base/logger.dart';
|
||||
import 'package:flutter_tools/src/base/platform.dart';
|
||||
import 'package:flutter_tools/src/build_info.dart';
|
||||
import 'package:flutter_tools/src/compile.dart';
|
||||
import 'package:flutter_tools/src/convert.dart';
|
||||
import 'package:flutter_tools/src/dart/pub.dart';
|
||||
import 'package:flutter_tools/src/devfs.dart';
|
||||
import 'package:flutter_tools/src/device.dart';
|
||||
@ -27,7 +26,6 @@ import 'package:flutter_tools/src/resident_devtools_handler.dart';
|
||||
import 'package:flutter_tools/src/resident_runner.dart';
|
||||
import 'package:flutter_tools/src/run_cold.dart';
|
||||
import 'package:flutter_tools/src/run_hot.dart';
|
||||
import 'package:flutter_tools/src/version.dart';
|
||||
import 'package:flutter_tools/src/vmservice.dart';
|
||||
import 'package:test/fake.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
@ -1291,8 +1289,6 @@ flutter:
|
||||
expect(residentRunner.supportsServiceProtocol, true);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, true);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, true);
|
||||
// commands
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
@ -1316,7 +1312,6 @@ flutter:
|
||||
commandHelp.b,
|
||||
commandHelp.P,
|
||||
commandHelp.a,
|
||||
commandHelp.M,
|
||||
commandHelp.g,
|
||||
commandHelp.hWithDetails,
|
||||
commandHelp.d,
|
||||
@ -1344,8 +1339,6 @@ flutter:
|
||||
expect(residentRunner.supportsServiceProtocol, true);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, true);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, true);
|
||||
// commands
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
@ -1386,8 +1379,6 @@ flutter:
|
||||
expect(residentRunner.supportsServiceProtocol, false);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, false);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, false);
|
||||
// commands
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
@ -1425,8 +1416,6 @@ flutter:
|
||||
expect(residentRunner.supportsServiceProtocol, false);
|
||||
// isRunningDebug
|
||||
expect(residentRunner.isRunningDebug, false);
|
||||
// does support SkSL
|
||||
expect(residentRunner.supportsWriteSkSL, false);
|
||||
// commands
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
@ -1443,64 +1432,6 @@ flutter:
|
||||
}),
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'ResidentRunner handles writeSkSL returning no data',
|
||||
() => testbed.run(() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
method: kGetSkSLsMethod,
|
||||
args: <String, Object>{'viewId': fakeFlutterView.id},
|
||||
jsonResponse: <String, Object>{'SkSLs': <String, Object>{}},
|
||||
),
|
||||
],
|
||||
);
|
||||
await residentRunner.writeSkSL();
|
||||
|
||||
expect(testLogger.statusText, contains('No data was received'));
|
||||
expect(fakeVmServiceHost?.hasRemainingExpectations, false);
|
||||
}),
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'ResidentRunner can write SkSL data to a unique file with engine revision, platform, and device name',
|
||||
() => testbed.run(
|
||||
() async {
|
||||
fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <VmServiceExpectation>[
|
||||
listViews,
|
||||
FakeVmServiceRequest(
|
||||
method: kGetSkSLsMethod,
|
||||
args: <String, Object>{'viewId': fakeFlutterView.id},
|
||||
jsonResponse: <String, Object>{
|
||||
'SkSLs': <String, Object>{'A': 'B'},
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
await residentRunner.writeSkSL();
|
||||
|
||||
expect(testLogger.statusText, contains('flutter_01.sksl.json'));
|
||||
expect(globals.fs.file('flutter_01.sksl.json'), exists);
|
||||
expect(
|
||||
json.decode(globals.fs.file('flutter_01.sksl.json').readAsStringSync()),
|
||||
<String, Object>{
|
||||
'platform': 'android',
|
||||
'name': 'FakeDevice',
|
||||
'engineRevision': 'abcdefg',
|
||||
'data': <String, Object>{'A': 'B'},
|
||||
},
|
||||
);
|
||||
expect(fakeVmServiceHost?.hasRemainingExpectations, false);
|
||||
},
|
||||
overrides: <Type, Generator>{
|
||||
FileSystemUtils: () => FileSystemUtils(fileSystem: globals.fs, platform: globals.platform),
|
||||
FlutterVersion: () => FakeFlutterVersion(engineRevision: 'abcdefg'),
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
testUsingContext(
|
||||
'ResidentRunner ignores DevtoolsLauncher when attaching with enableDevTools: false - cold mode',
|
||||
() => testbed.run(() async {
|
||||
@ -2114,7 +2045,6 @@ flutter:
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
@ -2172,7 +2102,6 @@ flutter:
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
io.CompressionOptions? compression,
|
||||
|
@ -1814,7 +1814,6 @@ class FakeFlutterDevice extends Fake implements FlutterDevice {
|
||||
ReloadSources? reloadSources,
|
||||
Restart? restart,
|
||||
CompileExpression? compileExpression,
|
||||
GetSkSLMethod? getSkSLMethod,
|
||||
FlutterProject? flutterProject,
|
||||
PrintStructuredErrorLogMethod? printStructuredErrorLogMethod,
|
||||
required DebuggingOptions debuggingOptions,
|
||||
|
@ -1232,9 +1232,6 @@ class FakeResidentRunner extends ResidentHandlers {
|
||||
@override
|
||||
bool supportsServiceProtocol = true;
|
||||
|
||||
@override
|
||||
bool supportsWriteSkSL = true;
|
||||
|
||||
@override
|
||||
Future<void> cleanupAfterSignal() async {}
|
||||
|
||||
|
@ -65,38 +65,6 @@ void main() {
|
||||
expect(mockVMService.services, containsPair(kFlutterMemoryInfoServiceName, kFlutterToolAlias));
|
||||
});
|
||||
|
||||
testWithoutContext('VM Service registers flutterGetSkSL service', () async {
|
||||
final MockVMService mockVMService = MockVMService();
|
||||
await setUpVmService(skSLMethod: () async => 'hello', vmService: mockVMService);
|
||||
|
||||
expect(mockVMService.services, containsPair(kFlutterGetSkSLServiceName, kFlutterToolAlias));
|
||||
});
|
||||
|
||||
testWithoutContext('VM Service throws tool exit on service registration failure.', () async {
|
||||
final MockVMService mockVMService = MockVMService()..errorOnRegisterService = true;
|
||||
|
||||
await expectLater(
|
||||
() async => setUpVmService(skSLMethod: () async => 'hello', vmService: mockVMService),
|
||||
throwsToolExit(),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext(
|
||||
'VM Service throws tool exit on service registration failure with awaited future.',
|
||||
() async {
|
||||
final MockVMService mockVMService = MockVMService()..errorOnRegisterService = true;
|
||||
|
||||
await expectLater(
|
||||
() async => setUpVmService(
|
||||
skSLMethod: () async => 'hello',
|
||||
printStructuredErrorLogMethod: (vm_service.Event event) {},
|
||||
vmService: mockVMService,
|
||||
),
|
||||
throwsToolExit(),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
testWithoutContext('VM Service registers flutterPrintStructuredErrorLogMethod', () async {
|
||||
final MockVMService mockVMService = MockVMService();
|
||||
await setUpVmService(
|
||||
@ -188,18 +156,6 @@ void main() {
|
||||
});
|
||||
});
|
||||
|
||||
testWithoutContext('getSkSLs forwards arguments correctly', () async {
|
||||
final MockVMService mockVMService = MockVMService();
|
||||
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
|
||||
|
||||
await flutterVmService.getSkSLs(viewId: 'abc');
|
||||
|
||||
final ({Map<String, Object?>? args, String? isolateId}) call =
|
||||
mockVMService.calledMethods[kGetSkSLsMethod]!.single;
|
||||
expect(call.isolateId, isNull);
|
||||
expect(call.args, <String, String>{'viewId': 'abc'});
|
||||
});
|
||||
|
||||
testWithoutContext('flushUIThreadTasks forwards arguments correctly', () async {
|
||||
final MockVMService mockVMService = MockVMService();
|
||||
final FlutterVmService flutterVmService = FlutterVmService(mockVMService);
|
||||
@ -371,11 +327,6 @@ void main() {
|
||||
() async {
|
||||
final FakeVmServiceHost fakeVmServiceHost = FakeVmServiceHost(
|
||||
requests: <VmServiceExpectation>[
|
||||
FakeVmServiceRequest(
|
||||
method: kGetSkSLsMethod,
|
||||
args: <String, Object>{'viewId': '1234'},
|
||||
error: FakeRPCError(code: vm_service.RPCErrorKind.kServiceDisappeared.code),
|
||||
),
|
||||
FakeVmServiceRequest(
|
||||
method: kListViewsMethod,
|
||||
error: FakeRPCError(code: vm_service.RPCErrorKind.kServiceDisappeared.code),
|
||||
@ -398,11 +349,6 @@ void main() {
|
||||
],
|
||||
);
|
||||
|
||||
final Map<String, Object?>? skSLs = await fakeVmServiceHost.vmService.getSkSLs(
|
||||
viewId: '1234',
|
||||
);
|
||||
expect(skSLs, isNull);
|
||||
|
||||
final List<FlutterView> views = await fakeVmServiceHost.vmService.getFlutterViews();
|
||||
expect(views, isEmpty);
|
||||
|
||||
|
@ -192,24 +192,6 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
testWithoutContext('Providing sksl bundle with missing file with tool exit', () async {
|
||||
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
|
||||
final ProcessResult result = await processManager.run(<String>[
|
||||
flutterBin,
|
||||
'build',
|
||||
'apk',
|
||||
'--bundle-sksl-path=foo/bar/baz.json', // This file does not exist.
|
||||
], workingDirectory: helloWorld);
|
||||
|
||||
expect(
|
||||
result,
|
||||
const ProcessResultMatcher(
|
||||
exitCode: 1,
|
||||
stderrPattern: 'No SkSL shader bundle found at foo/bar/baz.json',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
testWithoutContext('flutter attach does not support --release', () async {
|
||||
final String helloWorld = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
|
||||
final ProcessResult result = await processManager.run(<String>[
|
||||
|
@ -432,7 +432,6 @@ void main() {
|
||||
'b Toggle platform brightness (dark and light mode). (debugBrightnessOverride)',
|
||||
'P Toggle performance overlay. (WidgetsApp.showPerformanceOverlay)',
|
||||
'a Toggle timeline events for all widget build methods. (debugProfileWidgetBuilds)',
|
||||
'M Write SkSL shaders to a unique file in the project directory.',
|
||||
'g Run source code generators.',
|
||||
'h Repeat this help message.',
|
||||
'd Detach (terminate "flutter run" but leave application running).',
|
||||
|
@ -94,12 +94,6 @@ void main() {
|
||||
expect(response, throwsA(const TypeMatcher<RPCError>()));
|
||||
});
|
||||
|
||||
testWithoutContext('flutterGetSkSL can be called', () async {
|
||||
final Response response = await vmService.callMethod('s0.flutterGetSkSL');
|
||||
|
||||
expect(response.type, 'Success');
|
||||
});
|
||||
|
||||
testWithoutContext('ext.flutter.brightnessOverride can toggle window brightness', () async {
|
||||
final Isolate isolate = await waitForExtension(vmService, 'ext.flutter.brightnessOverride');
|
||||
final Response response = await vmService.callServiceExtension(
|
||||
|
Loading…
Reference in New Issue
Block a user