[flutter_tools] null safety mode is used for dill naming (#68898)

* [flutter_tools] null safety mode is used for dill naming

* add bad test case
This commit is contained in:
Jonah Williams
2020-10-23 15:39:58 -07:00
committed by GitHub
parent 8d6ba3ebe9
commit 0f28edac65
17 changed files with 100 additions and 36 deletions

View File

@@ -27,10 +27,14 @@ const String defaultAssetBasePath = '.';
const String defaultManifestPath = 'pubspec.yaml';
String get defaultDepfilePath => globals.fs.path.join(getBuildDirectory(), 'snapshot_blob.bin.d');
String getDefaultApplicationKernelPath({ @required bool trackWidgetCreation }) {
String getDefaultApplicationKernelPath({
@required bool trackWidgetCreation,
@required NullSafetyMode nullSafetyMode,
}) {
return getKernelPathForTransformerOptions(
globals.fs.path.join(getBuildDirectory(), 'app.dill'),
trackWidgetCreation: trackWidgetCreation,
nullSafetyMode: nullSafetyMode,
);
}
@@ -38,6 +42,7 @@ String getDefaultCachedKernelPath({
@required bool trackWidgetCreation,
@required List<String> dartDefines,
@required List<String> extraFrontEndOptions,
@required NullSafetyMode nullSafetyMode,
}) {
final StringBuffer buffer = StringBuffer();
buffer.writeAll(dartDefines);
@@ -51,13 +56,21 @@ String getDefaultCachedKernelPath({
return getKernelPathForTransformerOptions(
globals.fs.path.join(getBuildDirectory(), '${buildPrefix}cache.dill'),
trackWidgetCreation: trackWidgetCreation,
nullSafetyMode: nullSafetyMode,
);
}
String getKernelPathForTransformerOptions(
String path, {
@required bool trackWidgetCreation,
@required NullSafetyMode nullSafetyMode,
}) {
// Temporary work around until --initialize-from-dill accounts for sound mode.
// The tool does not know the compilation mode if [NullSafetyMode.autodetect] is
// selected.
if (nullSafetyMode == NullSafetyMode.sound) {
path += '.sound';
}
if (trackWidgetCreation) {
path += '.track.dill';
}