mirror of
https://github.com/encounter/flutter.git
synced 2026-03-30 11:10:35 -07:00
It's time to #deleteDart1 (again) (#18316)
* It's time to #deleteDart1 (#18293) Eliminates support for Dart 1 in flutter_tools, and drops our Dart 1 benchmarks. All commands now run in Dart 1 mode only. Eliminates --preview-dart-2 / --no-preview-dart-2 support. * Fix indentation, remove no longer necessary .toList() * Only push udpated kernel if >0 invalidated srcs
This commit is contained in:
+2
-6
@@ -68,12 +68,8 @@ Future<Null> _generateDocs() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<Null> _verifyInternationalizations() async {
|
Future<Null> _verifyInternationalizations() async {
|
||||||
final EvalResult genResult = await _evalCommand(
|
final EvalResult genResult = await _evalCommand(dart,
|
||||||
dart,
|
<String>[ '--preview-dart-2', path.join('dev', 'tools', 'gen_localizations.dart'), ],
|
||||||
<String>[
|
|
||||||
'--preview-dart-2',
|
|
||||||
path.join('dev', 'tools', 'gen_localizations.dart'),
|
|
||||||
],
|
|
||||||
workingDirectory: flutterRoot,
|
workingDirectory: flutterRoot,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -32,14 +32,6 @@ void main() async {
|
|||||||
return new TaskResult.failure(errorMessage);
|
return new TaskResult.failure(errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
section('gradlew assembleDebug no-preview-dart-2');
|
|
||||||
await project.runGradleTask('assembleDebug', options: <String>['-Ppreview-dart-2=false']);
|
|
||||||
errorMessage = _validateSnapshotDependency(project,
|
|
||||||
'${project.rootPath}/build/app/intermediates/flutter/debug/snapshot_blob.bin');
|
|
||||||
if (errorMessage != null) {
|
|
||||||
return new TaskResult.failure(errorMessage);
|
|
||||||
}
|
|
||||||
|
|
||||||
section('gradlew assembleProfile');
|
section('gradlew assembleProfile');
|
||||||
await project.runGradleTask('assembleProfile');
|
await project.runGradleTask('assembleProfile');
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
// Copyright (c) 2017 The Chromium 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:flutter_devicelab/tasks/hot_mode_tests.dart';
|
|
||||||
import 'package:flutter_devicelab/framework/framework.dart';
|
|
||||||
|
|
||||||
Future<Null> main() async {
|
|
||||||
await task(createHotModeTest(isPreviewDart2: false));
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
// Copyright (c) 2018 The Chromium 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:flutter_devicelab/tasks/hot_mode_tests.dart';
|
|
||||||
import 'package:flutter_devicelab/framework/framework.dart';
|
|
||||||
import 'package:flutter_devicelab/framework/adb.dart';
|
|
||||||
|
|
||||||
Future<Null> main() async {
|
|
||||||
deviceOperatingSystem = DeviceOperatingSystem.ios;
|
|
||||||
await task(createHotModeTest(isPreviewDart2: false));
|
|
||||||
}
|
|
||||||
@@ -16,7 +16,7 @@ import '../framework/utils.dart';
|
|||||||
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
|
final Directory _editedFlutterGalleryDir = dir(path.join(Directory.systemTemp.path, 'edited_flutter_gallery'));
|
||||||
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
|
final Directory flutterGalleryDir = dir(path.join(flutterDirectory.path, 'examples/flutter_gallery'));
|
||||||
|
|
||||||
TaskFunction createHotModeTest({ bool isPreviewDart2 = true }) {
|
TaskFunction createHotModeTest() {
|
||||||
return () async {
|
return () async {
|
||||||
final Device device = await devices.workingDevice;
|
final Device device = await devices.workingDevice;
|
||||||
await device.unlock();
|
await device.unlock();
|
||||||
@@ -25,10 +25,6 @@ TaskFunction createHotModeTest({ bool isPreviewDart2 = true }) {
|
|||||||
final List<String> options = <String>[
|
final List<String> options = <String>[
|
||||||
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident'
|
'--hot', '-d', device.deviceId, '--benchmark', '--verbose', '--resident'
|
||||||
];
|
];
|
||||||
if (isPreviewDart2)
|
|
||||||
options.add('--preview-dart-2');
|
|
||||||
else
|
|
||||||
options.add('--no-preview-dart-2');
|
|
||||||
setLocalEngineOptionIfNecessary(options);
|
setLocalEngineOptionIfNecessary(options);
|
||||||
int hotReloadCount = 0;
|
int hotReloadCount = 0;
|
||||||
Map<String, dynamic> twoReloadsData;
|
Map<String, dynamic> twoReloadsData;
|
||||||
@@ -92,8 +88,8 @@ TaskFunction createHotModeTest({ bool isPreviewDart2 = true }) {
|
|||||||
}
|
}
|
||||||
benchmarkFile.deleteSync();
|
benchmarkFile.deleteSync();
|
||||||
|
|
||||||
// start `flutter run` again to make sure it loads from the previous state
|
// start `flutter run` again to make sure it loads from the previous
|
||||||
// (in case of --preview-dart-2 frontend loads up from previously generated kernel files).
|
// state; frontend loads up from previously generated kernel files.
|
||||||
{
|
{
|
||||||
final Process process = await startProcess(
|
final Process process = await startProcess(
|
||||||
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
path.join(flutterDirectory.path, 'bin', 'flutter'),
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ TaskFunction createMicrobenchmarkTask() {
|
|||||||
final Device device = await devices.workingDevice;
|
final Device device = await devices.workingDevice;
|
||||||
await device.unlock();
|
await device.unlock();
|
||||||
|
|
||||||
Future<Map<String, double>> _runMicrobench(String benchmarkPath, {bool previewDart2 = true}) async {
|
Future<Map<String, double>> _runMicrobench(String benchmarkPath) async {
|
||||||
Future<Map<String, double>> _run() async {
|
Future<Map<String, double>> _run() async {
|
||||||
print('Running $benchmarkPath');
|
print('Running $benchmarkPath');
|
||||||
final Directory appDir = dir(
|
final Directory appDir = dir(
|
||||||
@@ -38,10 +38,6 @@ TaskFunction createMicrobenchmarkTask() {
|
|||||||
'-d',
|
'-d',
|
||||||
device.deviceId,
|
device.deviceId,
|
||||||
];
|
];
|
||||||
if (previewDart2)
|
|
||||||
options.add('--preview-dart-2');
|
|
||||||
else
|
|
||||||
options.add('--no-preview-dart-2');
|
|
||||||
setLocalEngineOptionIfNecessary(options);
|
setLocalEngineOptionIfNecessary(options);
|
||||||
options.add(benchmarkPath);
|
options.add(benchmarkPath);
|
||||||
return await _startFlutter(
|
return await _startFlutter(
|
||||||
@@ -61,26 +57,6 @@ TaskFunction createMicrobenchmarkTask() {
|
|||||||
allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
|
allResults.addAll(await _runMicrobench('lib/gestures/velocity_tracker_bench.dart'));
|
||||||
allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
|
allResults.addAll(await _runMicrobench('lib/stocks/animation_bench.dart'));
|
||||||
|
|
||||||
// Run micro-benchmarks once again in --no-preview-dart-2 mode.
|
|
||||||
// Append "_dart1" suffix to the result keys to distinguish them from
|
|
||||||
// the original results.
|
|
||||||
|
|
||||||
void addDart1Results(Map<String, double> benchmarkResults) {
|
|
||||||
benchmarkResults.forEach((String key, double result) {
|
|
||||||
allResults[key + '_dart1'] = result;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
addDart1Results(await _runMicrobench(
|
|
||||||
'lib/stocks/layout_bench.dart', previewDart2: false));
|
|
||||||
addDart1Results(await _runMicrobench(
|
|
||||||
'lib/stocks/layout_bench.dart', previewDart2: false));
|
|
||||||
addDart1Results(await _runMicrobench(
|
|
||||||
'lib/stocks/build_bench.dart', previewDart2: false));
|
|
||||||
addDart1Results(await _runMicrobench(
|
|
||||||
'lib/gestures/velocity_tracker_bench.dart', previewDart2: false));
|
|
||||||
addDart1Results(await _runMicrobench(
|
|
||||||
'lib/stocks/animation_bench.dart', previewDart2: false));
|
|
||||||
return new TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());
|
return new TaskResult.success(allResults, benchmarkScoreKeys: allResults.keys.toList());
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -205,23 +205,13 @@ class CompileTest {
|
|||||||
final Map<String, dynamic> metrics = <String, dynamic>{}
|
final Map<String, dynamic> metrics = <String, dynamic>{}
|
||||||
..addAll(await _compileAot())
|
..addAll(await _compileAot())
|
||||||
..addAll(await _compileApp())
|
..addAll(await _compileApp())
|
||||||
..addAll(await _compileDebug())
|
..addAll(await _compileDebug());
|
||||||
..addAll(_suffix(await _compileAot(previewDart2: false), '__dart1'))
|
|
||||||
..addAll(_suffix(await _compileApp(previewDart2: false), '__dart1'))
|
|
||||||
..addAll(_suffix(await _compileDebug(previewDart2: false), '__dart1'));
|
|
||||||
|
|
||||||
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
|
return new TaskResult.success(metrics, benchmarkScoreKeys: metrics.keys.toList());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
static Map<String, dynamic> _suffix(Map<String, dynamic> map, String suffix) {
|
static Future<Map<String, dynamic>> _compileAot() async {
|
||||||
return new Map<String, dynamic>.fromIterables(
|
|
||||||
map.keys.map<String>((String key) => '$key$suffix'),
|
|
||||||
map.values,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> _compileAot({ bool previewDart2 = true }) async {
|
|
||||||
// Generate blobs instead of assembly.
|
// Generate blobs instead of assembly.
|
||||||
await flutter('clean');
|
await flutter('clean');
|
||||||
final Stopwatch watch = new Stopwatch()..start();
|
final Stopwatch watch = new Stopwatch()..start();
|
||||||
@@ -240,10 +230,6 @@ class CompileTest {
|
|||||||
options.add('android-arm');
|
options.add('android-arm');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (previewDart2)
|
|
||||||
options.add('--preview-dart-2');
|
|
||||||
else
|
|
||||||
options.add('--no-preview-dart-2');
|
|
||||||
setLocalEngineOptionIfNecessary(options);
|
setLocalEngineOptionIfNecessary(options);
|
||||||
final String compileLog = await evalFlutter('build', options: options);
|
final String compileLog = await evalFlutter('build', options: options);
|
||||||
watch.stop();
|
watch.stop();
|
||||||
@@ -258,15 +244,11 @@ class CompileTest {
|
|||||||
return metrics;
|
return metrics;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> _compileApp({ bool previewDart2 = true }) async {
|
static Future<Map<String, dynamic>> _compileApp() async {
|
||||||
await flutter('clean');
|
await flutter('clean');
|
||||||
final Stopwatch watch = new Stopwatch();
|
final Stopwatch watch = new Stopwatch();
|
||||||
int releaseSizeInBytes;
|
int releaseSizeInBytes;
|
||||||
final List<String> options = <String>['--release'];
|
final List<String> options = <String>['--release'];
|
||||||
if (previewDart2)
|
|
||||||
options.add('--preview-dart-2');
|
|
||||||
else
|
|
||||||
options.add('--no-preview-dart-2');
|
|
||||||
setLocalEngineOptionIfNecessary(options);
|
setLocalEngineOptionIfNecessary(options);
|
||||||
switch (deviceOperatingSystem) {
|
switch (deviceOperatingSystem) {
|
||||||
case DeviceOperatingSystem.ios:
|
case DeviceOperatingSystem.ios:
|
||||||
@@ -299,14 +281,10 @@ class CompileTest {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<Map<String, dynamic>> _compileDebug({ bool previewDart2 = true }) async {
|
static Future<Map<String, dynamic>> _compileDebug() async {
|
||||||
await flutter('clean');
|
await flutter('clean');
|
||||||
final Stopwatch watch = new Stopwatch();
|
final Stopwatch watch = new Stopwatch();
|
||||||
final List<String> options = <String>['--debug'];
|
final List<String> options = <String>['--debug'];
|
||||||
if (previewDart2)
|
|
||||||
options.add('--preview-dart-2');
|
|
||||||
else
|
|
||||||
options.add('--no-preview-dart-2');
|
|
||||||
setLocalEngineOptionIfNecessary(options);
|
setLocalEngineOptionIfNecessary(options);
|
||||||
switch (deviceOperatingSystem) {
|
switch (deviceOperatingSystem) {
|
||||||
case DeviceOperatingSystem.ios:
|
case DeviceOperatingSystem.ios:
|
||||||
|
|||||||
@@ -154,21 +154,6 @@ tasks:
|
|||||||
stage: devicelab
|
stage: devicelab
|
||||||
required_agent_capabilities: ["mac/android"]
|
required_agent_capabilities: ["mac/android"]
|
||||||
|
|
||||||
hot_mode_dev_cycle__benchmark_dart1:
|
|
||||||
description: >
|
|
||||||
Measures the performance of Dart VM hot patching feature under
|
|
||||||
--no-preview-dart-2 option, that disables Dart 2.0 frontend.
|
|
||||||
stage: devicelab
|
|
||||||
required_agent_capabilities: ["mac/android"]
|
|
||||||
|
|
||||||
hot_mode_dev_cycle_ios__benchmark_dart1:
|
|
||||||
description: >
|
|
||||||
Measures the performance of Dart VM hot patching feature under
|
|
||||||
--no-preview-dart-2 option, that disables Dart 2.0 frontend.
|
|
||||||
stage: devicelab_ios
|
|
||||||
required_agent_capabilities: ["mac/ios"]
|
|
||||||
flaky: true
|
|
||||||
|
|
||||||
complex_layout_scroll_perf__memory:
|
complex_layout_scroll_perf__memory:
|
||||||
description: >
|
description: >
|
||||||
Measures memory usage of the scroll performance test.
|
Measures memory usage of the scroll performance test.
|
||||||
|
|||||||
@@ -102,13 +102,6 @@ BuildApp() {
|
|||||||
local_engine_flag="--local-engine=$LOCAL_ENGINE"
|
local_engine_flag="--local-engine=$LOCAL_ENGINE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local preview_dart_2_flag=""
|
|
||||||
if [[ -n "$PREVIEW_DART_2" ]]; then
|
|
||||||
preview_dart_2_flag="--preview-dart-2"
|
|
||||||
else
|
|
||||||
preview_dart_2_flag="--no-preview-dart-2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
local track_widget_creation_flag=""
|
local track_widget_creation_flag=""
|
||||||
if [[ -n "$TRACK_WIDGET_CREATION" ]]; then
|
if [[ -n "$TRACK_WIDGET_CREATION" ]]; then
|
||||||
track_widget_creation_flag="--track-widget-creation"
|
track_widget_creation_flag="--track-widget-creation"
|
||||||
@@ -127,7 +120,6 @@ BuildApp() {
|
|||||||
--${build_mode} \
|
--${build_mode} \
|
||||||
--ios-arch="${archs}" \
|
--ios-arch="${archs}" \
|
||||||
${local_engine_flag} \
|
${local_engine_flag} \
|
||||||
${preview_dart_2_flag} \
|
|
||||||
${track_widget_creation_flag}
|
${track_widget_creation_flag}
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
@@ -167,12 +159,10 @@ BuildApp() {
|
|||||||
${verbose_flag} \
|
${verbose_flag} \
|
||||||
build bundle \
|
build bundle \
|
||||||
--target="${target_path}" \
|
--target="${target_path}" \
|
||||||
--snapshot="${build_dir}/snapshot_blob.bin" \
|
|
||||||
--depfile="${build_dir}/snapshot_blob.bin.d" \
|
--depfile="${build_dir}/snapshot_blob.bin.d" \
|
||||||
--asset-dir="${derived_dir}/flutter_assets" \
|
--asset-dir="${derived_dir}/flutter_assets" \
|
||||||
${precompilation_flag} \
|
${precompilation_flag} \
|
||||||
${local_engine_flag} \
|
${local_engine_flag} \
|
||||||
${preview_dart_2_flag} \
|
|
||||||
${track_widget_creation_flag}
|
${track_widget_creation_flag}
|
||||||
|
|
||||||
if [[ $? -ne 0 ]]; then
|
if [[ $? -ne 0 ]]; then
|
||||||
|
|||||||
@@ -260,10 +260,6 @@ class FlutterPlugin implements Plugin<Project> {
|
|||||||
if (project.hasProperty('verbose')) {
|
if (project.hasProperty('verbose')) {
|
||||||
verboseValue = project.property('verbose').toBoolean()
|
verboseValue = project.property('verbose').toBoolean()
|
||||||
}
|
}
|
||||||
Boolean previewDart2Value = true
|
|
||||||
if (project.hasProperty('preview-dart-2')) {
|
|
||||||
previewDart2Value = project.property('preview-dart-2').toBoolean()
|
|
||||||
}
|
|
||||||
String[] fileSystemRootsValue = null
|
String[] fileSystemRootsValue = null
|
||||||
if (project.hasProperty('filesystem-roots')) {
|
if (project.hasProperty('filesystem-roots')) {
|
||||||
fileSystemRootsValue = project.property('filesystem-roots').split('\\|')
|
fileSystemRootsValue = project.property('filesystem-roots').split('\\|')
|
||||||
@@ -315,7 +311,6 @@ class FlutterPlugin implements Plugin<Project> {
|
|||||||
localEngineSrcPath this.localEngineSrcPath
|
localEngineSrcPath this.localEngineSrcPath
|
||||||
targetPath target
|
targetPath target
|
||||||
verbose verboseValue
|
verbose verboseValue
|
||||||
previewDart2 previewDart2Value
|
|
||||||
fileSystemRoots fileSystemRootsValue
|
fileSystemRoots fileSystemRootsValue
|
||||||
fileSystemScheme fileSystemSchemeValue
|
fileSystemScheme fileSystemSchemeValue
|
||||||
trackWidgetCreation trackWidgetCreationValue
|
trackWidgetCreation trackWidgetCreationValue
|
||||||
@@ -360,8 +355,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
|||||||
@Optional @Input
|
@Optional @Input
|
||||||
Boolean verbose
|
Boolean verbose
|
||||||
@Optional @Input
|
@Optional @Input
|
||||||
Boolean previewDart2
|
|
||||||
@Optional @Input
|
|
||||||
String[] fileSystemRoots
|
String[] fileSystemRoots
|
||||||
@Optional @Input
|
@Optional @Input
|
||||||
String fileSystemScheme
|
String fileSystemScheme
|
||||||
@@ -383,12 +376,10 @@ abstract class BaseFlutterTask extends DefaultTask {
|
|||||||
if (buildMode != 'debug') {
|
if (buildMode != 'debug') {
|
||||||
// For AOT builds, include the gen_snapshot depfile.
|
// For AOT builds, include the gen_snapshot depfile.
|
||||||
FileCollection depfiles = project.files("${intermediateDir}/snapshot.d")
|
FileCollection depfiles = project.files("${intermediateDir}/snapshot.d")
|
||||||
if (previewDart2) {
|
// Include the kernel compiler depfile, since kernel compile is the
|
||||||
// For Dart 2, also include the kernel compiler depfile, since
|
// first stage of AOT build in this mode, and it includes all the
|
||||||
// kernel compile is the first stage of AOT build in this mode,
|
// Dart sources.
|
||||||
// and it includes all the Dart sources.
|
depfiles += project.files("${intermediateDir}/kernel_compile.d")
|
||||||
depfiles += project.files("${intermediateDir}/kernel_compile.d")
|
|
||||||
}
|
|
||||||
return depfiles
|
return depfiles
|
||||||
}
|
}
|
||||||
return project.files("${intermediateDir}/snapshot_blob.bin.d")
|
return project.files("${intermediateDir}/snapshot_blob.bin.d")
|
||||||
@@ -415,11 +406,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
|||||||
args "--target", targetPath
|
args "--target", targetPath
|
||||||
args "--target-platform", "android-arm"
|
args "--target-platform", "android-arm"
|
||||||
args "--output-dir", "${intermediateDir}"
|
args "--output-dir", "${intermediateDir}"
|
||||||
if (previewDart2) {
|
|
||||||
args "--preview-dart-2"
|
|
||||||
} else {
|
|
||||||
args "--no-preview-dart-2"
|
|
||||||
}
|
|
||||||
if (trackWidgetCreation) {
|
if (trackWidgetCreation) {
|
||||||
args "--track-widget-creation"
|
args "--track-widget-creation"
|
||||||
}
|
}
|
||||||
@@ -452,11 +438,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
|||||||
if (verbose) {
|
if (verbose) {
|
||||||
args "--verbose"
|
args "--verbose"
|
||||||
}
|
}
|
||||||
if (previewDart2) {
|
|
||||||
args "--preview-dart-2"
|
|
||||||
} else {
|
|
||||||
args "--no-preview-dart-2"
|
|
||||||
}
|
|
||||||
if (fileSystemRoots != null) {
|
if (fileSystemRoots != null) {
|
||||||
for (root in fileSystemRoots) {
|
for (root in fileSystemRoots) {
|
||||||
args "--filesystem-root", root
|
args "--filesystem-root", root
|
||||||
@@ -475,9 +456,6 @@ abstract class BaseFlutterTask extends DefaultTask {
|
|||||||
args "--precompiled"
|
args "--precompiled"
|
||||||
} else {
|
} else {
|
||||||
args "--depfile", "${intermediateDir}/snapshot_blob.bin.d"
|
args "--depfile", "${intermediateDir}/snapshot_blob.bin.d"
|
||||||
if (!previewDart2) {
|
|
||||||
args "--snapshot", "${intermediateDir}/snapshot_blob.bin"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
args "--asset-dir", "${intermediateDir}/flutter_assets"
|
args "--asset-dir", "${intermediateDir}/flutter_assets"
|
||||||
}
|
}
|
||||||
@@ -533,9 +511,7 @@ class FlutterTask extends BaseFlutterTask {
|
|||||||
// We have a dependencies file. Add a dependency on gen_snapshot as well, since the
|
// We have a dependencies file. Add a dependency on gen_snapshot as well, since the
|
||||||
// snapshots have to be rebuilt if it changes.
|
// snapshots have to be rebuilt if it changes.
|
||||||
sources += readDependencies(project.file("${intermediateDir}/gen_snapshot.d"))
|
sources += readDependencies(project.file("${intermediateDir}/gen_snapshot.d"))
|
||||||
if (previewDart2) {
|
sources += readDependencies(project.file("${intermediateDir}/frontend_server.d"))
|
||||||
sources += readDependencies(project.file("${intermediateDir}/frontend_server.d"))
|
|
||||||
}
|
|
||||||
if (localEngineSrcPath != null) {
|
if (localEngineSrcPath != null) {
|
||||||
sources += project.files("$localEngineSrcPath/$localEngine")
|
sources += project.files("$localEngineSrcPath/$localEngine")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -327,21 +327,16 @@ Future<Null> _buildGradleProjectV2(String gradle, BuildInfo buildInfo, String ta
|
|||||||
if (target != null) {
|
if (target != null) {
|
||||||
command.add('-Ptarget=$target');
|
command.add('-Ptarget=$target');
|
||||||
}
|
}
|
||||||
if (buildInfo.previewDart2) {
|
if (buildInfo.trackWidgetCreation)
|
||||||
command.add('-Ppreview-dart-2=true');
|
command.add('-Ptrack-widget-creation=true');
|
||||||
if (buildInfo.trackWidgetCreation)
|
if (buildInfo.extraFrontEndOptions != null)
|
||||||
command.add('-Ptrack-widget-creation=true');
|
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
|
||||||
if (buildInfo.extraFrontEndOptions != null)
|
if (buildInfo.extraGenSnapshotOptions != null)
|
||||||
command.add('-Pextra-front-end-options=${buildInfo.extraFrontEndOptions}');
|
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
|
||||||
if (buildInfo.extraGenSnapshotOptions != null)
|
if (buildInfo.fileSystemRoots != null && buildInfo.fileSystemRoots.isNotEmpty)
|
||||||
command.add('-Pextra-gen-snapshot-options=${buildInfo.extraGenSnapshotOptions}');
|
command.add('-Pfilesystem-roots=${buildInfo.fileSystemRoots.join('|')}');
|
||||||
if (buildInfo.fileSystemRoots != null && buildInfo.fileSystemRoots.isNotEmpty)
|
if (buildInfo.fileSystemScheme != null)
|
||||||
command.add('-Pfilesystem-roots=${buildInfo.fileSystemRoots.join('|')}');
|
command.add('-Pfilesystem-scheme=${buildInfo.fileSystemScheme}');
|
||||||
if (buildInfo.fileSystemScheme != null)
|
|
||||||
command.add('-Pfilesystem-scheme=${buildInfo.fileSystemScheme}');
|
|
||||||
} else {
|
|
||||||
command.add('-Ppreview-dart-2=false');
|
|
||||||
}
|
|
||||||
if (buildInfo.buildSharedLibrary && androidSdk.ndk != null) {
|
if (buildInfo.buildSharedLibrary && androidSdk.ndk != null) {
|
||||||
command.add('-Pbuild-shared-library=true');
|
command.add('-Pbuild-shared-library=true');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,70 +64,6 @@ class GenSnapshot {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dart snapshot builder.
|
|
||||||
///
|
|
||||||
/// Builds Dart snapshots in one of three modes:
|
|
||||||
/// * Script snapshot: architecture-independent snapshot of a Dart script
|
|
||||||
/// and core libraries.
|
|
||||||
/// * AOT snapshot: architecture-specific ahead-of-time compiled snapshot
|
|
||||||
/// suitable for loading with `mmap`.
|
|
||||||
/// * Assembly AOT snapshot: architecture-specific ahead-of-time compile to
|
|
||||||
/// assembly suitable for compilation as a static or dynamic library.
|
|
||||||
class ScriptSnapshotter {
|
|
||||||
/// Builds an architecture-independent snapshot of the specified script.
|
|
||||||
Future<int> build({
|
|
||||||
@required String mainPath,
|
|
||||||
@required String snapshotPath,
|
|
||||||
@required String depfilePath,
|
|
||||||
@required String packagesPath
|
|
||||||
}) async {
|
|
||||||
final SnapshotType snapshotType = new SnapshotType(null, BuildMode.debug);
|
|
||||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData);
|
|
||||||
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData);
|
|
||||||
final List<String> args = <String>[
|
|
||||||
'--snapshot_kind=script',
|
|
||||||
'--script_snapshot=$snapshotPath',
|
|
||||||
'--vm_snapshot_data=$vmSnapshotData',
|
|
||||||
'--isolate_snapshot_data=$isolateSnapshotData',
|
|
||||||
'--enable-mirrors=false',
|
|
||||||
mainPath,
|
|
||||||
];
|
|
||||||
|
|
||||||
final Fingerprinter fingerprinter = new Fingerprinter(
|
|
||||||
fingerprintPath: '$depfilePath.fingerprint',
|
|
||||||
paths: <String>[
|
|
||||||
mainPath,
|
|
||||||
snapshotPath,
|
|
||||||
vmSnapshotData,
|
|
||||||
isolateSnapshotData,
|
|
||||||
],
|
|
||||||
properties: <String, String>{
|
|
||||||
'buildMode': snapshotType.mode.toString(),
|
|
||||||
'targetPlatform': snapshotType.platform?.toString() ?? '',
|
|
||||||
'entryPoint': mainPath,
|
|
||||||
},
|
|
||||||
depfilePaths: <String>[depfilePath],
|
|
||||||
);
|
|
||||||
if (await fingerprinter.doesFingerprintMatch()) {
|
|
||||||
printTrace('Skipping script snapshot build. Fingerprints match.');
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build the snapshot.
|
|
||||||
final int exitCode = await genSnapshot.run(
|
|
||||||
snapshotType: snapshotType,
|
|
||||||
packagesPath: packagesPath,
|
|
||||||
depfilePath: depfilePath,
|
|
||||||
additionalArgs: args,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (exitCode != 0)
|
|
||||||
return exitCode;
|
|
||||||
await fingerprinter.writeFingerprint();
|
|
||||||
return exitCode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class AOTSnapshotter {
|
class AOTSnapshotter {
|
||||||
/// Builds an architecture-specific ahead-of-time compiled snapshot of the specified script.
|
/// Builds an architecture-specific ahead-of-time compiled snapshot of the specified script.
|
||||||
Future<int> build({
|
Future<int> build({
|
||||||
@@ -136,7 +72,6 @@ class AOTSnapshotter {
|
|||||||
@required String mainPath,
|
@required String mainPath,
|
||||||
@required String packagesPath,
|
@required String packagesPath,
|
||||||
@required String outputPath,
|
@required String outputPath,
|
||||||
@required bool previewDart2,
|
|
||||||
@required bool buildSharedLibrary,
|
@required bool buildSharedLibrary,
|
||||||
IOSArch iosArch,
|
IOSArch iosArch,
|
||||||
List<String> extraGenSnapshotOptions = const <String>[],
|
List<String> extraGenSnapshotOptions = const <String>[],
|
||||||
@@ -192,12 +127,10 @@ class AOTSnapshotter {
|
|||||||
'--embedder_entry_points_manifest=$ioEntryPoints',
|
'--embedder_entry_points_manifest=$ioEntryPoints',
|
||||||
'--dependencies=$depfilePath',
|
'--dependencies=$depfilePath',
|
||||||
];
|
];
|
||||||
if (previewDart2) {
|
genSnapshotArgs.addAll(<String>[
|
||||||
genSnapshotArgs.addAll(<String>[
|
'--reify-generic-functions',
|
||||||
'--reify-generic-functions',
|
'--strong',
|
||||||
'--strong',
|
]);
|
||||||
]);
|
|
||||||
}
|
|
||||||
if (extraGenSnapshotOptions != null && extraGenSnapshotOptions.isNotEmpty) {
|
if (extraGenSnapshotOptions != null && extraGenSnapshotOptions.isNotEmpty) {
|
||||||
printTrace('Extra gen_snapshot options: $extraGenSnapshotOptions');
|
printTrace('Extra gen_snapshot options: $extraGenSnapshotOptions');
|
||||||
genSnapshotArgs.addAll(extraGenSnapshotOptions);
|
genSnapshotArgs.addAll(extraGenSnapshotOptions);
|
||||||
@@ -252,7 +185,6 @@ class AOTSnapshotter {
|
|||||||
'buildMode': buildMode.toString(),
|
'buildMode': buildMode.toString(),
|
||||||
'targetPlatform': platform.toString(),
|
'targetPlatform': platform.toString(),
|
||||||
'entryPoint': mainPath,
|
'entryPoint': mainPath,
|
||||||
'dart2': previewDart2.toString(),
|
|
||||||
'sharedLib': buildSharedLibrary.toString(),
|
'sharedLib': buildSharedLibrary.toString(),
|
||||||
'extraGenSnapshotOptions': extraGenSnapshotOptions.join(' '),
|
'extraGenSnapshotOptions': extraGenSnapshotOptions.join(' '),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -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 = false,
|
|
||||||
this.trackWidgetCreation = false,
|
this.trackWidgetCreation = false,
|
||||||
this.extraFrontEndOptions,
|
this.extraFrontEndOptions,
|
||||||
this.extraGenSnapshotOptions,
|
this.extraGenSnapshotOptions,
|
||||||
@@ -33,9 +32,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;
|
||||||
|
|
||||||
@@ -93,7 +89,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,
|
||||||
extraFrontEndOptions: extraFrontEndOptions,
|
extraFrontEndOptions: extraFrontEndOptions,
|
||||||
extraGenSnapshotOptions: extraGenSnapshotOptions,
|
extraGenSnapshotOptions: extraGenSnapshotOptions,
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'artifacts.dart';
|
import 'artifacts.dart';
|
||||||
import 'asset.dart';
|
import 'asset.dart';
|
||||||
import 'base/build.dart';
|
|
||||||
import 'base/common.dart';
|
import 'base/common.dart';
|
||||||
import 'base/file_system.dart';
|
import 'base/file_system.dart';
|
||||||
import 'build_info.dart';
|
import 'build_info.dart';
|
||||||
@@ -24,7 +23,6 @@ String get defaultApplicationKernelPath => fs.path.join(getBuildDirectory(), 'ap
|
|||||||
const String defaultPrivateKeyPath = 'privatekey.der';
|
const String defaultPrivateKeyPath = 'privatekey.der';
|
||||||
|
|
||||||
const String _kKernelKey = 'kernel_blob.bin';
|
const String _kKernelKey = 'kernel_blob.bin';
|
||||||
const String _kSnapshotKey = 'snapshot_blob.bin';
|
|
||||||
const String _kVMSnapshotData = 'vm_snapshot_data';
|
const String _kVMSnapshotData = 'vm_snapshot_data';
|
||||||
const String _kIsolateSnapshotData = 'isolate_snapshot_data';
|
const String _kIsolateSnapshotData = 'isolate_snapshot_data';
|
||||||
const String _kDylibKey = 'libapp.so';
|
const String _kDylibKey = 'libapp.so';
|
||||||
@@ -33,13 +31,11 @@ const String _kPlatformKernelKey = 'platform.dill';
|
|||||||
Future<void> build({
|
Future<void> build({
|
||||||
String mainPath = defaultMainPath,
|
String mainPath = defaultMainPath,
|
||||||
String manifestPath = defaultManifestPath,
|
String manifestPath = defaultManifestPath,
|
||||||
String snapshotPath,
|
|
||||||
String applicationKernelFilePath,
|
String applicationKernelFilePath,
|
||||||
String depfilePath,
|
String depfilePath,
|
||||||
String privateKeyPath = defaultPrivateKeyPath,
|
String privateKeyPath = defaultPrivateKeyPath,
|
||||||
String assetDirPath,
|
String assetDirPath,
|
||||||
String packagesPath,
|
String packagesPath,
|
||||||
bool previewDart2 = false,
|
|
||||||
bool precompiledSnapshot = false,
|
bool precompiledSnapshot = false,
|
||||||
bool reportLicensedPackages = false,
|
bool reportLicensedPackages = false,
|
||||||
bool trackWidgetCreation = false,
|
bool trackWidgetCreation = false,
|
||||||
@@ -47,32 +43,13 @@ Future<void> build({
|
|||||||
List<String> fileSystemRoots,
|
List<String> fileSystemRoots,
|
||||||
String fileSystemScheme,
|
String fileSystemScheme,
|
||||||
}) async {
|
}) async {
|
||||||
snapshotPath ??= defaultSnapshotPath;
|
|
||||||
depfilePath ??= defaultDepfilePath;
|
depfilePath ??= defaultDepfilePath;
|
||||||
assetDirPath ??= getAssetBuildDirectory();
|
assetDirPath ??= getAssetBuildDirectory();
|
||||||
packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
|
packagesPath ??= fs.path.absolute(PackageMap.globalPackagesPath);
|
||||||
applicationKernelFilePath ??= defaultApplicationKernelPath;
|
applicationKernelFilePath ??= defaultApplicationKernelPath;
|
||||||
File snapshotFile;
|
|
||||||
|
|
||||||
if (!precompiledSnapshot && !previewDart2) {
|
|
||||||
ensureDirectoryExists(snapshotPath);
|
|
||||||
|
|
||||||
// In a precompiled snapshot, the instruction buffer contains script
|
|
||||||
// content equivalents
|
|
||||||
final int result = await new ScriptSnapshotter().build(
|
|
||||||
mainPath: mainPath,
|
|
||||||
snapshotPath: snapshotPath,
|
|
||||||
depfilePath: depfilePath,
|
|
||||||
packagesPath: packagesPath,
|
|
||||||
);
|
|
||||||
if (result != 0)
|
|
||||||
throwToolExit('Failed to run the Flutter compiler. Exit code: $result', exitCode: result);
|
|
||||||
|
|
||||||
snapshotFile = fs.file(snapshotPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
DevFSContent kernelContent;
|
DevFSContent kernelContent;
|
||||||
if (!precompiledSnapshot && previewDart2) {
|
if (!precompiledSnapshot) {
|
||||||
if ((extraFrontEndOptions != null) && extraFrontEndOptions.isNotEmpty)
|
if ((extraFrontEndOptions != null) && extraFrontEndOptions.isNotEmpty)
|
||||||
printTrace('Extra front-end options: $extraFrontEndOptions');
|
printTrace('Extra front-end options: $extraFrontEndOptions');
|
||||||
ensureDirectoryExists(applicationKernelFilePath);
|
ensureDirectoryExists(applicationKernelFilePath);
|
||||||
@@ -109,7 +86,6 @@ Future<void> build({
|
|||||||
await assemble(
|
await assemble(
|
||||||
assetBundle: assets,
|
assetBundle: assets,
|
||||||
kernelContent: kernelContent,
|
kernelContent: kernelContent,
|
||||||
snapshotFile: snapshotFile,
|
|
||||||
privateKeyPath: privateKeyPath,
|
privateKeyPath: privateKeyPath,
|
||||||
assetDirPath: assetDirPath,
|
assetDirPath: assetDirPath,
|
||||||
);
|
);
|
||||||
@@ -143,7 +119,6 @@ Future<AssetBundle> buildAssets({
|
|||||||
Future<void> assemble({
|
Future<void> assemble({
|
||||||
AssetBundle assetBundle,
|
AssetBundle assetBundle,
|
||||||
DevFSContent kernelContent,
|
DevFSContent kernelContent,
|
||||||
File snapshotFile,
|
|
||||||
File dylibFile,
|
File dylibFile,
|
||||||
String privateKeyPath = defaultPrivateKeyPath,
|
String privateKeyPath = defaultPrivateKeyPath,
|
||||||
String assetDirPath,
|
String assetDirPath,
|
||||||
@@ -152,21 +127,16 @@ Future<void> assemble({
|
|||||||
printTrace('Building bundle');
|
printTrace('Building bundle');
|
||||||
|
|
||||||
final Map<String, DevFSContent> assetEntries = new Map<String, DevFSContent>.from(assetBundle.entries);
|
final Map<String, DevFSContent> assetEntries = new Map<String, DevFSContent>.from(assetBundle.entries);
|
||||||
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData);
|
|
||||||
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData);
|
|
||||||
|
|
||||||
if (kernelContent != null) {
|
if (kernelContent != null) {
|
||||||
final String platformKernelDill = artifacts.getArtifactPath(Artifact.platformKernelDill);
|
final String platformKernelDill = artifacts.getArtifactPath(Artifact.platformKernelDill);
|
||||||
|
final String vmSnapshotData = artifacts.getArtifactPath(Artifact.vmSnapshotData);
|
||||||
|
final String isolateSnapshotData = artifacts.getArtifactPath(Artifact.isolateSnapshotData);
|
||||||
assetEntries[_kKernelKey] = kernelContent;
|
assetEntries[_kKernelKey] = kernelContent;
|
||||||
assetEntries[_kPlatformKernelKey] = new DevFSFileContent(fs.file(platformKernelDill));
|
assetEntries[_kPlatformKernelKey] = new DevFSFileContent(fs.file(platformKernelDill));
|
||||||
assetEntries[_kVMSnapshotData] = new DevFSFileContent(fs.file(vmSnapshotData));
|
assetEntries[_kVMSnapshotData] = new DevFSFileContent(fs.file(vmSnapshotData));
|
||||||
assetEntries[_kIsolateSnapshotData] = new DevFSFileContent(fs.file(isolateSnapshotData));
|
assetEntries[_kIsolateSnapshotData] = new DevFSFileContent(fs.file(isolateSnapshotData));
|
||||||
}
|
}
|
||||||
if (snapshotFile != null) {
|
|
||||||
assetEntries[_kSnapshotKey] = new DevFSFileContent(snapshotFile);
|
|
||||||
assetEntries[_kVMSnapshotData] = new DevFSFileContent(fs.file(vmSnapshotData));
|
|
||||||
assetEntries[_kIsolateSnapshotData] = new DevFSFileContent(fs.file(isolateSnapshotData));
|
|
||||||
}
|
|
||||||
if (dylibFile != null)
|
if (dylibFile != null)
|
||||||
assetEntries[_kDylibKey] = new DevFSFileContent(dylibFile);
|
assetEntries[_kDylibKey] = new DevFSFileContent(dylibFile);
|
||||||
|
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
argParser.addFlag('watch',
|
argParser.addFlag('watch',
|
||||||
help: 'Run analysis continuously, watching the filesystem for changes.',
|
help: 'Run analysis continuously, watching the filesystem for changes.',
|
||||||
negatable: false);
|
negatable: false);
|
||||||
argParser.addFlag('preview-dart-2',
|
|
||||||
defaultsTo: true, help: 'Preview Dart 2.0 functionality.');
|
|
||||||
argParser.addOption('write',
|
argParser.addOption('write',
|
||||||
valueHelp: 'file',
|
valueHelp: 'file',
|
||||||
help: 'Also output the results to a file. This is useful with --watch '
|
help: 'Also output the results to a file. This is useful with --watch '
|
||||||
@@ -87,7 +85,6 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
argResults,
|
argResults,
|
||||||
runner.getRepoRoots(),
|
runner.getRepoRoots(),
|
||||||
runner.getRepoPackages(),
|
runner.getRepoPackages(),
|
||||||
previewDart2: argResults['preview-dart-2'],
|
|
||||||
).analyze();
|
).analyze();
|
||||||
} else {
|
} else {
|
||||||
return new AnalyzeOnce(
|
return new AnalyzeOnce(
|
||||||
@@ -95,7 +92,6 @@ class AnalyzeCommand extends FlutterCommand {
|
|||||||
runner.getRepoRoots(),
|
runner.getRepoRoots(),
|
||||||
runner.getRepoPackages(),
|
runner.getRepoPackages(),
|
||||||
workingDirectory: workingDirectory,
|
workingDirectory: workingDirectory,
|
||||||
previewDart2: argResults['preview-dart-2'],
|
|
||||||
).analyze();
|
).analyze();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,13 +19,10 @@ import '../globals.dart';
|
|||||||
import 'analyze_base.dart';
|
import 'analyze_base.dart';
|
||||||
|
|
||||||
class AnalyzeContinuously extends AnalyzeBase {
|
class AnalyzeContinuously extends AnalyzeBase {
|
||||||
AnalyzeContinuously(ArgResults argResults, this.repoRoots, this.repoPackages, {
|
AnalyzeContinuously(ArgResults argResults, this.repoRoots, this.repoPackages) : super(argResults);
|
||||||
this.previewDart2 = false,
|
|
||||||
}) : super(argResults);
|
|
||||||
|
|
||||||
final List<String> repoRoots;
|
final List<String> repoRoots;
|
||||||
final List<Directory> repoPackages;
|
final List<Directory> repoPackages;
|
||||||
final bool previewDart2;
|
|
||||||
|
|
||||||
String analysisTarget;
|
String analysisTarget;
|
||||||
bool firstAnalysis = true;
|
bool firstAnalysis = true;
|
||||||
@@ -60,7 +57,7 @@ class AnalyzeContinuously extends AnalyzeBase {
|
|||||||
|
|
||||||
final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath;
|
final String sdkPath = argResults['dart-sdk'] ?? sdk.dartSdkPath;
|
||||||
|
|
||||||
final AnalysisServer server = new AnalysisServer(sdkPath, directories, previewDart2: previewDart2);
|
final AnalysisServer server = new AnalysisServer(sdkPath, directories);
|
||||||
server.onAnalyzing.listen((bool isAnalyzing) => _handleAnalysisStatus(server, isAnalyzing));
|
server.onAnalyzing.listen((bool isAnalyzing) => _handleAnalysisStatus(server, isAnalyzing));
|
||||||
server.onErrors.listen(_handleAnalysisErrors);
|
server.onErrors.listen(_handleAnalysisErrors);
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
this.repoRoots,
|
this.repoRoots,
|
||||||
this.repoPackages, {
|
this.repoPackages, {
|
||||||
this.workingDirectory,
|
this.workingDirectory,
|
||||||
this.previewDart2 = false,
|
|
||||||
}) : super(argResults);
|
}) : super(argResults);
|
||||||
|
|
||||||
final List<String> repoRoots;
|
final List<String> repoRoots;
|
||||||
@@ -33,8 +32,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
/// The working directory for testing analysis using dartanalyzer.
|
/// The working directory for testing analysis using dartanalyzer.
|
||||||
final Directory workingDirectory;
|
final Directory workingDirectory;
|
||||||
|
|
||||||
final bool previewDart2;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<Null> analyze() async {
|
Future<Null> analyze() async {
|
||||||
final String currentDirectory =
|
final String currentDirectory =
|
||||||
@@ -91,7 +88,6 @@ class AnalyzeOnce extends AnalyzeBase {
|
|||||||
final AnalysisServer server = new AnalysisServer(
|
final AnalysisServer server = new AnalysisServer(
|
||||||
sdkPath,
|
sdkPath,
|
||||||
directories.toList(),
|
directories.toList(),
|
||||||
previewDart2: previewDart2,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
StreamSubscription<bool> subscription;
|
StreamSubscription<bool> subscription;
|
||||||
|
|||||||
@@ -28,11 +28,6 @@ class BuildAotCommand extends BuildSubCommand {
|
|||||||
allowed: <String>['android-arm', 'android-arm64', 'ios']
|
allowed: <String>['android-arm', 'android-arm64', 'ios']
|
||||||
)
|
)
|
||||||
..addFlag('quiet', defaultsTo: false)
|
..addFlag('quiet', defaultsTo: false)
|
||||||
..addFlag('preview-dart-2',
|
|
||||||
defaultsTo: true,
|
|
||||||
hide: !verboseHelp,
|
|
||||||
help: 'Preview Dart 2.0 functionality.',
|
|
||||||
)
|
|
||||||
..addFlag('build-shared-library',
|
..addFlag('build-shared-library',
|
||||||
negatable: false,
|
negatable: false,
|
||||||
defaultsTo: false,
|
defaultsTo: false,
|
||||||
@@ -79,23 +74,20 @@ class BuildAotCommand extends BuildSubCommand {
|
|||||||
}
|
}
|
||||||
final String outputPath = argResults['output-dir'] ?? getAotBuildDirectory();
|
final String outputPath = argResults['output-dir'] ?? getAotBuildDirectory();
|
||||||
try {
|
try {
|
||||||
final bool previewDart2 = argResults['preview-dart-2'];
|
|
||||||
String mainPath = findMainDartFile(targetFile);
|
String mainPath = findMainDartFile(targetFile);
|
||||||
final AOTSnapshotter snapshotter = new AOTSnapshotter();
|
final AOTSnapshotter snapshotter = new AOTSnapshotter();
|
||||||
|
|
||||||
// Compile to kernel, if Dart 2.
|
// Compile to kernel.
|
||||||
if (previewDart2) {
|
mainPath = await snapshotter.compileKernel(
|
||||||
mainPath = await snapshotter.compileKernel(
|
platform: platform,
|
||||||
platform: platform,
|
buildMode: buildMode,
|
||||||
buildMode: buildMode,
|
mainPath: mainPath,
|
||||||
mainPath: mainPath,
|
outputPath: outputPath,
|
||||||
outputPath: outputPath,
|
extraFrontEndOptions: argResults[FlutterOptions.kExtraFrontEndOptions],
|
||||||
extraFrontEndOptions: argResults[FlutterOptions.kExtraFrontEndOptions],
|
);
|
||||||
);
|
if (mainPath == null) {
|
||||||
if (mainPath == null) {
|
printError('Compiler terminated unexpectedly.');
|
||||||
printError('Compiler terminated unexpectedly.');
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build AOT snapshot.
|
// Build AOT snapshot.
|
||||||
@@ -116,7 +108,6 @@ class BuildAotCommand extends BuildSubCommand {
|
|||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
packagesPath: PackageMap.globalPackagesPath,
|
packagesPath: PackageMap.globalPackagesPath,
|
||||||
outputPath: outputPath,
|
outputPath: outputPath,
|
||||||
previewDart2: previewDart2,
|
|
||||||
buildSharedLibrary: false,
|
buildSharedLibrary: false,
|
||||||
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
|
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
|
||||||
).then((int buildExitCode) {
|
).then((int buildExitCode) {
|
||||||
@@ -143,7 +134,6 @@ class BuildAotCommand extends BuildSubCommand {
|
|||||||
mainPath: mainPath,
|
mainPath: mainPath,
|
||||||
packagesPath: PackageMap.globalPackagesPath,
|
packagesPath: PackageMap.globalPackagesPath,
|
||||||
outputPath: outputPath,
|
outputPath: outputPath,
|
||||||
previewDart2: previewDart2,
|
|
||||||
buildSharedLibrary: argResults['build-shared-library'],
|
buildSharedLibrary: argResults['build-shared-library'],
|
||||||
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
|
extraGenSnapshotOptions: argResults[FlutterOptions.kExtraGenSnapshotOptions],
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -17,11 +17,6 @@ class BuildApkCommand extends BuildSubCommand {
|
|||||||
usesBuildNameOption();
|
usesBuildNameOption();
|
||||||
|
|
||||||
argParser
|
argParser
|
||||||
..addFlag('preview-dart-2',
|
|
||||||
defaultsTo: true,
|
|
||||||
hide: !verboseHelp,
|
|
||||||
help: 'Preview Dart 2.0 functionality.',
|
|
||||||
)
|
|
||||||
..addFlag('track-widget-creation', negatable: false, hide: !verboseHelp)
|
..addFlag('track-widget-creation', negatable: false, hide: !verboseHelp)
|
||||||
..addFlag('build-shared-library',
|
..addFlag('build-shared-library',
|
||||||
negatable: false,
|
negatable: false,
|
||||||
|
|||||||
@@ -19,14 +19,8 @@ class BuildBundleCommand extends BuildSubCommand {
|
|||||||
..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp)
|
..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp)
|
||||||
..addOption('manifest', defaultsTo: defaultManifestPath)
|
..addOption('manifest', defaultsTo: defaultManifestPath)
|
||||||
..addOption('private-key', defaultsTo: defaultPrivateKeyPath)
|
..addOption('private-key', defaultsTo: defaultPrivateKeyPath)
|
||||||
..addOption('snapshot', defaultsTo: defaultSnapshotPath)
|
|
||||||
..addOption('depfile', defaultsTo: defaultDepfilePath)
|
..addOption('depfile', defaultsTo: defaultDepfilePath)
|
||||||
..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath)
|
..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath)
|
||||||
..addFlag('preview-dart-2',
|
|
||||||
defaultsTo: true,
|
|
||||||
hide: !verboseHelp,
|
|
||||||
help: 'Preview Dart 2.0 functionality.',
|
|
||||||
)
|
|
||||||
..addFlag('track-widget-creation',
|
..addFlag('track-widget-creation',
|
||||||
hide: !verboseHelp,
|
hide: !verboseHelp,
|
||||||
help: 'Track widget creation locations. Requires Dart 2.0 functionality.',
|
help: 'Track widget creation locations. Requires Dart 2.0 functionality.',
|
||||||
@@ -72,12 +66,10 @@ class BuildBundleCommand extends BuildSubCommand {
|
|||||||
await build(
|
await build(
|
||||||
mainPath: targetFile,
|
mainPath: targetFile,
|
||||||
manifestPath: argResults['manifest'],
|
manifestPath: argResults['manifest'],
|
||||||
snapshotPath: argResults['snapshot'],
|
|
||||||
applicationKernelFilePath: argResults['kernel-file'],
|
applicationKernelFilePath: argResults['kernel-file'],
|
||||||
depfilePath: argResults['depfile'],
|
depfilePath: argResults['depfile'],
|
||||||
privateKeyPath: argResults['private-key'],
|
privateKeyPath: argResults['private-key'],
|
||||||
assetDirPath: argResults['asset-dir'],
|
assetDirPath: argResults['asset-dir'],
|
||||||
previewDart2: argResults['preview-dart-2'],
|
|
||||||
precompiledSnapshot: argResults['precompiled'],
|
precompiledSnapshot: argResults['precompiled'],
|
||||||
reportLicensedPackages: argResults['report-licensed-packages'],
|
reportLicensedPackages: argResults['report-licensed-packages'],
|
||||||
trackWidgetCreation: argResults['track-widget-creation'],
|
trackWidgetCreation: argResults['track-widget-creation'],
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user