Unverified Commit d04a057e authored by Chris Bracken's avatar Chris Bracken Committed by GitHub

Eliminate BuildInfo.previewDart2 (now always true) (#21392)

Dart 1 is no longer supported in Flutter.
parent 5b5a5b82
...@@ -11,7 +11,6 @@ import 'globals.dart'; ...@@ -11,7 +11,6 @@ import 'globals.dart';
/// Information about a build to be performed or used. /// Information about a build to be performed or used.
class BuildInfo { class BuildInfo {
const BuildInfo(this.mode, this.flavor, { const BuildInfo(this.mode, this.flavor, {
this.previewDart2 = true,
this.trackWidgetCreation = false, this.trackWidgetCreation = false,
this.compilationTraceFilePath, this.compilationTraceFilePath,
this.extraFrontEndOptions, this.extraFrontEndOptions,
...@@ -34,9 +33,6 @@ class BuildInfo { ...@@ -34,9 +33,6 @@ class BuildInfo {
/// Mode-Flavor (e.g. Release-Paid). /// Mode-Flavor (e.g. Release-Paid).
final String flavor; final String flavor;
/// Whether build should be done using Dart2 Frontend parser.
final bool previewDart2;
final List<String> fileSystemRoots; final List<String> fileSystemRoots;
final String fileSystemScheme; final String fileSystemScheme;
...@@ -99,7 +95,6 @@ class BuildInfo { ...@@ -99,7 +95,6 @@ class BuildInfo {
BuildInfo withTargetPlatform(TargetPlatform targetPlatform) => BuildInfo withTargetPlatform(TargetPlatform targetPlatform) =>
new BuildInfo(mode, flavor, new BuildInfo(mode, flavor,
previewDart2: previewDart2,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
compilationTraceFilePath: compilationTraceFilePath, compilationTraceFilePath: compilationTraceFilePath,
extraFrontEndOptions: extraFrontEndOptions, extraFrontEndOptions: extraFrontEndOptions,
......
...@@ -344,7 +344,7 @@ class AppDomain extends Domain { ...@@ -344,7 +344,7 @@ class AppDomain extends Domain {
final FlutterDevice flutterDevice = new FlutterDevice( final FlutterDevice flutterDevice = new FlutterDevice(
device, device,
previewDart2: options.buildInfo.previewDart2, previewDart2: true,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
dillOutputPath: dillOutputPath, dillOutputPath: dillOutputPath,
); );
......
...@@ -236,7 +236,7 @@ Future<XcodeBuildResult> buildXcodeProject({ ...@@ -236,7 +236,7 @@ Future<XcodeBuildResult> buildXcodeProject({
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
targetOverride: targetOverride, targetOverride: targetOverride,
previewDart2: buildInfo.previewDart2, previewDart2: true,
buildInfo: buildInfo, buildInfo: buildInfo,
); );
......
...@@ -358,7 +358,6 @@ class IOSSimulator extends Device { ...@@ -358,7 +358,6 @@ class IOSSimulator extends Device {
// The build mode for the simulator is always debug. // The build mode for the simulator is always debug.
final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor, final BuildInfo debugBuildInfo = new BuildInfo(BuildMode.debug, buildInfo.flavor,
previewDart2: buildInfo.previewDart2,
trackWidgetCreation: buildInfo.trackWidgetCreation, trackWidgetCreation: buildInfo.trackWidgetCreation,
extraFrontEndOptions: buildInfo.extraFrontEndOptions, extraFrontEndOptions: buildInfo.extraFrontEndOptions,
extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions, extraGenSnapshotOptions: buildInfo.extraGenSnapshotOptions,
......
...@@ -453,10 +453,7 @@ abstract class ResidentRunner { ...@@ -453,10 +453,7 @@ abstract class ResidentRunner {
String get projectRootPath => _projectRootPath; String get projectRootPath => _projectRootPath;
String _mainPath; String _mainPath;
String get mainPath => _mainPath; String get mainPath => _mainPath;
String getReloadPath({bool fullRestart}) => String getReloadPath({bool fullRestart}) => mainPath + (fullRestart ? '' : '.incremental') + '.dill';
debuggingOptions.buildInfo.previewDart2
? mainPath + (fullRestart? '' : '.incremental') + '.dill'
: mainPath;
AssetBundle _assetBundle; AssetBundle _assetBundle;
AssetBundle get assetBundle => _assetBundle; AssetBundle get assetBundle => _assetBundle;
......
...@@ -436,10 +436,7 @@ class HotRunner extends ResidentRunner { ...@@ -436,10 +436,7 @@ class HotRunner extends ResidentRunner {
} }
// We are now running from source. // We are now running from source.
_runningFromSnapshot = false; _runningFromSnapshot = false;
final String launchPath = debuggingOptions.buildInfo.previewDart2 await _launchFromDevFS(mainPath + '.dill');
? mainPath + '.dill'
: mainPath;
await _launchFromDevFS(launchPath);
restartTimer.stop(); restartTimer.stop();
printTrace('Hot restart performed in ${getElapsedAsMilliseconds(restartTimer.elapsed)}.'); printTrace('Hot restart performed in ${getElapsedAsMilliseconds(restartTimer.elapsed)}.');
// We are now running from sources. // We are now running from sources.
...@@ -529,14 +526,6 @@ class HotRunner extends ResidentRunner { ...@@ -529,14 +526,6 @@ class HotRunner extends ResidentRunner {
} }
} }
String _uriToRelativePath(Uri uri) {
final String path = uri.toString();
final String base = new Uri.file(projectRootPath).toString();
if (path.startsWith(base))
return path.substring(base.length + 1);
return path;
}
Future<OperationResult> _reloadSources({ bool pause = false }) async { Future<OperationResult> _reloadSources({ bool pause = false }) async {
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
for (FlutterView view in device.views) { for (FlutterView view in device.views) {
...@@ -556,7 +545,6 @@ class HotRunner extends ResidentRunner { ...@@ -556,7 +545,6 @@ class HotRunner extends ResidentRunner {
// change from host path to a device path). Subsequent reloads will // change from host path to a device path). Subsequent reloads will
// not be affected, so we resume reporting reload times on the second // not be affected, so we resume reporting reload times on the second
// reload. // reload.
final bool reportUnused = !debuggingOptions.buildInfo.previewDart2;
final bool shouldReportReloadTime = !_runningFromSnapshot; final bool shouldReportReloadTime = !_runningFromSnapshot;
final Stopwatch reloadTimer = new Stopwatch()..start(); final Stopwatch reloadTimer = new Stopwatch()..start();
...@@ -726,36 +714,9 @@ class HotRunner extends ResidentRunner { ...@@ -726,36 +714,9 @@ class HotRunner extends ResidentRunner {
shouldReportReloadTime) shouldReportReloadTime)
flutterUsage.sendTiming('hot', 'reload', reloadTimer.elapsed); flutterUsage.sendTiming('hot', 'reload', reloadTimer.elapsed);
String unusedElementMessage;
if (reportUnused && !reassembleAndScheduleErrors && !reassembleTimedOut) {
final List<Future<List<ProgramElement>>> unusedReports =
<Future<List<ProgramElement>>>[];
for (FlutterDevice device in flutterDevices)
unusedReports.add(device.unusedChangesInLastReload());
final List<ProgramElement> unusedElements = <ProgramElement>[];
for (Future<List<ProgramElement>> unusedReport in unusedReports)
unusedElements.addAll(await unusedReport);
if (unusedElements.isNotEmpty) {
final String restartCommand = hostIsIde ? '' : ' (by pressing "R")';
unusedElementMessage =
'Some program elements were changed during reload but did not run when the view was reassembled;\n'
'you may need to restart the app$restartCommand for the changes to have an effect.';
for (ProgramElement unusedElement in unusedElements) {
final String name = unusedElement.qualifiedName;
final String path = _uriToRelativePath(unusedElement.uri);
final int line = unusedElement.line;
final String description = line == null ? '$name ($path)' : '$name ($path:$line)';
unusedElementMessage += '\n$description';
}
}
}
return new OperationResult( return new OperationResult(
reassembleAndScheduleErrors ? 1 : OperationResult.ok.code, reassembleAndScheduleErrors ? 1 : OperationResult.ok.code,
reloadMessage, reloadMessage,
hintMessage: unusedElementMessage,
hintId: unusedElementMessage != null ? 'restartRecommended' : null,
); );
} }
......
...@@ -239,7 +239,6 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -239,7 +239,6 @@ abstract class FlutterCommand extends Command<Null> {
argParser.options.containsKey('flavor') argParser.options.containsKey('flavor')
? argResults['flavor'] ? argResults['flavor']
: null, : null,
previewDart2: true,
trackWidgetCreation: trackWidgetCreation, trackWidgetCreation: trackWidgetCreation,
compilationTraceFilePath: argParser.options.containsKey('precompile') compilationTraceFilePath: argParser.options.containsKey('precompile')
? argResults['precompile'] ? argResults['precompile']
......
...@@ -136,15 +136,11 @@ class FlutterTesterDevice extends Device { ...@@ -136,15 +136,11 @@ class FlutterTesterDevice extends Device {
precompiledSnapshot: false, precompiledSnapshot: false,
trackWidgetCreation: buildInfo.trackWidgetCreation, trackWidgetCreation: buildInfo.trackWidgetCreation,
); );
if (buildInfo.previewDart2) {
mainPath = applicationKernelFilePath;
}
command.add('--flutter-assets-dir=$assetDirPath'); command.add('--flutter-assets-dir=$assetDirPath');
// TODO(scheglov): Either remove the check, or make it fail earlier. // TODO(scheglov): Either remove the check, or make it fail earlier.
if (mainPath != null) { if (applicationKernelFilePath != null) {
command.add(mainPath); command.add(applicationKernelFilePath);
} }
try { try {
......
...@@ -285,10 +285,7 @@ Information about project "Runner": ...@@ -285,10 +285,7 @@ Information about project "Runner":
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
previewDart2: true,
targetPlatform: TargetPlatform.ios,
);
final FlutterProject project = await FlutterProject.fromPath('path/to/project'); final FlutterProject project = await FlutterProject.fromPath('path/to/project');
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
...@@ -306,11 +303,7 @@ Information about project "Runner": ...@@ -306,11 +303,7 @@ Information about project "Runner":
testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async { testUsingOsxContext('sets TRACK_WIDGET_CREATION=true when trackWidgetCreation is true', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, trackWidgetCreation: true, targetPlatform: TargetPlatform.ios);
previewDart2: true,
trackWidgetCreation: true,
targetPlatform: TargetPlatform.ios,
);
final FlutterProject project = await FlutterProject.fromPath('path/to/project'); final FlutterProject project = await FlutterProject.fromPath('path/to/project');
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
...@@ -328,10 +321,7 @@ Information about project "Runner": ...@@ -328,10 +321,7 @@ Information about project "Runner":
testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async { testUsingOsxContext('does not set TRACK_WIDGET_CREATION when trackWidgetCreation is false', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile_arm'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
previewDart2: true,
targetPlatform: TargetPlatform.ios,
);
final FlutterProject project = await FlutterProject.fromPath('path/to/project'); final FlutterProject project = await FlutterProject.fromPath('path/to/project');
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
project: project, project: project,
...@@ -349,10 +339,7 @@ Information about project "Runner": ...@@ -349,10 +339,7 @@ Information about project "Runner":
testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async { testUsingOsxContext('sets ARCHS=armv7 when armv7 local engine is set', () async {
when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine'); when(mockArtifacts.getArtifactPath(Artifact.flutterFramework, TargetPlatform.ios, any)).thenReturn('engine');
when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile')); when(mockArtifacts.engineOutPath).thenReturn(fs.path.join('out', 'ios_profile'));
const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, const BuildInfo buildInfo = BuildInfo(BuildMode.debug, null, targetPlatform: TargetPlatform.ios);
previewDart2: true,
targetPlatform: TargetPlatform.ios,
);
final FlutterProject project = await FlutterProject.fromPath('path/to/project'); final FlutterProject project = await FlutterProject.fromPath('path/to/project');
await updateGeneratedXcodeProperties( await updateGeneratedXcodeProperties(
......
...@@ -140,8 +140,7 @@ void main() { ...@@ -140,8 +140,7 @@ void main() {
testUsingContext('not debug', () async { testUsingContext('not debug', () async {
final LaunchResult result = await device.startApp(null, final LaunchResult result = await device.startApp(null,
mainPath: mainPath, mainPath: mainPath,
debuggingOptions: new DebuggingOptions.disabled( debuggingOptions: new DebuggingOptions.disabled(const BuildInfo(BuildMode.release, null)));
const BuildInfo(BuildMode.release, null, previewDart2: true)));
expect(result.started, isFalse); expect(result.started, isFalse);
}, overrides: startOverrides); }, overrides: startOverrides);
...@@ -150,8 +149,7 @@ void main() { ...@@ -150,8 +149,7 @@ void main() {
expect(() async { expect(() async {
await device.startApp(null, await device.startApp(null,
mainPath: mainPath, mainPath: mainPath,
debuggingOptions: new DebuggingOptions.disabled( debuggingOptions: new DebuggingOptions.disabled(const BuildInfo(BuildMode.debug, null)));
const BuildInfo(BuildMode.debug, null, previewDart2: true)));
}, throwsToolExit()); }, throwsToolExit());
}, overrides: startOverrides); }, overrides: startOverrides);
...@@ -184,8 +182,7 @@ Hello! ...@@ -184,8 +182,7 @@ Hello!
final LaunchResult result = await device.startApp(null, final LaunchResult result = await device.startApp(null,
mainPath: mainPath, mainPath: mainPath,
debuggingOptions: new DebuggingOptions.enabled( debuggingOptions: new DebuggingOptions.enabled(const BuildInfo(BuildMode.debug, null)));
const BuildInfo(BuildMode.debug, null, previewDart2: true)));
expect(result.started, isTrue); expect(result.started, isTrue);
expect(result.observatoryUri, observatoryUri); expect(result.observatoryUri, observatoryUri);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment