[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:
parent
8d6ba3ebe9
commit
0f28edac65
@ -155,6 +155,7 @@ Future<void> run(List<String> args) async {
|
|||||||
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),
|
icudtlPath: globals.fs.path.absolute(argResults[_kOptionIcudtl] as String),
|
||||||
coverageDirectory: coverageDirectory,
|
coverageDirectory: coverageDirectory,
|
||||||
extraFrontEndOptions: <String>[],
|
extraFrontEndOptions: <String>[],
|
||||||
|
buildInfo: BuildInfo.debug,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
|
@ -27,10 +27,14 @@ const String defaultAssetBasePath = '.';
|
|||||||
const String defaultManifestPath = 'pubspec.yaml';
|
const String defaultManifestPath = 'pubspec.yaml';
|
||||||
String get defaultDepfilePath => globals.fs.path.join(getBuildDirectory(), 'snapshot_blob.bin.d');
|
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(
|
return getKernelPathForTransformerOptions(
|
||||||
globals.fs.path.join(getBuildDirectory(), 'app.dill'),
|
globals.fs.path.join(getBuildDirectory(), 'app.dill'),
|
||||||
trackWidgetCreation: trackWidgetCreation,
|
trackWidgetCreation: trackWidgetCreation,
|
||||||
|
nullSafetyMode: nullSafetyMode,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,6 +42,7 @@ String getDefaultCachedKernelPath({
|
|||||||
@required bool trackWidgetCreation,
|
@required bool trackWidgetCreation,
|
||||||
@required List<String> dartDefines,
|
@required List<String> dartDefines,
|
||||||
@required List<String> extraFrontEndOptions,
|
@required List<String> extraFrontEndOptions,
|
||||||
|
@required NullSafetyMode nullSafetyMode,
|
||||||
}) {
|
}) {
|
||||||
final StringBuffer buffer = StringBuffer();
|
final StringBuffer buffer = StringBuffer();
|
||||||
buffer.writeAll(dartDefines);
|
buffer.writeAll(dartDefines);
|
||||||
@ -51,13 +56,21 @@ String getDefaultCachedKernelPath({
|
|||||||
return getKernelPathForTransformerOptions(
|
return getKernelPathForTransformerOptions(
|
||||||
globals.fs.path.join(getBuildDirectory(), '${buildPrefix}cache.dill'),
|
globals.fs.path.join(getBuildDirectory(), '${buildPrefix}cache.dill'),
|
||||||
trackWidgetCreation: trackWidgetCreation,
|
trackWidgetCreation: trackWidgetCreation,
|
||||||
|
nullSafetyMode: nullSafetyMode,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String getKernelPathForTransformerOptions(
|
String getKernelPathForTransformerOptions(
|
||||||
String path, {
|
String path, {
|
||||||
@required bool trackWidgetCreation,
|
@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) {
|
if (trackWidgetCreation) {
|
||||||
path += '.track.dill';
|
path += '.track.dill';
|
||||||
}
|
}
|
||||||
|
@ -235,8 +235,8 @@ class TestCommand extends FlutterCommand {
|
|||||||
watcher = collector;
|
watcher = collector;
|
||||||
}
|
}
|
||||||
|
|
||||||
final bool disableServiceAuthCodes =
|
final bool disableServiceAuthCodes = boolArg('disable-service-auth-codes');
|
||||||
boolArg('disable-service-auth-codes');
|
final BuildInfo buildInfo = getBuildInfo(forcedBuildMode: BuildMode.debug);
|
||||||
|
|
||||||
final int result = await testRunner.runTests(
|
final int result = await testRunner.runTests(
|
||||||
testWrapper,
|
testWrapper,
|
||||||
@ -261,8 +261,9 @@ class TestCommand extends FlutterCommand {
|
|||||||
flutterProject: flutterProject,
|
flutterProject: flutterProject,
|
||||||
web: stringArg('platform') == 'chrome',
|
web: stringArg('platform') == 'chrome',
|
||||||
randomSeed: stringArg('test-randomize-ordering-seed'),
|
randomSeed: stringArg('test-randomize-ordering-seed'),
|
||||||
extraFrontEndOptions: getBuildInfo(forcedBuildMode: BuildMode.debug).extraFrontEndOptions,
|
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
|
||||||
nullAssertions: boolArg(FlutterOptions.kNullAssertions),
|
nullAssertions: boolArg(FlutterOptions.kNullAssertions),
|
||||||
|
buildInfo: buildInfo,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (collector != null) {
|
if (collector != null) {
|
||||||
|
@ -16,7 +16,6 @@ import 'base/logger.dart';
|
|||||||
import 'base/net.dart';
|
import 'base/net.dart';
|
||||||
import 'base/os.dart';
|
import 'base/os.dart';
|
||||||
import 'build_info.dart';
|
import 'build_info.dart';
|
||||||
import 'bundle.dart';
|
|
||||||
import 'compile.dart';
|
import 'compile.dart';
|
||||||
import 'convert.dart' show base64, utf8;
|
import 'convert.dart' show base64, utf8;
|
||||||
import 'vmservice.dart';
|
import 'vmservice.dart';
|
||||||
@ -477,12 +476,12 @@ class DevFS {
|
|||||||
@required String pathToReload,
|
@required String pathToReload,
|
||||||
@required List<Uri> invalidatedFiles,
|
@required List<Uri> invalidatedFiles,
|
||||||
@required PackageConfig packageConfig,
|
@required PackageConfig packageConfig,
|
||||||
|
@required String dillOutputPath,
|
||||||
DevFSWriter devFSWriter,
|
DevFSWriter devFSWriter,
|
||||||
String target,
|
String target,
|
||||||
AssetBundle bundle,
|
AssetBundle bundle,
|
||||||
DateTime firstBuildTime,
|
DateTime firstBuildTime,
|
||||||
bool bundleFirstUpload = false,
|
bool bundleFirstUpload = false,
|
||||||
String dillOutputPath,
|
|
||||||
bool fullRestart = false,
|
bool fullRestart = false,
|
||||||
String projectRootPath,
|
String projectRootPath,
|
||||||
}) async {
|
}) async {
|
||||||
@ -508,7 +507,7 @@ class DevFS {
|
|||||||
final Future<CompilerOutput> pendingCompilerOutput = generator.recompile(
|
final Future<CompilerOutput> pendingCompilerOutput = generator.recompile(
|
||||||
mainUri,
|
mainUri,
|
||||||
invalidatedFiles,
|
invalidatedFiles,
|
||||||
outputPath: dillOutputPath ?? getDefaultApplicationKernelPath(trackWidgetCreation: trackWidgetCreation),
|
outputPath: dillOutputPath,
|
||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
);
|
);
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
|
@ -815,12 +815,12 @@ class WebDevFS implements DevFS {
|
|||||||
@required String pathToReload,
|
@required String pathToReload,
|
||||||
@required List<Uri> invalidatedFiles,
|
@required List<Uri> invalidatedFiles,
|
||||||
@required PackageConfig packageConfig,
|
@required PackageConfig packageConfig,
|
||||||
|
@required String dillOutputPath,
|
||||||
DevFSWriter devFSWriter,
|
DevFSWriter devFSWriter,
|
||||||
String target,
|
String target,
|
||||||
AssetBundle bundle,
|
AssetBundle bundle,
|
||||||
DateTime firstBuildTime,
|
DateTime firstBuildTime,
|
||||||
bool bundleFirstUpload = false,
|
bool bundleFirstUpload = false,
|
||||||
String dillOutputPath,
|
|
||||||
bool fullRestart = false,
|
bool fullRestart = false,
|
||||||
String projectRootPath,
|
String projectRootPath,
|
||||||
}) async {
|
}) async {
|
||||||
@ -878,8 +878,7 @@ class WebDevFS implements DevFS {
|
|||||||
path: '/' + mainUri.pathSegments.last,
|
path: '/' + mainUri.pathSegments.last,
|
||||||
),
|
),
|
||||||
invalidatedFiles,
|
invalidatedFiles,
|
||||||
outputPath: dillOutputPath ??
|
outputPath: dillOutputPath,
|
||||||
getDefaultApplicationKernelPath(trackWidgetCreation: trackWidgetCreation),
|
|
||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
);
|
);
|
||||||
if (compilerOutput == null || compilerOutput.errorCount > 0) {
|
if (compilerOutput == null || compilerOutput.errorCount > 0) {
|
||||||
|
@ -118,7 +118,8 @@ class FlutterDevice {
|
|||||||
initializeFromDill: getDefaultCachedKernelPath(
|
initializeFromDill: getDefaultCachedKernelPath(
|
||||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
dartDefines: buildInfo.dartDefines,
|
dartDefines: buildInfo.dartDefines,
|
||||||
extraFrontEndOptions: extraFrontEndOptions
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
|
nullSafetyMode: buildInfo.nullSafetyMode,
|
||||||
),
|
),
|
||||||
targetModel: TargetModel.dartdevc,
|
targetModel: TargetModel.dartdevc,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
@ -160,6 +161,7 @@ class FlutterDevice {
|
|||||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
dartDefines: buildInfo.dartDefines,
|
dartDefines: buildInfo.dartDefines,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
|
nullSafetyMode: buildInfo.nullSafetyMode,
|
||||||
),
|
),
|
||||||
packagesPath: buildInfo.packagesPath,
|
packagesPath: buildInfo.packagesPath,
|
||||||
artifacts: globals.artifacts,
|
artifacts: globals.artifacts,
|
||||||
@ -1183,6 +1185,7 @@ abstract class ResidentRunner {
|
|||||||
trackWidgetCreation: trackWidgetCreation,
|
trackWidgetCreation: trackWidgetCreation,
|
||||||
dartDefines: debuggingOptions.buildInfo.dartDefines,
|
dartDefines: debuggingOptions.buildInfo.dartDefines,
|
||||||
extraFrontEndOptions: debuggingOptions.buildInfo.extraFrontEndOptions,
|
extraFrontEndOptions: debuggingOptions.buildInfo.extraFrontEndOptions,
|
||||||
|
nullSafetyMode: debuggingOptions.buildInfo.nullSafetyMode,
|
||||||
);
|
);
|
||||||
globals.fs
|
globals.fs
|
||||||
.file(copyPath)
|
.file(copyPath)
|
||||||
|
@ -321,7 +321,10 @@ class HotRunner extends ResidentRunner {
|
|||||||
// should only be displayed once.
|
// should only be displayed once.
|
||||||
suppressErrors: applicationBinary == null,
|
suppressErrors: applicationBinary == null,
|
||||||
outputPath: dillOutputPath ??
|
outputPath: dillOutputPath ??
|
||||||
getDefaultApplicationKernelPath(trackWidgetCreation: debuggingOptions.buildInfo.trackWidgetCreation),
|
getDefaultApplicationKernelPath(
|
||||||
|
trackWidgetCreation: debuggingOptions.buildInfo.trackWidgetCreation,
|
||||||
|
nullSafetyMode: debuggingOptions.buildInfo.nullSafetyMode,
|
||||||
|
),
|
||||||
packageConfig: packageConfig,
|
packageConfig: packageConfig,
|
||||||
).then((CompilerOutput output) => output?.errorCount == 0)
|
).then((CompilerOutput output) => output?.errorCount == 0)
|
||||||
);
|
);
|
||||||
|
@ -67,6 +67,7 @@ FlutterPlatform installHook({
|
|||||||
// Deprecated, use extraFrontEndOptions.
|
// Deprecated, use extraFrontEndOptions.
|
||||||
List<String> dartExperiments,
|
List<String> dartExperiments,
|
||||||
bool nullAssertions = false,
|
bool nullAssertions = false,
|
||||||
|
BuildInfo buildInfo, // TODO(jonahwilliams): make the default
|
||||||
}) {
|
}) {
|
||||||
assert(testWrapper != null);
|
assert(testWrapper != null);
|
||||||
assert(enableObservatory || (!startPaused && observatoryPort == null));
|
assert(enableObservatory || (!startPaused && observatoryPort == null));
|
||||||
@ -102,6 +103,7 @@ FlutterPlatform installHook({
|
|||||||
icudtlPath: icudtlPath,
|
icudtlPath: icudtlPath,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
nullAssertions: nullAssertions,
|
nullAssertions: nullAssertions,
|
||||||
|
buildInfo: buildInfo,
|
||||||
);
|
);
|
||||||
platformPluginRegistration(platform);
|
platformPluginRegistration(platform);
|
||||||
return platform;
|
return platform;
|
||||||
@ -246,6 +248,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
this.flutterProject,
|
this.flutterProject,
|
||||||
this.icudtlPath,
|
this.icudtlPath,
|
||||||
this.nullAssertions = false,
|
this.nullAssertions = false,
|
||||||
|
this.buildInfo,
|
||||||
@required this.extraFrontEndOptions,
|
@required this.extraFrontEndOptions,
|
||||||
}) : assert(shellPath != null);
|
}) : assert(shellPath != null);
|
||||||
|
|
||||||
@ -270,6 +273,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
final String icudtlPath;
|
final String icudtlPath;
|
||||||
final List<String> extraFrontEndOptions;
|
final List<String> extraFrontEndOptions;
|
||||||
final bool nullAssertions;
|
final bool nullAssertions;
|
||||||
|
final BuildInfo buildInfo;
|
||||||
|
|
||||||
Directory fontsDirectory;
|
Directory fontsDirectory;
|
||||||
|
|
||||||
@ -444,7 +448,7 @@ class FlutterPlatform extends PlatformPlugin {
|
|||||||
|
|
||||||
if (precompiledDillPath == null && precompiledDillFiles == null) {
|
if (precompiledDillPath == null && precompiledDillFiles == null) {
|
||||||
// Lazily instantiate compiler so it is built only if it is actually used.
|
// Lazily instantiate compiler so it is built only if it is actually used.
|
||||||
compiler ??= TestCompiler(buildMode, trackWidgetCreation, flutterProject, extraFrontEndOptions);
|
compiler ??= TestCompiler(buildInfo ?? BuildInfo(buildMode, '', trackWidgetCreation: trackWidgetCreation, treeShakeIcons: false), flutterProject, extraFrontEndOptions);
|
||||||
mainDart = await compiler.compile(globals.fs.file(mainDart).uri);
|
mainDart = await compiler.compile(globals.fs.file(mainDart).uri);
|
||||||
|
|
||||||
if (mainDart == null) {
|
if (mainDart == null) {
|
||||||
|
@ -67,7 +67,7 @@ class FlutterWebPlatform extends PlatformPlugin {
|
|||||||
|
|
||||||
_testGoldenComparator = TestGoldenComparator(
|
_testGoldenComparator = TestGoldenComparator(
|
||||||
shellPath,
|
shellPath,
|
||||||
() => TestCompiler(BuildMode.debug, false, flutterProject, <String>[]),
|
() => TestCompiler(BuildInfo.debug, flutterProject, <String>[]),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ abstract class FlutterTestRunner {
|
|||||||
String randomSeed,
|
String randomSeed,
|
||||||
@required List<String> extraFrontEndOptions,
|
@required List<String> extraFrontEndOptions,
|
||||||
bool nullAssertions = false,
|
bool nullAssertions = false,
|
||||||
|
BuildInfo buildInfo, // TODO(jonahwilliams): make the default
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,6 +89,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
|||||||
String randomSeed,
|
String randomSeed,
|
||||||
@required List<String> extraFrontEndOptions,
|
@required List<String> extraFrontEndOptions,
|
||||||
bool nullAssertions = false,
|
bool nullAssertions = false,
|
||||||
|
BuildInfo buildInfo // TODO(jonahwilliams): make the default argument
|
||||||
}) async {
|
}) async {
|
||||||
// Configure package:test to use the Flutter engine for child processes.
|
// Configure package:test to use the Flutter engine for child processes.
|
||||||
final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester);
|
final String shellPath = globals.artifacts.getArtifactPath(Artifact.flutterTester);
|
||||||
@ -182,6 +184,7 @@ class _FlutterTestRunnerImpl implements FlutterTestRunner {
|
|||||||
icudtlPath: icudtlPath,
|
icudtlPath: icudtlPath,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
nullAssertions: nullAssertions,
|
nullAssertions: nullAssertions,
|
||||||
|
buildInfo: buildInfo,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Make the global packages path absolute.
|
// Make the global packages path absolute.
|
||||||
|
@ -37,14 +37,19 @@ class TestCompiler {
|
|||||||
///
|
///
|
||||||
/// [flutterProject] is the project for which we are running tests.
|
/// [flutterProject] is the project for which we are running tests.
|
||||||
TestCompiler(
|
TestCompiler(
|
||||||
this.buildMode,
|
this.buildInfo,
|
||||||
this.trackWidgetCreation,
|
|
||||||
this.flutterProject,
|
this.flutterProject,
|
||||||
this.extraFrontEndOptions,
|
this.extraFrontEndOptions,
|
||||||
) : testFilePath = getKernelPathForTransformerOptions(
|
) : testFilePath = globals.fs.path.join(
|
||||||
globals.fs.path.join(flutterProject.directory.path, getBuildDirectory(), 'testfile.dill'),
|
flutterProject.directory.path,
|
||||||
trackWidgetCreation: trackWidgetCreation,
|
getBuildDirectory(),
|
||||||
) {
|
'test_cache',
|
||||||
|
getDefaultCachedKernelPath(
|
||||||
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
|
nullSafetyMode: buildInfo.nullSafetyMode,
|
||||||
|
dartDefines: buildInfo.dartDefines,
|
||||||
|
extraFrontEndOptions: buildInfo.extraFrontEndOptions,
|
||||||
|
)) {
|
||||||
// Compiler maintains and updates single incremental dill file.
|
// Compiler maintains and updates single incremental dill file.
|
||||||
// Incremental compilation requests done for each test copy that file away
|
// Incremental compilation requests done for each test copy that file away
|
||||||
// for independent execution.
|
// for independent execution.
|
||||||
@ -61,8 +66,7 @@ class TestCompiler {
|
|||||||
final StreamController<_CompilationRequest> compilerController = StreamController<_CompilationRequest>();
|
final StreamController<_CompilationRequest> compilerController = StreamController<_CompilationRequest>();
|
||||||
final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[];
|
final List<_CompilationRequest> compilationQueue = <_CompilationRequest>[];
|
||||||
final FlutterProject flutterProject;
|
final FlutterProject flutterProject;
|
||||||
final BuildMode buildMode;
|
final BuildInfo buildInfo;
|
||||||
final bool trackWidgetCreation;
|
|
||||||
final String testFilePath;
|
final String testFilePath;
|
||||||
final List<String> extraFrontEndOptions;
|
final List<String> extraFrontEndOptions;
|
||||||
|
|
||||||
@ -101,11 +105,11 @@ class TestCompiler {
|
|||||||
artifacts: globals.artifacts,
|
artifacts: globals.artifacts,
|
||||||
logger: globals.logger,
|
logger: globals.logger,
|
||||||
processManager: globals.processManager,
|
processManager: globals.processManager,
|
||||||
buildMode: buildMode,
|
buildMode: buildInfo.mode,
|
||||||
trackWidgetCreation: trackWidgetCreation,
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
initializeFromDill: testFilePath,
|
initializeFromDill: testFilePath,
|
||||||
unsafePackageSerialization: false,
|
unsafePackageSerialization: false,
|
||||||
dartDefines: const <String>[],
|
dartDefines: buildInfo.dartDefines,
|
||||||
packagesPath: globalPackagesPath,
|
packagesPath: globalPackagesPath,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
platform: globals.platform,
|
platform: globals.platform,
|
||||||
|
@ -153,6 +153,7 @@ class FlutterTesterDevice extends Device {
|
|||||||
final String applicationKernelFilePath = getKernelPathForTransformerOptions(
|
final String applicationKernelFilePath = getKernelPathForTransformerOptions(
|
||||||
_fileSystem.path.join(_buildDirectory, 'flutter-tester-app.dill'),
|
_fileSystem.path.join(_buildDirectory, 'flutter-tester-app.dill'),
|
||||||
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
trackWidgetCreation: buildInfo.trackWidgetCreation,
|
||||||
|
nullSafetyMode: buildInfo.nullSafetyMode,
|
||||||
);
|
);
|
||||||
// Build assets and perform initial compilation.
|
// Build assets and perform initial compilation.
|
||||||
await BundleBuilder().build(
|
await BundleBuilder().build(
|
||||||
|
@ -187,6 +187,7 @@ class FakeFlutterTestRunner implements FlutterTestRunner {
|
|||||||
String randomSeed,
|
String randomSeed,
|
||||||
@override List<String> extraFrontEndOptions,
|
@override List<String> extraFrontEndOptions,
|
||||||
bool nullAssertions = false,
|
bool nullAssertions = false,
|
||||||
|
BuildInfo buildInfo,
|
||||||
}) async {
|
}) async {
|
||||||
lastEnableObservatoryValue = enableObservatory;
|
lastEnableObservatoryValue = enableObservatory;
|
||||||
return exitCode;
|
return exitCode;
|
||||||
|
@ -175,6 +175,7 @@ void main() {
|
|||||||
enableObservatory: false,
|
enableObservatory: false,
|
||||||
startPaused: true,
|
startPaused: true,
|
||||||
extraFrontEndOptions: <String>[],
|
extraFrontEndOptions: <String>[],
|
||||||
|
buildInfo: BuildInfo.debug,
|
||||||
), throwsAssertionError);
|
), throwsAssertionError);
|
||||||
|
|
||||||
expect(() => installHook(
|
expect(() => installHook(
|
||||||
@ -184,6 +185,7 @@ void main() {
|
|||||||
startPaused: false,
|
startPaused: false,
|
||||||
observatoryPort: 123,
|
observatoryPort: 123,
|
||||||
extraFrontEndOptions: <String>[],
|
extraFrontEndOptions: <String>[],
|
||||||
|
buildInfo: BuildInfo.debug,
|
||||||
), throwsAssertionError);
|
), throwsAssertionError);
|
||||||
|
|
||||||
FlutterPlatform capturedPlatform;
|
FlutterPlatform capturedPlatform;
|
||||||
@ -205,6 +207,7 @@ void main() {
|
|||||||
serverType: InternetAddressType.IPv6,
|
serverType: InternetAddressType.IPv6,
|
||||||
icudtlPath: 'ghi',
|
icudtlPath: 'ghi',
|
||||||
extraFrontEndOptions: <String>[],
|
extraFrontEndOptions: <String>[],
|
||||||
|
buildInfo: BuildInfo.debug,
|
||||||
platformPluginRegistration: (FlutterPlatform platform) {
|
platformPluginRegistration: (FlutterPlatform platform) {
|
||||||
capturedPlatform = platform;
|
capturedPlatform = platform;
|
||||||
});
|
});
|
||||||
|
@ -2286,6 +2286,38 @@ void main() {
|
|||||||
expect(await globals.fs.file(globals.fs.path.join('build', 'cache.dill.track.dill')).readAsString(), 'ABC');
|
expect(await globals.fs.file(globals.fs.path.join('build', 'cache.dill.track.dill')).readAsString(), 'ABC');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
testUsingContext('HotRunner copies compiled app.dill to cache during startup with --sound-null-safety', () => testbed.run(() async {
|
||||||
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||||
|
listViews,
|
||||||
|
listViews,
|
||||||
|
]);
|
||||||
|
setWsAddress(testUri, fakeVmServiceHost.vmService);
|
||||||
|
globals.fs.file(globals.fs.path.join('lib', 'main.dart')).createSync(recursive: true);
|
||||||
|
residentRunner = HotRunner(
|
||||||
|
<FlutterDevice>[
|
||||||
|
mockFlutterDevice,
|
||||||
|
],
|
||||||
|
stayResident: false,
|
||||||
|
debuggingOptions: DebuggingOptions.enabled(const BuildInfo(
|
||||||
|
BuildMode.debug,
|
||||||
|
'',
|
||||||
|
treeShakeIcons: false,
|
||||||
|
trackWidgetCreation: true,
|
||||||
|
nullSafetyMode: NullSafetyMode.sound,
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
residentRunner.artifactDirectory.childFile('app.dill').writeAsStringSync('ABC');
|
||||||
|
when(mockFlutterDevice.runHot(
|
||||||
|
hotRunner: anyNamed('hotRunner'),
|
||||||
|
route: anyNamed('route'),
|
||||||
|
)).thenAnswer((Invocation invocation) async {
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
await residentRunner.run();
|
||||||
|
|
||||||
|
expect(await globals.fs.file(globals.fs.path.join('build', 'cache.dill.sound.track.dill')).readAsString(), 'ABC');
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
testUsingContext('HotRunner unforwards device ports', () => testbed.run(() async {
|
testUsingContext('HotRunner unforwards device ports', () => testbed.run(() async {
|
||||||
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[
|
||||||
|
@ -39,8 +39,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('TestCompiler reports a dill file when compile is successful', () async {
|
testUsingContext('TestCompiler reports a dill file when compile is successful', () async {
|
||||||
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
||||||
BuildMode.debug,
|
BuildInfo.debug,
|
||||||
false,
|
|
||||||
FlutterProject.current(),
|
FlutterProject.current(),
|
||||||
residentCompiler,
|
residentCompiler,
|
||||||
);
|
);
|
||||||
@ -65,8 +64,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('TestCompiler reports null when a compile fails', () async {
|
testUsingContext('TestCompiler reports null when a compile fails', () async {
|
||||||
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
||||||
BuildMode.debug,
|
BuildInfo.debug,
|
||||||
false,
|
|
||||||
FlutterProject.current(),
|
FlutterProject.current(),
|
||||||
residentCompiler,
|
residentCompiler,
|
||||||
);
|
);
|
||||||
@ -92,8 +90,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('TestCompiler disposing test compiler shuts down backing compiler', () async {
|
testUsingContext('TestCompiler disposing test compiler shuts down backing compiler', () async {
|
||||||
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
||||||
BuildMode.debug,
|
BuildInfo.debug,
|
||||||
false,
|
|
||||||
FlutterProject.current(),
|
FlutterProject.current(),
|
||||||
residentCompiler,
|
residentCompiler,
|
||||||
);
|
);
|
||||||
@ -114,8 +111,7 @@ void main() {
|
|||||||
|
|
||||||
testUsingContext('TestCompiler reports an error when there is no dependency on flutter_test', () async {
|
testUsingContext('TestCompiler reports an error when there is no dependency on flutter_test', () async {
|
||||||
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
final FakeTestCompiler testCompiler = FakeTestCompiler(
|
||||||
BuildMode.debug,
|
BuildInfo.debug,
|
||||||
false,
|
|
||||||
FlutterProject.current(),
|
FlutterProject.current(),
|
||||||
residentCompiler,
|
residentCompiler,
|
||||||
);
|
);
|
||||||
@ -140,11 +136,10 @@ void main() {
|
|||||||
/// Override the creation of the Resident Compiler to simplify testing.
|
/// Override the creation of the Resident Compiler to simplify testing.
|
||||||
class FakeTestCompiler extends TestCompiler {
|
class FakeTestCompiler extends TestCompiler {
|
||||||
FakeTestCompiler(
|
FakeTestCompiler(
|
||||||
BuildMode buildMode,
|
BuildInfo buildInfo,
|
||||||
bool trackWidgetCreation,
|
|
||||||
FlutterProject flutterProject,
|
FlutterProject flutterProject,
|
||||||
this.residentCompiler,
|
this.residentCompiler,
|
||||||
) : super(buildMode, trackWidgetCreation, flutterProject, <String>[]);
|
) : super(buildInfo, flutterProject, <String>[]);
|
||||||
|
|
||||||
final MockResidentCompiler residentCompiler;
|
final MockResidentCompiler residentCompiler;
|
||||||
|
|
||||||
|
@ -669,6 +669,7 @@ void main() {
|
|||||||
invalidatedFiles: <Uri>[],
|
invalidatedFiles: <Uri>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
pathToReload: '',
|
pathToReload: '',
|
||||||
|
dillOutputPath: 'out.dill',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(webDevFS.webAssetServer.getFile('require.js'), isNotNull);
|
expect(webDevFS.webAssetServer.getFile('require.js'), isNotNull);
|
||||||
@ -784,6 +785,7 @@ void main() {
|
|||||||
invalidatedFiles: <Uri>[],
|
invalidatedFiles: <Uri>[],
|
||||||
packageConfig: PackageConfig.empty,
|
packageConfig: PackageConfig.empty,
|
||||||
pathToReload: '',
|
pathToReload: '',
|
||||||
|
dillOutputPath: '',
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(webDevFS.webAssetServer.getFile('require.js'), isNotNull);
|
expect(webDevFS.webAssetServer.getFile('require.js'), isNotNull);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user