Unverified Commit 71b2cfb2 authored by Vyacheslav Egorov's avatar Vyacheslav Egorov Committed by GitHub

Turn Dart 2 mode by default. (#15565)

parent c663e336
...@@ -6,7 +6,6 @@ osx_image: xcode9.2 ...@@ -6,7 +6,6 @@ osx_image: xcode9.2
env: env:
- SHARD=analyze - SHARD=analyze
- SHARD=tests - SHARD=tests
- SHARD=tests_dart2
- SHARD=docs - SHARD=docs
- SHARD=build_and_deploy_gallery - SHARD=build_and_deploy_gallery
matrix: matrix:
......
...@@ -8,8 +8,7 @@ When the exception was thrown, this was the stack: ...@@ -8,8 +8,7 @@ When the exception was thrown, this was the stack:
<asynchronous suspension> <asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>> <<skip until matching line>>
^\(elided [0-9]+ .+[^)]$ ^\(elided [0-9]+ .+\)$
^.+\)$
The test description was: The test description was:
Exception handling in test harness - string Exception handling in test harness - string
...@@ -28,8 +27,7 @@ When the exception was thrown, this was the stack: ...@@ -28,8 +27,7 @@ When the exception was thrown, this was the stack:
<asynchronous suspension> <asynchronous suspension>
#1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #1 .+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>> <<skip until matching line>>
^\(elided [0-9]+ .+[^)]$ ^\(elided [0-9]+ .+\)$
^.+\)$
The test description was: The test description was:
Exception handling in test harness - FlutterError Exception handling in test harness - FlutterError
...@@ -45,11 +43,10 @@ Who lives, who dies, who tells your story\? ...@@ -45,11 +43,10 @@ Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:9\) #[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:9\)
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:105\) #[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:15:77\)
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>> <<skip until matching line>>
^\(elided [0-9]+ .+[^)]$ ^\(elided [0-9]+ .+\)$
^.+\)$
The test description was: The test description was:
Exception handling in test harness - uncaught Future error Exception handling in test harness - uncaught Future error
......
...@@ -29,7 +29,6 @@ const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{ ...@@ -29,7 +29,6 @@ const Map<String, ShardRunner> _kShards = const <String, ShardRunner>{
'docs': _generateDocs, 'docs': _generateDocs,
'analyze': _analyzeRepo, 'analyze': _analyzeRepo,
'tests': _runTests, 'tests': _runTests,
'tests_dart2': _runTestsDart2,
'coverage': _runCoverage, 'coverage': _runCoverage,
}; };
...@@ -130,15 +129,6 @@ Future<Null> _analyzeRepo() async { ...@@ -130,15 +129,6 @@ Future<Null> _analyzeRepo() async {
print('${bold}DONE: Analysis successful.$reset'); print('${bold}DONE: Analysis successful.$reset');
} }
Future<Null> _runTestsDart2() async {
if (Platform.isWindows) {
// AppVeyor platform is overloaded, won't be able to handle additional
// load of dart2 testing.
return;
}
_runTests(options: <String>['--preview-dart-2']);
}
Future<Null> _runTests({List<String> options: const <String>[]}) async { Future<Null> _runTests({List<String> options: const <String>[]}) async {
// Verify that the tests actually return failure on failure and success on success. // Verify that the tests actually return failure on failure and success on success.
final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests'); final String automatedTests = path.join(flutterRoot, 'dev', 'automated_tests');
...@@ -631,4 +621,4 @@ Future<Null> _verifyVersion(String filename) async { ...@@ -631,4 +621,4 @@ Future<Null> _verifyVersion(String filename) async {
print('$red━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$reset'); print('$red━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$reset');
exit(1); exit(1);
} }
} }
\ No newline at end of file
...@@ -7,8 +7,6 @@ import 'dart:async'; ...@@ -7,8 +7,6 @@ import 'dart:async';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'platform_helper.dart';
dynamic getAssertionErrorWithMessage() { dynamic getAssertionErrorWithMessage() {
try { try {
assert(false, 'Message goes here.'); assert(false, 'Message goes here.');
...@@ -45,8 +43,6 @@ Future<Null> main() async { ...@@ -45,8 +43,6 @@ Future<Null> main() async {
final StackTrace sampleStack = await getSampleStack(); final StackTrace sampleStack = await getSampleStack();
final String dividerRegExp = pathSeparatorForRegExp;
test('Error reporting - pretest', () async { test('Error reporting - pretest', () async {
expect(debugPrint, equals(debugPrintThrottled)); expect(debugPrint, equals(debugPrintThrottled));
debugPrint = (String message, { int wrapWidth }) { debugPrint = (String message, { int wrapWidth }) {
...@@ -70,7 +66,7 @@ Future<Null> main() async { ...@@ -70,7 +66,7 @@ Future<Null> main() async {
'^══╡ EXCEPTION CAUGHT BY ERROR HANDLING TEST ╞═══════════════════════════════════════════════════════\n' '^══╡ EXCEPTION CAUGHT BY ERROR HANDLING TEST ╞═══════════════════════════════════════════════════════\n'
'The following assertion was thrown testing the error handling logic:\n' 'The following assertion was thrown testing the error handling logic:\n'
'Message goes here\\.\n' 'Message goes here\\.\n'
'\'[^\']+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\'\n' '\'[^\']+flutter/test/foundation/error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\'\n'
'\n' '\n'
'Either the assertion indicates an error in the framework itself, or we should provide substantially ' 'Either the assertion indicates an error in the framework itself, or we should provide substantially '
'more information in this error message to help you determine and fix the underlying cause\\.\n' 'more information in this error message to help you determine and fix the underlying cause\\.\n'
...@@ -78,10 +74,10 @@ Future<Null> main() async { ...@@ -78,10 +74,10 @@ Future<Null> main() async {
' https://github\\.com/flutter/flutter/issues/new\n' ' https://github\\.com/flutter/flutter/issues/new\n'
'\n' '\n'
'When the exception was thrown, this was the stack:\n' 'When the exception was thrown, this was the stack:\n'
'#0 getSampleStack\\.<anonymous closure> \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#0 getSampleStack\\.<anonymous closure> \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'#2 getSampleStack \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#2 getSampleStack \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'<asynchronous suspension>\n' // TODO(ianh): https://github.com/flutter/flutter/issues/4021 '<asynchronous suspension>\n' // TODO(ianh): https://github.com/flutter/flutter/issues/4021
'#3 main \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#3 main \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'(.+\n)+' // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main() '(.+\n)+' // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
'\\(elided [0-9]+ frames from package dart:async\\)\n' '\\(elided [0-9]+ frames from package dart:async\\)\n'
'\n' '\n'
...@@ -111,7 +107,7 @@ Future<Null> main() async { ...@@ -111,7 +107,7 @@ Future<Null> main() async {
'word word word word word word word word word word word word word word word word word word word word ' 'word word word word word word word word word word word word word word word word word word word word '
'word word word word word word word word word word word word word word word word word word word word ' 'word word word word word word word word word word word word word word word word word word word word '
'word word word word word word word word word word word word word word word word word word word word\n' 'word word word word word word word word word word word word word word word word word word word word\n'
'\'[^\']+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\'\n' '\'[^\']+flutter/test/foundation/error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\'\n'
'\n' '\n'
'Either the assertion indicates an error in the framework itself, or we should provide substantially ' 'Either the assertion indicates an error in the framework itself, or we should provide substantially '
'more information in this error message to help you determine and fix the underlying cause\\.\n' 'more information in this error message to help you determine and fix the underlying cause\\.\n'
...@@ -151,7 +147,7 @@ Future<Null> main() async { ...@@ -151,7 +147,7 @@ Future<Null> main() async {
expect(console.join('\n'), matches( expect(console.join('\n'), matches(
'^══╡ EXCEPTION CAUGHT BY ERROR HANDLING TEST ╞═══════════════════════════════════════════════════════\n' '^══╡ EXCEPTION CAUGHT BY ERROR HANDLING TEST ╞═══════════════════════════════════════════════════════\n'
'The following assertion was thrown testing the error handling logic:\n' 'The following assertion was thrown testing the error handling logic:\n'
'\'[^\']+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\': is not true\\.\n' '\'[^\']+flutter/test/foundation/error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\': is not true\\.\n'
'\n' '\n'
'Either the assertion indicates an error in the framework itself, or we should provide substantially ' 'Either the assertion indicates an error in the framework itself, or we should provide substantially '
'more information in this error message to help you determine and fix the underlying cause\\.\n' 'more information in this error message to help you determine and fix the underlying cause\\.\n'
...@@ -159,10 +155,10 @@ Future<Null> main() async { ...@@ -159,10 +155,10 @@ Future<Null> main() async {
' https://github\\.com/flutter/flutter/issues/new\n' ' https://github\\.com/flutter/flutter/issues/new\n'
'\n' '\n'
'When the exception was thrown, this was the stack:\n' 'When the exception was thrown, this was the stack:\n'
'#0 getSampleStack\\.<anonymous closure> \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#0 getSampleStack\\.<anonymous closure> \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'#2 getSampleStack \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#2 getSampleStack \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'<asynchronous suspension>\n' // TODO(ianh): https://github.com/flutter/flutter/issues/4021 '<asynchronous suspension>\n' // TODO(ianh): https://github.com/flutter/flutter/issues/4021
'#3 main \\([^)]+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n' '#3 main \\([^)]+flutter/test/foundation/error_reporting_test\\.dart:[0-9]+:[0-9]+\\)\n'
'(.+\n)+' // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main() '(.+\n)+' // TODO(ianh): when fixing #4021, also filter out frames from the test infrastructure below the first call to our main()
'\\(elided [0-9]+ frames from package dart:async\\)\n' '\\(elided [0-9]+ frames from package dart:async\\)\n'
'\n' '\n'
...@@ -174,7 +170,7 @@ Future<Null> main() async { ...@@ -174,7 +170,7 @@ Future<Null> main() async {
FlutterError.dumpErrorToConsole(new FlutterErrorDetails( FlutterError.dumpErrorToConsole(new FlutterErrorDetails(
exception: getAssertionErrorWithoutMessage(), exception: getAssertionErrorWithoutMessage(),
)); ));
expect(console.join('\n'), matches('Another exception was thrown: \'[^\']+flutter${dividerRegExp}test${dividerRegExp}foundation${dividerRegExp}error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\': is not true\\.')); expect(console.join('\n'), matches('Another exception was thrown: \'[^\']+flutter/test/foundation/error_reporting_test\\.dart\': Failed assertion: line [0-9]+ pos [0-9]+: \'false\': is not true\\.'));
console.clear(); console.clear();
FlutterError.resetErrorCount(); FlutterError.resetErrorCount();
}); });
......
...@@ -5,18 +5,14 @@ ...@@ -5,18 +5,14 @@
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:test/test.dart'; import 'package:test/test.dart';
import 'platform_helper.dart';
void main() { void main() {
// TODO(8128): These tests and the filtering mechanism should be revisited to account for causal async stack traces. // TODO(8128): These tests and the filtering mechanism should be revisited to account for causal async stack traces.
final String dividerRegExp = pathSeparatorForRegExp;
test('FlutterError.defaultStackFilter', () { test('FlutterError.defaultStackFilter', () {
final List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList(); final List<String> filtered = FlutterError.defaultStackFilter(StackTrace.current.toString().trimRight().split('\n')).toList();
expect(filtered.length, greaterThanOrEqualTo(4)); expect(filtered.length, greaterThanOrEqualTo(4));
expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$')); expect(filtered[0], matches(r'^#0 +main\.<anonymous closure> \(.*stack_trace_test\.dart:[0-9]+:[0-9]+\)$'));
expect(filtered[1], matches(r'^#1 +Declarer\.test\.<anonymous closure>.<anonymous closure>.<anonymous closure> \(package:test' + dividerRegExp + r'.+:[0-9]+:[0-9]+\)$')); expect(filtered[1], matches(r'^#1 +Declarer\.test\.<anonymous closure>.<anonymous closure>.<anonymous closure> \(package:test/.+:[0-9]+:[0-9]+\)$'));
expect(filtered[2], equals('<asynchronous suspension>')); expect(filtered[2], equals('<asynchronous suspension>'));
expect(filtered.last, matches(r'^\(elided [1-9][0-9]+ frames from package dart:async(, package dart:async-patch,)? and package stack_trace\)$')); expect(filtered.last, matches(r'^\(elided [1-9][0-9]+ frames from package dart:async(, package dart:async-patch,)? and package stack_trace\)$'));
}); });
......
...@@ -101,6 +101,8 @@ BuildApp() { ...@@ -101,6 +101,8 @@ BuildApp() {
local preview_dart_2_flag="" local preview_dart_2_flag=""
if [[ -n "$PREVIEW_DART_2" ]]; then if [[ -n "$PREVIEW_DART_2" ]]; then
preview_dart_2_flag="--preview-dart-2" preview_dart_2_flag="--preview-dart-2"
else
preview_dart_2_flag="--no-preview-dart-2"
fi fi
if [[ "$CURRENT_ARCH" != "x86_64" ]]; then if [[ "$CURRENT_ARCH" != "x86_64" ]]; then
......
...@@ -400,7 +400,9 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -400,7 +400,9 @@ abstract class BaseFlutterTask extends DefaultTask {
args "--output-dir", "${intermediateDir}" args "--output-dir", "${intermediateDir}"
if (previewDart2) { if (previewDart2) {
args "--preview-dart-2" args "--preview-dart-2"
} } else {
args "--no-preview-dart-2"
}
if (trackWidgetCreation) { if (trackWidgetCreation) {
args "--track-widget-creation" args "--track-widget-creation"
} }
...@@ -432,7 +434,9 @@ abstract class BaseFlutterTask extends DefaultTask { ...@@ -432,7 +434,9 @@ abstract class BaseFlutterTask extends DefaultTask {
args "--target", targetPath args "--target", targetPath
if (previewDart2) { if (previewDart2) {
args "--preview-dart-2" args "--preview-dart-2"
} } else {
args "--no-preview-dart-2"
}
if (trackWidgetCreation) { if (trackWidgetCreation) {
args "--track-widget-creation" args "--track-widget-creation"
} }
......
...@@ -19,7 +19,7 @@ class AnalyzeCommand extends FlutterCommand { ...@@ -19,7 +19,7 @@ class AnalyzeCommand extends FlutterCommand {
argParser.addFlag('current-package', help: 'Include the lib/main.dart file from the current directory, if any.', defaultsTo: true); argParser.addFlag('current-package', help: 'Include the lib/main.dart file from the current directory, if any.', defaultsTo: true);
argParser.addFlag('dartdocs', help: 'List every public member that is lacking documentation (only works with --flutter-repo and without --watch).', defaultsTo: false, hide: !verboseHelp); argParser.addFlag('dartdocs', help: 'List every public member that is lacking documentation (only works with --flutter-repo and without --watch).', defaultsTo: false, hide: !verboseHelp);
argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', negatable: false); argParser.addFlag('watch', help: 'Run analysis continuously, watching the filesystem for changes.', negatable: false);
argParser.addFlag('preview-dart-2', help: 'Preview Dart 2.0 functionality.'); argParser.addFlag('preview-dart-2', defaultsTo: true, help: 'Preview Dart 2.0 functionality.');
argParser.addOption('write', valueHelp: 'file', help: 'Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.'); argParser.addOption('write', valueHelp: 'file', help: 'Also output the results to a file. This is useful with --watch if you want a file to always contain the latest results.');
argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: !verboseHelp); argParser.addOption('dart-sdk', valueHelp: 'path-to-sdk', help: 'The path to the Dart SDK.', hide: !verboseHelp);
......
...@@ -39,7 +39,11 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -39,7 +39,11 @@ class BuildAotCommand extends BuildSubCommand {
) )
..addFlag('interpreter') ..addFlag('interpreter')
..addFlag('quiet', defaultsTo: false) ..addFlag('quiet', defaultsTo: false)
..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp) ..addFlag('preview-dart-2',
defaultsTo: true,
hide: !verboseHelp,
help: 'Preview Dart 2.0 functionality.',
)
..addMultiOption(FlutterOptions.kExtraFrontEndOptions, ..addMultiOption(FlutterOptions.kExtraFrontEndOptions,
splitCommas: true, splitCommas: true,
hide: true, hide: true,
...@@ -48,8 +52,9 @@ class BuildAotCommand extends BuildSubCommand { ...@@ -48,8 +52,9 @@ class BuildAotCommand extends BuildSubCommand {
splitCommas: true, splitCommas: true,
hide: true, hide: true,
) )
..addFlag('prefer-shared-library', negatable: false, ..addFlag('prefer-shared-library',
help: 'Whether to prefer compiling to a *.so file (android only).'); negatable: false,
help: 'Whether to prefer compiling to a *.so file (android only).');
} }
@override @override
......
...@@ -15,10 +15,16 @@ class BuildApkCommand extends BuildSubCommand { ...@@ -15,10 +15,16 @@ class BuildApkCommand extends BuildSubCommand {
usesPubOption(); usesPubOption();
argParser argParser
..addFlag('preview-dart-2', negatable: false, hide: !verboseHelp) ..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('prefer-shared-library', negatable: false, ..addFlag('prefer-shared-library',
help: 'Whether to prefer compiling to a *.so file (android only).') negatable: false,
help: 'Whether to prefer compiling to a *.so file (android only).',
)
..addOption('target-platform', ..addOption('target-platform',
defaultsTo: 'android-arm', defaultsTo: 'android-arm',
allowed: <String>['android-arm', 'android-arm64']); allowed: <String>['android-arm', 'android-arm64']);
......
...@@ -11,24 +11,31 @@ import 'build.dart'; ...@@ -11,24 +11,31 @@ import 'build.dart';
class BuildFlxCommand extends BuildSubCommand { class BuildFlxCommand extends BuildSubCommand {
BuildFlxCommand({bool verboseHelp: false}) { BuildFlxCommand({bool verboseHelp: false}) {
usesTargetOption(); usesTargetOption();
argParser.addFlag('precompiled', negatable: false); argParser
// This option is still referenced by the iOS build scripts. We should ..addFlag('precompiled', negatable: false)
// remove it once we've updated those build scripts. // This option is still referenced by the iOS build scripts. We should
argParser.addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp); // remove it once we've updated those build scripts.
argParser.addOption('manifest', defaultsTo: defaultManifestPath); ..addOption('asset-base', help: 'Ignored. Will be removed.', hide: !verboseHelp)
argParser.addOption('private-key', defaultsTo: defaultPrivateKeyPath); ..addOption('manifest', defaultsTo: defaultManifestPath)
argParser.addOption('output-file', abbr: 'o', defaultsTo: defaultFlxOutputPath); ..addOption('private-key', defaultsTo: defaultPrivateKeyPath)
argParser.addOption('snapshot', defaultsTo: defaultSnapshotPath); ..addOption('output-file', abbr: 'o', defaultsTo: defaultFlxOutputPath)
argParser.addOption('depfile', defaultsTo: defaultDepfilePath); ..addOption('snapshot', defaultsTo: defaultSnapshotPath)
argParser.addOption('kernel-file', defaultsTo: defaultApplicationKernelPath); ..addOption('depfile', defaultsTo: defaultDepfilePath)
argParser.addFlag('preview-dart-2', negatable: false, hide: !verboseHelp); ..addOption('kernel-file', defaultsTo: defaultApplicationKernelPath)
argParser.addFlag( ..addFlag('preview-dart-2',
'track-widget-creation', defaultsTo: true,
hide: !verboseHelp, hide: !verboseHelp,
help: 'Track widget creation locations. Requires Dart 2.0 functionality.', help: 'Preview Dart 2.0 functionality.',
); )
argParser.addOption('working-dir', defaultsTo: getAssetBuildDirectory()); ..addFlag('track-widget-creation',
argParser.addFlag('report-licensed-packages', help: 'Whether to report the names of all the packages that are included in the application\'s LICENSE file.', defaultsTo: false); hide: !verboseHelp,
help: 'Track widget creation locations. Requires Dart 2.0 functionality.',
)
..addOption('working-dir', defaultsTo: getAssetBuildDirectory())
..addFlag('report-licensed-packages',
help: 'Whether to report the names of all the packages that are included '
'in the application\'s LICENSE file.',
defaultsTo: false);
usesPubOption(); usesPubOption();
} }
......
...@@ -17,20 +17,30 @@ class BuildIOSCommand extends BuildSubCommand { ...@@ -17,20 +17,30 @@ class BuildIOSCommand extends BuildSubCommand {
usesTargetOption(); usesTargetOption();
usesFlavorOption(); usesFlavorOption();
usesPubOption(); usesPubOption();
argParser.addFlag('debug', argParser
negatable: false, ..addFlag('debug',
help: 'Build a debug version of your app (default mode for iOS simulator builds).'); negatable: false,
argParser.addFlag('profile', help: 'Build a debug version of your app (default mode for iOS simulator builds).',
negatable: false, )
help: 'Build a version of your app specialized for performance profiling.'); ..addFlag('profile',
argParser.addFlag('release', negatable: false,
negatable: false, help: 'Build a version of your app specialized for performance profiling.',
help: 'Build a release version of your app (default mode for device builds).'); )
argParser.addFlag('simulator', help: 'Build for the iOS simulator instead of the device.'); ..addFlag('release',
argParser.addFlag('codesign', negatable: true, defaultsTo: true, negatable: false,
help: 'Codesign the application bundle (only available on device builds).'); help: 'Build a release version of your app (default mode for device builds).',
argParser.addFlag('preview-dart-2', negatable: false, )
hide: !verboseHelp); ..addFlag('simulator',
help: 'Build for the iOS simulator instead of the device.',
)
..addFlag('codesign',
defaultsTo: true,
help: 'Codesign the application bundle (only available on device builds).',
)
..addFlag('preview-dart-2',
defaultsTo: true,
hide: !verboseHelp,
help: 'Preview Dart 2.0 functionality.');
} }
@override @override
......
...@@ -40,42 +40,31 @@ class DriveCommand extends RunCommandBase { ...@@ -40,42 +40,31 @@ class DriveCommand extends RunCommandBase {
DriveCommand() { DriveCommand() {
requiresPubspecYaml(); requiresPubspecYaml();
argParser.addFlag( argParser
'keep-app-running', ..addFlag('keep-app-running',
defaultsTo: null, defaultsTo: null,
negatable: true, help: 'Will keep the Flutter application running when done testing.\n'
help: 'By default, "flutter drive" stops the application after tests are finished,\n'
'Will keep the Flutter application running when done testing.\n' 'and --keep-app-running overrides this. On the other hand, if --use-existing-app\n'
'By default, "flutter drive" stops the application after tests are finished,\n' 'is specified, then "flutter drive" instead defaults to leaving the application\n'
'and --keep-app-running overrides this. On the other hand, if --use-existing-app\n' 'running, and --no-keep-app-running overrides it.',
'is specified, then "flutter drive" instead defaults to leaving the application\n' )
'running, and --no-keep-app-running overrides it.' ..addOption('use-existing-app',
); help: 'Connect to an already running instance via the given observatory URL.\n'
'If this option is given, the application will not be automatically started,\n'
argParser.addOption( 'and it will only be stopped if --no-keep-app-running is explicitly set.',
'use-existing-app', valueHelp: 'url',
help: )
'Connect to an already running instance via the given observatory URL.\n' ..addOption('driver',
'If this option is given, the application will not be automatically started,\n' help: 'The test file to run on the host (as opposed to the target file to run on\n'
'and it will only be stopped if --no-keep-app-running is explicitly set.', 'the device). By default, this file has the same base name as the target\n'
valueHelp: 'file, but in the "test_driver/" directory instead, and with "_test" inserted\n'
'url' 'just before the extension, so e.g. if the target is "lib/main.dart", the\n'
); 'driver will be "test_driver/main_test.dart".',
valueHelp: 'path',
argParser.addOption( )
'driver', ..addFlag('preview-dart-2',
help: defaultsTo: true,
'The test file to run on the host (as opposed to the target file to run on\n'
'the device). By default, this file has the same base name as the target\n'
'file, but in the "test_driver/" directory instead, and with "_test" inserted\n'
'just before the extension, so e.g. if the target is "lib/main.dart", the\n'
'driver will be "test_driver/main_test.dart".',
valueHelp:
'path'
);
argParser.addFlag('preview-dart-2',
defaultsTo: false,
help: 'Preview Dart 2.0 functionality.'); help: 'Preview Dart 2.0 functionality.');
} }
...@@ -301,6 +290,8 @@ Future<Null> _runTests(List<String> testArgs, String observatoryUri, bool previe ...@@ -301,6 +290,8 @@ Future<Null> _runTests(List<String> testArgs, String observatoryUri, bool previe
..add('-rexpanded'); ..add('-rexpanded');
if (previewDart2) { if (previewDart2) {
args.add('--preview-dart-2'); args.add('--preview-dart-2');
} else {
args.add('--no-preview-dart-2');
} }
final String dartVmPath = fs.path.join(dartSdkPath, 'bin', 'dart'); final String dartVmPath = fs.path.join(dartSdkPath, 'bin', 'dart');
......
...@@ -24,17 +24,21 @@ abstract class RunCommandBase extends FlutterCommand { ...@@ -24,17 +24,21 @@ abstract class RunCommandBase extends FlutterCommand {
RunCommandBase() { RunCommandBase() {
addBuildModeFlags(defaultToRelease: false); addBuildModeFlags(defaultToRelease: false);
usesFlavorOption(); usesFlavorOption();
argParser.addFlag('trace-startup', argParser
..addFlag('trace-startup',
negatable: false, negatable: false,
help: 'Start tracing during startup.'); help: 'Start tracing during startup.',
argParser.addFlag('ipv6', )
..addFlag('ipv6',
hide: true, hide: true,
negatable: false, negatable: false,
help: 'Binds to IPv6 localhost instead of IPv4 when the flutter tool\n' help: 'Binds to IPv6 localhost instead of IPv4 when the flutter tool\n'
'forwards the host port to a device port.'); 'forwards the host port to a device port.',
argParser.addOption('route', )
help: 'Which route to load when running the app.'); ..addOption('route',
argParser.addOption('target-platform', help: 'Which route to load when running the app.',
)
..addOption('target-platform',
defaultsTo: 'default', defaultsTo: 'default',
allowed: <String>['default', 'android-arm', 'android-arm64'], allowed: <String>['default', 'android-arm', 'android-arm64'],
help: 'Specify the target platform when building the app for an ' help: 'Specify the target platform when building the app for an '
...@@ -78,81 +82,97 @@ class RunCommand extends RunCommandBase { ...@@ -78,81 +82,97 @@ class RunCommand extends RunCommandBase {
RunCommand({ bool verboseHelp: false }) { RunCommand({ bool verboseHelp: false }) {
requiresPubspecYaml(); requiresPubspecYaml();
argParser.addFlag('full-restart', argParser
..addFlag('full-restart',
defaultsTo: true, defaultsTo: true,
help: 'Stop any currently running application process before running the app.'); help: 'Stop any currently running application process before running the app.',
argParser.addFlag('start-paused', )
..addFlag('start-paused',
negatable: false, negatable: false,
help: 'Start in a paused mode and wait for a debugger to connect.'); help: 'Start in a paused mode and wait for a debugger to connect.',
argParser.addFlag('enable-software-rendering', )
..addFlag('enable-software-rendering',
negatable: false, negatable: false,
help: 'Enable rendering using the Skia software backend. This is useful\n' help: 'Enable rendering using the Skia software backend. This is useful\n'
'when testing Flutter on emulators. By default, Flutter will\n' 'when testing Flutter on emulators. By default, Flutter will\n'
'attempt to either use OpenGL or Vulkan and fall back to software\n' 'attempt to either use OpenGL or Vulkan and fall back to software\n'
'when neither is available.'); 'when neither is available.',
argParser.addFlag('skia-deterministic-rendering', )
..addFlag('skia-deterministic-rendering',
negatable: false, negatable: false,
help: 'When combined with --enable-software-rendering, provides 100%\n' help: 'When combined with --enable-software-rendering, provides 100%\n'
'deterministic Skia rendering.'); 'deterministic Skia rendering.',
argParser.addFlag('trace-skia', )
..addFlag('trace-skia',
negatable: false, negatable: false,
help: 'Enable tracing of Skia code. This is useful when debugging\n' help: 'Enable tracing of Skia code. This is useful when debugging\n'
'the GPU thread. By default, Flutter will not log skia code.'); 'the GPU thread. By default, Flutter will not log skia code.',
argParser.addFlag('use-test-fonts', )
..addFlag('use-test-fonts',
negatable: true, negatable: true,
help: 'Enable (and default to) the "Ahem" font. This is a special font\n' help: 'Enable (and default to) the "Ahem" font. This is a special font\n'
'used in tests to remove any dependencies on the font metrics. It\n' 'used in tests to remove any dependencies on the font metrics. It\n'
'is enabled when you use "flutter test". Set this flag when running\n' 'is enabled when you use "flutter test". Set this flag when running\n'
'a test using "flutter run" for debugging purposes. This flag is\n' 'a test using "flutter run" for debugging purposes. This flag is\n'
'only available when running in debug mode.'); 'only available when running in debug mode.',
argParser.addFlag('build', )
..addFlag('build',
defaultsTo: true, defaultsTo: true,
help: 'If necessary, build the app before running.'); help: 'If necessary, build the app before running.',
argParser.addOption('use-application-binary', )
..addOption('use-application-binary',
hide: !verboseHelp, hide: !verboseHelp,
help: 'Specify a pre-built application binary to use when running.'); help: 'Specify a pre-built application binary to use when running.',
argParser.addFlag('preview-dart-2', )
..addFlag('preview-dart-2',
defaultsTo: true,
hide: !verboseHelp, hide: !verboseHelp,
help: 'Preview Dart 2.0 functionality.'); help: 'Preview Dart 2.0 functionality.',
argParser.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.',
argParser.addOption('project-root', )
..addOption('project-root',
hide: !verboseHelp, hide: !verboseHelp,
help: 'Specify the project root directory.'); help: 'Specify the project root directory.',
argParser.addFlag('machine', )
..addFlag('machine',
hide: !verboseHelp, hide: !verboseHelp,
negatable: false, negatable: false,
help: 'Handle machine structured JSON command input and provide output\n' help: 'Handle machine structured JSON command input and provide output\n'
'and progress in machine friendly format.'); 'and progress in machine friendly format.',
argParser.addFlag('hot', )
..addFlag('hot',
negatable: true, negatable: true,
defaultsTo: kHotReloadDefault, defaultsTo: kHotReloadDefault,
help: 'Run with support for hot reloading.'); help: 'Run with support for hot reloading.',
argParser.addOption('pid-file', )
..addOption('pid-file',
help: 'Specify a file to write the process id to.\n' help: 'Specify a file to write the process id to.\n'
'You can send SIGUSR1 to trigger a hot reload\n' 'You can send SIGUSR1 to trigger a hot reload\n'
'and SIGUSR2 to trigger a full restart.'); 'and SIGUSR2 to trigger a full restart.',
argParser.addFlag('resident', )
..addFlag('resident',
negatable: true, negatable: true,
defaultsTo: true, defaultsTo: true,
hide: !verboseHelp, hide: !verboseHelp,
help: 'Stay resident after launching the application.'); help: 'Stay resident after launching the application.',
)
argParser.addFlag('benchmark', ..addFlag('benchmark',
negatable: false, negatable: false,
hide: !verboseHelp,
help: 'Enable a benchmarking mode. This will run the given application,\n'
'measure the startup time and the app restart time, write the\n'
'results out to "refresh_benchmark.json", and exit. This flag is\n'
'intended for use in generating automated flutter benchmarks.');
argParser.addOption('output-dill',
hide: !verboseHelp, hide: !verboseHelp,
help: 'Specify the path to frontend server output kernel file.'); help: 'Enable a benchmarking mode. This will run the given application,\n'
'measure the startup time and the app restart time, write the\n'
argParser.addOption(FlutterOptions.kExtraFrontEndOptions, hide: true); 'results out to "refresh_benchmark.json", and exit. This flag is\n'
argParser.addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true); 'intended for use in generating automated flutter benchmarks.',
)
..addOption('output-dill',
hide: !verboseHelp,
help: 'Specify the path to frontend server output kernel file.',
)
..addOption(FlutterOptions.kExtraFrontEndOptions, hide: true)
..addOption(FlutterOptions.kExtraGenSnapshotOptions, hide: true);
} }
List<Device> devices; List<Device> devices;
......
...@@ -23,70 +23,62 @@ class TestCommand extends FlutterCommand { ...@@ -23,70 +23,62 @@ class TestCommand extends FlutterCommand {
TestCommand({ bool verboseHelp: false }) { TestCommand({ bool verboseHelp: false }) {
requiresPubspecYaml(); requiresPubspecYaml();
usesPubOption(); usesPubOption();
argParser.addMultiOption( argParser
'name', ..addMultiOption('name',
help: 'A regular expression matching substrings of the names of tests to run.', help: 'A regular expression matching substrings of the names of tests to run.',
valueHelp: 'regexp', valueHelp: 'regexp',
splitCommas: false, splitCommas: false,
); )
argParser.addMultiOption( ..addMultiOption('plain-name',
'plain-name', help: 'A plain-text substring of the names of tests to run.',
help: 'A plain-text substring of the names of tests to run.', valueHelp: 'substring',
valueHelp: 'substring', splitCommas: false,
splitCommas: false, )
); ..addFlag('start-paused',
argParser.addFlag( defaultsTo: false,
'start-paused', negatable: false,
defaultsTo: false, help: 'Start in a paused mode and wait for a debugger to connect.\n'
negatable: false, 'You must specify a single test file to run, explicitly.\n'
help: 'Start in a paused mode and wait for a debugger to connect.\n' 'Instructions for connecting with a debugger and printed to the\n'
'You must specify a single test file to run, explicitly.\n' 'console once the test has started.',
'Instructions for connecting with a debugger and printed to the\n' )
'console once the test has started.', ..addFlag('coverage',
); defaultsTo: false,
argParser.addFlag( negatable: false,
'coverage', help: 'Whether to collect coverage information.',
defaultsTo: false, )
negatable: false, ..addFlag('merge-coverage',
help: 'Whether to collect coverage information.', defaultsTo: false,
); negatable: false,
argParser.addFlag( help: 'Whether to merge coverage data with "coverage/lcov.base.info".\n'
'merge-coverage', 'Implies collecting coverage data. (Requires lcov)',
defaultsTo: false, )
negatable: false, ..addFlag('ipv6',
help: 'Whether to merge coverage data with "coverage/lcov.base.info".\n' negatable: false,
'Implies collecting coverage data. (Requires lcov)', hide: true,
); help: 'Whether to use IPv6 for the test harness server socket.',
argParser.addFlag( )
'ipv6', ..addOption('coverage-path',
negatable: false, defaultsTo: 'coverage/lcov.info',
hide: true, help: 'Where to store coverage information (if coverage is enabled).',
help: 'Whether to use IPv6 for the test harness server socket.', )
); ..addFlag('machine',
argParser.addOption( hide: !verboseHelp,
'coverage-path', negatable: false,
defaultsTo: 'coverage/lcov.info', help: 'Handle machine structured JSON command input\n'
help: 'Where to store coverage information (if coverage is enabled).', 'and provide output and progress in machine friendly format.',
); )
argParser.addFlag( ..addFlag('preview-dart-2',
'machine', defaultsTo: true,
hide: !verboseHelp, hide: !verboseHelp,
negatable: false, help: 'Preview Dart 2.0 functionality.',
help: 'Handle machine structured JSON command input\n' )
'and provide output and progress in machine friendly format.', ..addFlag('track-widget-creation',
); negatable: false,
argParser.addFlag( hide: !verboseHelp,
'preview-dart-2', help: 'Track widget creation locations.\n'
hide: !verboseHelp, 'This enables testing of features such as the widget inspector.',
help: 'Preview Dart 2.0 functionality.', );
);
argParser.addFlag(
'track-widget-creation',
negatable: false,
hide: !verboseHelp,
help: 'Track widget creation locations.\n'
'This enables testing of features such as the widget inspector.',
);
} }
@override @override
......
...@@ -12,11 +12,14 @@ import 'base/io.dart'; ...@@ -12,11 +12,14 @@ import 'base/io.dart';
import 'base/process_manager.dart'; import 'base/process_manager.dart';
import 'globals.dart'; import 'globals.dart';
typedef void CompilerMessageConsumer(String message);
class _StdoutHandler { class _StdoutHandler {
_StdoutHandler() { _StdoutHandler({this.consumer: printError}) {
reset(); reset();
} }
final CompilerMessageConsumer consumer;
String boundaryKey; String boundaryKey;
Completer<String> outputFilename; Completer<String> outputFilename;
...@@ -30,7 +33,7 @@ class _StdoutHandler { ...@@ -30,7 +33,7 @@ class _StdoutHandler {
? string.substring(boundaryKey.length + 1) ? string.substring(boundaryKey.length + 1)
: null); : null);
else else
printError('compiler message: $string'); consumer('compiler message: $string');
} }
// This is needed to get ready to process next compilation result output, // This is needed to get ready to process next compilation result output,
...@@ -124,10 +127,11 @@ Future<String> compile( ...@@ -124,10 +127,11 @@ Future<String> compile(
/// restarts the Flutter app. /// restarts the Flutter app.
class ResidentCompiler { class ResidentCompiler {
ResidentCompiler(this._sdkRoot, {bool trackWidgetCreation: false, ResidentCompiler(this._sdkRoot, {bool trackWidgetCreation: false,
String packagesPath}) String packagesPath, CompilerMessageConsumer compilerMessageConsumer: printError})
: assert(_sdkRoot != null), : assert(_sdkRoot != null),
_trackWidgetCreation = trackWidgetCreation, _trackWidgetCreation = trackWidgetCreation,
_packagesPath = packagesPath { _packagesPath = packagesPath,
stdoutHandler = new _StdoutHandler(consumer: compilerMessageConsumer) {
// This is a URI, not a file path, so the forward slash is correct even on Windows. // This is a URI, not a file path, so the forward slash is correct even on Windows.
if (!_sdkRoot.endsWith('/')) if (!_sdkRoot.endsWith('/'))
_sdkRoot = '$_sdkRoot/'; _sdkRoot = '$_sdkRoot/';
...@@ -137,7 +141,7 @@ class ResidentCompiler { ...@@ -137,7 +141,7 @@ class ResidentCompiler {
final String _packagesPath; final String _packagesPath;
String _sdkRoot; String _sdkRoot;
Process _server; Process _server;
final _StdoutHandler stdoutHandler = new _StdoutHandler(); final _StdoutHandler stdoutHandler;
/// If invoked for the first time, it compiles Dart script identified by /// If invoked for the first time, it compiles Dart script identified by
/// [mainPath], [invalidatedFiles] list is ignored. /// [mainPath], [invalidatedFiles] list is ignored.
...@@ -233,4 +237,9 @@ class ResidentCompiler { ...@@ -233,4 +237,9 @@ class ResidentCompiler {
void reset() { void reset() {
_server.stdin.writeln('reset'); _server.stdin.writeln('reset');
} }
Future<dynamic> shutdown() {
_server.kill();
return _server.exitCode;
}
} }
...@@ -163,7 +163,7 @@ abstract class FlutterCommand extends Command<Null> { ...@@ -163,7 +163,7 @@ abstract class FlutterCommand extends Command<Null> {
BuildInfo getBuildInfo() { BuildInfo getBuildInfo() {
final bool previewDart2 = argParser.options.containsKey('preview-dart-2') final bool previewDart2 = argParser.options.containsKey('preview-dart-2')
? argResults['preview-dart-2'] ? argResults['preview-dart-2']
: false; : true;
TargetPlatform targetPlatform; TargetPlatform targetPlatform;
if (argParser.options.containsKey('target-platform') && if (argParser.options.containsKey('target-platform') &&
......
...@@ -108,6 +108,30 @@ class _Compiler { ...@@ -108,6 +108,30 @@ class _Compiler {
.createTempSync('output_dill'); .createTempSync('output_dill');
final File outputDill = outputDillDirectory.childFile('output.dill'); final File outputDill = outputDillDirectory.childFile('output.dill');
bool suppressOutput = false;
void reportCompilerMessage(String message) {
if (suppressOutput)
return;
if (message.startsWith('compiler message: Error: Could not resolve the package \'test\'')) {
printTrace(message);
printError('\n\nFailed to load test harness. Are you missing a dependency on flutter_test?\n');
suppressOutput = true;
return;
}
printError('$message');
}
ResidentCompiler createCompiler() {
return new ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
packagesPath: PackageMap.globalPackagesPath,
trackWidgetCreation: trackWidgetCreation,
compilerMessageConsumer: reportCompilerMessage,
);
}
compilerController.stream.listen((_CompilationRequest request) async { compilerController.stream.listen((_CompilationRequest request) async {
final bool isEmpty = compilationQueue.isEmpty; final bool isEmpty = compilationQueue.isEmpty;
compilationQueue.add(request); compilationQueue.add(request);
...@@ -118,16 +142,27 @@ class _Compiler { ...@@ -118,16 +142,27 @@ class _Compiler {
while (compilationQueue.isNotEmpty) { while (compilationQueue.isNotEmpty) {
final _CompilationRequest request = compilationQueue.first; final _CompilationRequest request = compilationQueue.first;
printTrace('Compiling ${request.path}'); printTrace('Compiling ${request.path}');
compiler ??= createCompiler();
suppressOutput = false;
final String outputPath = await compiler.recompile(request.path, final String outputPath = await compiler.recompile(request.path,
<String>[request.path], <String>[request.path],
outputPath: outputDill.path, outputPath: outputDill.path,
); );
// Copy output dill next to the source file.
final File kernelReadyToRun = await fs.file(outputPath).copy( // Check if the compiler produced the output. If it failed then
request.path + '.dill'); // outputPath would be null. In this case pass null upwards to the
compiler.accept(); // consumer and shutdown the compiler to avoid reusing compiler
compiler.reset(); // that might have gotten into a weird state.
request.result.complete(kernelReadyToRun.path); if (outputPath == null) {
request.result.complete(null);
await shutdown();
} else {
final File kernelReadyToRun =
await fs.file(outputPath).copy('${request.path}.dill');
request.result.complete(kernelReadyToRun.path);
compiler.accept();
compiler.reset();
}
// Only remove now when we finished processing the element // Only remove now when we finished processing the element
compilationQueue.removeAt(0); compilationQueue.removeAt(0);
} }
...@@ -135,11 +170,6 @@ class _Compiler { ...@@ -135,11 +170,6 @@ class _Compiler {
}, onDone: () { }, onDone: () {
outputDillDirectory.deleteSync(recursive: true); outputDillDirectory.deleteSync(recursive: true);
}); });
compiler = new ResidentCompiler(
artifacts.getArtifactPath(Artifact.flutterPatchedSdkPath),
packagesPath: PackageMap.globalPackagesPath,
trackWidgetCreation: trackWidgetCreation);
} }
final StreamController<_CompilationRequest> compilerController = final StreamController<_CompilationRequest> compilerController =
...@@ -152,6 +182,11 @@ class _Compiler { ...@@ -152,6 +182,11 @@ class _Compiler {
compilerController.add(new _CompilationRequest(mainDart, completer)); compilerController.add(new _CompilationRequest(mainDart, completer));
return completer.future; return completer.future;
} }
Future<dynamic> shutdown() async {
await compiler.shutdown();
compiler = null;
}
} }
class _FlutterPlatform extends PlatformPlugin { class _FlutterPlatform extends PlatformPlugin {
...@@ -596,6 +631,14 @@ void main() { ...@@ -596,6 +631,14 @@ void main() {
File _cachedFontConfig; File _cachedFontConfig;
@override
Future<dynamic> close() async {
if (compiler != null) {
await compiler.shutdown();
compiler = null;
}
}
/// Returns a Fontconfig config file that limits font fallback to the /// Returns a Fontconfig config file that limits font fallback to the
/// artifact cache directory. /// artifact cache directory.
File get _fontConfigFile { File get _fontConfigFile {
......
...@@ -6,6 +6,8 @@ class {{pluginDartClass}} { ...@@ -6,6 +6,8 @@ class {{pluginDartClass}} {
static const MethodChannel _channel = static const MethodChannel _channel =
const MethodChannel('{{projectName}}'); const MethodChannel('{{projectName}}');
static Future<String> get platformVersion => static Future<String> get platformVersion async {
_channel.invokeMethod('getPlatformVersion'); final String version = await _channel.invokeMethod('getPlatformVersion');
return version;
}
} }
...@@ -223,7 +223,7 @@ StringBuffer bar = StringBuffer('baz'); ...@@ -223,7 +223,7 @@ StringBuffer bar = StringBuffer('baz');
try { try {
await runCommand( await runCommand(
command: new AnalyzeCommand(workingDirectory: fs.directory(tempDir)), command: new AnalyzeCommand(workingDirectory: fs.directory(tempDir)),
arguments: <String>['analyze'], arguments: <String>['analyze', '--no-preview-dart-2'],
statusTextContains: <String>['1 issue found.'], statusTextContains: <String>['1 issue found.'],
toolExit: true, toolExit: true,
); );
......
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