Commit c9010c91 authored by Devon Carew's avatar Devon Carew

fix analysis errors (#3677)

* fix analysis errors

* review comments; fix test

* re-add an export for debugPrint
parent 76724e85
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
import 'package:flutter/painting.dart'; import 'package:flutter/painting.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
export 'package:flutter/services.dart' show debugPrint; export 'package:flutter/foundation.dart' show debugPrint;
/// Causes each RenderBox to paint a box around its bounds, and some extra /// Causes each RenderBox to paint a box around its bounds, and some extra
/// boxes, such as RenderPadding, to draw construction lines. /// boxes, such as RenderPadding, to draw construction lines.
......
...@@ -9,7 +9,7 @@ import 'package:sky_services/flutter/platform/system_chrome.mojom.dart'; ...@@ -9,7 +9,7 @@ import 'package:sky_services/flutter/platform/system_chrome.mojom.dart';
import 'shell.dart'; import 'shell.dart';
export 'package:sky_services/flutter/platform/system_chrome.mojom.dart' show DeviceOrientation, SystemUIOverlay; export 'package:sky_services/flutter/platform/system_chrome.mojom.dart' show DeviceOrientation;
mojom.SystemChromeProxy _initSystemChromeProxy() { mojom.SystemChromeProxy _initSystemChromeProxy() {
mojom.SystemChromeProxy proxy = new mojom.SystemChromeProxy.unbound(); mojom.SystemChromeProxy proxy = new mojom.SystemChromeProxy.unbound();
......
...@@ -32,7 +32,6 @@ export 'package:flutter/rendering.dart' show ...@@ -32,7 +32,6 @@ export 'package:flutter/rendering.dart' show
MaxTileWidthGridDelegate, MaxTileWidthGridDelegate,
MultiChildLayoutDelegate, MultiChildLayoutDelegate,
PaintingContext, PaintingContext,
PlainTextSpan,
PointerCancelEvent, PointerCancelEvent,
PointerCancelEventListener, PointerCancelEventListener,
PointerDownEvent, PointerDownEvent,
......
...@@ -9,7 +9,6 @@ import 'package:vector_math/vector_math_64.dart' show Matrix4; ...@@ -9,7 +9,6 @@ import 'package:vector_math/vector_math_64.dart' show Matrix4;
import 'basic.dart'; import 'basic.dart';
import 'framework.dart'; import 'framework.dart';
export 'package:flutter/animation.dart' show AnimationDirection;
export 'package:flutter/rendering.dart' show RelativeRect; export 'package:flutter/rendering.dart' show RelativeRect;
/// A widget that rebuilds when the given animation changes value. /// A widget that rebuilds when the given animation changes value.
......
...@@ -32,14 +32,10 @@ export 'src/health.dart' show ...@@ -32,14 +32,10 @@ export 'src/health.dart' show
HealthStatus; HealthStatus;
export 'src/message.dart' show export 'src/message.dart' show
Message,
Command, Command,
CommandWithTarget,
Result; Result;
export 'src/timeline_summary.dart' show export 'src/timeline_summary.dart' show
summarizeTimeline,
EventTrace,
TimelineSummary; TimelineSummary;
export 'src/timeline.dart' show export 'src/timeline.dart' show
......
...@@ -23,7 +23,7 @@ class Adb { ...@@ -23,7 +23,7 @@ class Adb {
bool exists() { bool exists() {
try { try {
runCheckedSync([adbPath, 'version']); runCheckedSync(<String>[adbPath, 'version']);
return true; return true;
} catch (exception) { } catch (exception) {
return false; return false;
...@@ -36,18 +36,18 @@ class Adb { ...@@ -36,18 +36,18 @@ class Adb {
/// Revision eac51f2bb6a8-android /// Revision eac51f2bb6a8-android
/// ///
/// This method throws if `adb version` fails. /// This method throws if `adb version` fails.
String getVersion() => runCheckedSync([adbPath, 'version']); String getVersion() => runCheckedSync(<String>[adbPath, 'version']);
/// Starts the adb server. This will throw if there's an problem starting the /// Starts the adb server. This will throw if there's an problem starting the
/// adb server. /// adb server.
void startServer() { void startServer() {
runCheckedSync([adbPath, 'start-server']); runCheckedSync(<String>[adbPath, 'start-server']);
} }
/// Stops the adb server. This will throw if there's an problem stopping the /// Stops the adb server. This will throw if there's an problem stopping the
/// adb server. /// adb server.
void killServer() { void killServer() {
runCheckedSync([adbPath, 'kill-server']); runCheckedSync(<String>[adbPath, 'kill-server']);
} }
/// Ask the ADB server for its internal version number. /// Ask the ADB server for its internal version number.
......
...@@ -56,7 +56,9 @@ class AndroidDevice extends Device { ...@@ -56,7 +56,9 @@ class AndroidDevice extends Device {
if (_isLocalEmulator == null) { if (_isLocalEmulator == null) {
// http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...) // http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
try { try {
String value = runCheckedSync(adbCommandForDevice(['shell', 'getprop', 'ro.product.cpu.abi'])); String value = runCheckedSync(adbCommandForDevice(
<String>['shell', 'getprop', 'ro.product.cpu.abi']
));
_isLocalEmulator = value.startsWith('x86'); _isLocalEmulator = value.startsWith('x86');
} catch (error) { } catch (error) {
_isLocalEmulator = false; _isLocalEmulator = false;
...@@ -164,7 +166,7 @@ class AndroidDevice extends Device { ...@@ -164,7 +166,7 @@ class AndroidDevice extends Device {
@override @override
bool isAppInstalled(ApplicationPackage app) { bool isAppInstalled(ApplicationPackage app) {
// This call takes 400ms - 600ms. // This call takes 400ms - 600ms.
if (runCheckedSync(adbCommandForDevice(['shell', 'pm', 'path', app.id])).isEmpty) if (runCheckedSync(adbCommandForDevice(<String>['shell', 'pm', 'path', app.id])).isEmpty)
return false; return false;
// Check the application SHA. // Check the application SHA.
...@@ -405,7 +407,7 @@ class AndroidDevice extends Device { ...@@ -405,7 +407,7 @@ class AndroidDevice extends Device {
/// ///
/// [mockAdbOutput] is public for testing. /// [mockAdbOutput] is public for testing.
List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) { List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
List<AndroidDevice> devices = []; List<AndroidDevice> devices = <AndroidDevice>[];
List<String> output; List<String> output;
if (mockAdbOutput == null) { if (mockAdbOutput == null) {
......
...@@ -57,6 +57,6 @@ class AppContext { ...@@ -57,6 +57,6 @@ class AppContext {
} }
dynamic runInZone(dynamic method()) { dynamic runInZone(dynamic method()) {
return runZoned(method, zoneValues: {'context': this}); return runZoned(method, zoneValues: <String, dynamic>{'context': this});
} }
} }
...@@ -48,7 +48,7 @@ class _PosixUtils extends OperatingSystemUtils { ...@@ -48,7 +48,7 @@ class _PosixUtils extends OperatingSystemUtils {
@override @override
ProcessResult makeExecutable(File file) { ProcessResult makeExecutable(File file) {
return Process.runSync('chmod', ['a+x', file.path]); return Process.runSync('chmod', <String>['a+x', file.path]);
} }
/// Return the path (with symlinks resolved) to the given executable, or `null` /// Return the path (with symlinks resolved) to the given executable, or `null`
......
...@@ -18,7 +18,7 @@ typedef String StringConverter(String string); ...@@ -18,7 +18,7 @@ typedef String StringConverter(String string);
Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async { Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async {
printTrace(cmd.join(' ')); printTrace(cmd.join(' '));
String executable = cmd[0]; String executable = cmd[0];
List<String> arguments = cmd.length > 1 ? cmd.sublist(1) : []; List<String> arguments = cmd.length > 1 ? cmd.sublist(1) : <String>[];
Process process = await Process.start( Process process = await Process.start(
executable, executable,
arguments, arguments,
......
...@@ -206,12 +206,12 @@ class FlutterEngine { ...@@ -206,12 +206,12 @@ class FlutterEngine {
// Return a list of (cache directory path, download URL path) tuples. // Return a list of (cache directory path, download URL path) tuples.
List<List<String>> _getToolsDirs() { List<List<String>> _getToolsDirs() {
if (Platform.isMacOS) if (Platform.isMacOS)
return <List<String>>[['darwin-x64', 'darwin-x64/artifacts.zip']]; return <List<String>>[<String>['darwin-x64', 'darwin-x64/artifacts.zip']];
else if (Platform.isLinux) else if (Platform.isLinux)
return <List<String>>[ return <List<String>>[
['linux-x64', 'linux-x64/artifacts.zip'], <String>['linux-x64', 'linux-x64/artifacts.zip'],
['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'], <String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'],
['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'], <String>['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'],
]; ];
else else
return <List<String>>[]; return <List<String>>[];
......
...@@ -107,7 +107,7 @@ String buildAotSnapshot( ...@@ -107,7 +107,7 @@ String buildAotSnapshot(
String vmServicePath = path.join(skyEngineSdkExt, 'dart', 'runtime', 'bin', 'vmservice', 'vmservice_io.dart'); String vmServicePath = path.join(skyEngineSdkExt, 'dart', 'runtime', 'bin', 'vmservice', 'vmservice_io.dart');
String jniPath = path.join(skyEngineSdkExt, 'dart_jni', 'jni.dart'); String jniPath = path.join(skyEngineSdkExt, 'dart_jni', 'jni.dart');
List<String> filePaths = [ List<String> filePaths = <String>[
genSnapshot, vmEntryPoints, vmEntryPointsAndroid, mojoInternalPath, uiPath, vmServicePath, jniPath genSnapshot, vmEntryPoints, vmEntryPointsAndroid, mojoInternalPath, uiPath, vmServicePath, jniPath
]; ];
List<String> missingFiles = filePaths.where((String p) => !FileSystemEntity.isFileSync(p)).toList(); List<String> missingFiles = filePaths.where((String p) => !FileSystemEntity.isFileSync(p)).toList();
...@@ -116,7 +116,7 @@ String buildAotSnapshot( ...@@ -116,7 +116,7 @@ String buildAotSnapshot(
return null; return null;
} }
List<String> genSnapshotCmd = [ List<String> genSnapshotCmd = <String>[
genSnapshot, genSnapshot,
'--vm_isolate_snapshot=$vmIsolateSnapshot', '--vm_isolate_snapshot=$vmIsolateSnapshot',
'--isolate_snapshot=$isolateSnapshot', '--isolate_snapshot=$isolateSnapshot',
...@@ -133,7 +133,7 @@ String buildAotSnapshot( ...@@ -133,7 +133,7 @@ String buildAotSnapshot(
]; ];
if (!(tools.engineRelease || buildMode == BuildMode.release)) { if (!(tools.engineRelease || buildMode == BuildMode.release)) {
genSnapshotCmd.addAll([ genSnapshotCmd.addAll(<String>[
'--no-checked', '--no-checked',
'--conditional_directives', '--conditional_directives',
]); ]);
......
...@@ -111,7 +111,7 @@ class _ApkBuilder { ...@@ -111,7 +111,7 @@ class _ApkBuilder {
'-F', outputApk.path, '-F', outputApk.path,
]; ];
if (resources != null) if (resources != null)
packageArgs.addAll(['-S', resources.absolute.path]); packageArgs.addAll(<String>['-S', resources.absolute.path]);
packageArgs.add(artifacts.path); packageArgs.add(artifacts.path);
runCheckedSync(packageArgs); runCheckedSync(packageArgs);
} }
...@@ -136,7 +136,7 @@ class _ApkComponents { ...@@ -136,7 +136,7 @@ class _ApkComponents {
File manifest; File manifest;
File icuData; File icuData;
List<File> jars; List<File> jars;
List<Map<String, String>> services = []; List<Map<String, String>> services = <Map<String, String>>[];
File libSkyShell; File libSkyShell;
File debugKeystore; File debugKeystore;
Directory resources; Directory resources;
...@@ -408,7 +408,7 @@ bool _needsRebuild(String apkPath, String manifest) { ...@@ -408,7 +408,7 @@ bool _needsRebuild(String apkPath, String manifest) {
// Note: This list of dependencies is imperfect, but will do for now. We // Note: This list of dependencies is imperfect, but will do for now. We
// purposely don't include the .dart files, because we can load those // purposely don't include the .dart files, because we can load those
// over the network without needing to rebuild (at least on Android). // over the network without needing to rebuild (at least on Android).
Iterable<FileStat> dependenciesStat = [ Iterable<FileStat> dependenciesStat = <String>[
manifest, manifest,
_kFlutterManifestPath, _kFlutterManifestPath,
_kPackagesStatusPath _kPackagesStatusPath
......
...@@ -135,7 +135,7 @@ class Daemon { ...@@ -135,7 +135,7 @@ class Daemon {
_domainMap[prefix].handleCommand(name, id, request['params']); _domainMap[prefix].handleCommand(name, id, request['params']);
} catch (error) { } catch (error) {
_send({'id': id, 'error': _toJsonable(error)}); _send(<String, dynamic>{'id': id, 'error': _toJsonable(error)});
} }
} }
...@@ -181,7 +181,7 @@ abstract class Domain { ...@@ -181,7 +181,7 @@ abstract class Domain {
} }
void sendEvent(String name, [dynamic args]) { void sendEvent(String name, [dynamic args]) {
Map<String, dynamic> map = { 'event': name }; Map<String, dynamic> map = <String, dynamic>{ 'event': name };
if (args != null) if (args != null)
map['params'] = _toJsonable(args); map['params'] = _toJsonable(args);
_send(map); _send(map);
...@@ -202,13 +202,13 @@ class DaemonDomain extends Domain { ...@@ -202,13 +202,13 @@ class DaemonDomain extends Domain {
_subscription = daemon.notifyingLogger.onMessage.listen((LogMessage message) { _subscription = daemon.notifyingLogger.onMessage.listen((LogMessage message) {
if (message.stackTrace != null) { if (message.stackTrace != null) {
sendEvent('daemon.logMessage', { sendEvent('daemon.logMessage', <String, dynamic>{
'level': message.level, 'level': message.level,
'message': message.message, 'message': message.message,
'stackTrace': message.stackTrace.toString() 'stackTrace': message.stackTrace.toString()
}); });
} else { } else {
sendEvent('daemon.logMessage', { sendEvent('daemon.logMessage', <String, dynamic>{
'level': message.level, 'level': message.level,
'message': message.message 'message': message.message
}); });
......
...@@ -109,7 +109,7 @@ class DriveCommand extends RunCommandBase { ...@@ -109,7 +109,7 @@ class DriveCommand extends RunCommandBase {
} }
try { try {
return await testRunner([testFile]) return await testRunner(<String>[testFile])
.catchError((dynamic error, dynamic stackTrace) { .catchError((dynamic error, dynamic stackTrace) {
printError('CAUGHT EXCEPTION: $error\n$stackTrace'); printError('CAUGHT EXCEPTION: $error\n$stackTrace');
return 1; return 1;
...@@ -162,7 +162,7 @@ class DriveCommand extends RunCommandBase { ...@@ -162,7 +162,7 @@ class DriveCommand extends RunCommandBase {
// if the application is `lib/foo/bar.dart`, the test file is expected to // if the application is `lib/foo/bar.dart`, the test file is expected to
// be `test_driver/foo/bar_test.dart`. // be `test_driver/foo/bar_test.dart`.
String pathWithNoExtension = path.withoutExtension(path.joinAll( String pathWithNoExtension = path.withoutExtension(path.joinAll(
[packageDir, 'test_driver']..addAll(parts.skip(1)))); <String>[packageDir, 'test_driver']..addAll(parts.skip(1))));
return '${pathWithNoExtension}_test${path.extension(appFile)}'; return '${pathWithNoExtension}_test${path.extension(appFile)}';
} }
} }
......
...@@ -247,7 +247,7 @@ abstract class Device { ...@@ -247,7 +247,7 @@ abstract class Device {
} }
await client.sendRequest('_setVMTimelineFlags', await client.sendRequest('_setVMTimelineFlags',
{'recordedStreams': ['Compiler', 'Dart', 'Embedder', 'GC']} <String, dynamic>{'recordedStreams': <String>['Compiler', 'Dart', 'Embedder', 'GC']}
); );
await client.sendRequest('_clearVMTimeline'); await client.sendRequest('_clearVMTimeline');
} }
...@@ -270,7 +270,7 @@ abstract class Device { ...@@ -270,7 +270,7 @@ abstract class Device {
if (!waitForFirstFrame) { if (!waitForFirstFrame) {
// Stop tracing immediately and get the timeline // Stop tracing immediately and get the timeline
await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'}); await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'});
timeline = await fetchTimeline(); timeline = await fetchTimeline();
} else { } else {
Completer<Null> whenFirstFrameRendered = new Completer<Null>(); Completer<Null> whenFirstFrameRendered = new Completer<Null>();
...@@ -285,7 +285,7 @@ abstract class Device { ...@@ -285,7 +285,7 @@ abstract class Device {
} }
} }
}); });
await peer.sendRequest('streamListen', {'streamId': 'Timeline'}); await peer.sendRequest('streamListen', <String, dynamic>{'streamId': 'Timeline'});
await whenFirstFrameRendered.future.timeout( await whenFirstFrameRendered.future.timeout(
const Duration(seconds: 10), const Duration(seconds: 10),
onTimeout: () { onTimeout: () {
...@@ -298,7 +298,7 @@ abstract class Device { ...@@ -298,7 +298,7 @@ abstract class Device {
} }
); );
timeline = await fetchTimeline(); timeline = await fetchTimeline();
await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'}); await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'});
} }
return timeline; return timeline;
......
...@@ -81,7 +81,7 @@ class IOSDevice extends Device { ...@@ -81,7 +81,7 @@ class IOSDevice extends Device {
if (!doctor.iosWorkflow.hasIDeviceId) if (!doctor.iosWorkflow.hasIDeviceId)
return <IOSDevice>[]; return <IOSDevice>[];
List<IOSDevice> devices = []; List<IOSDevice> devices = <IOSDevice>[];
for (String id in _getAttachedDeviceIDs(mockIOS)) { for (String id in _getAttachedDeviceIDs(mockIOS)) {
String name = _getDeviceName(id, mockIOS); String name = _getDeviceName(id, mockIOS);
devices.add(new IOSDevice(id, name: name)); devices.add(new IOSDevice(id, name: name));
...@@ -92,7 +92,7 @@ class IOSDevice extends Device { ...@@ -92,7 +92,7 @@ class IOSDevice extends Device {
static Iterable<String> _getAttachedDeviceIDs([IOSDevice mockIOS]) { static Iterable<String> _getAttachedDeviceIDs([IOSDevice mockIOS]) {
String listerPath = (mockIOS != null) ? mockIOS.listerPath : _checkForCommand('idevice_id'); String listerPath = (mockIOS != null) ? mockIOS.listerPath : _checkForCommand('idevice_id');
try { try {
String output = runSync([listerPath, '-l']); String output = runSync(<String>[listerPath, '-l']);
return output.trim().split('\n').where((String s) => s != null && s.isNotEmpty); return output.trim().split('\n').where((String s) => s != null && s.isNotEmpty);
} catch (e) { } catch (e) {
return <String>[]; return <String>[];
...@@ -103,17 +103,17 @@ class IOSDevice extends Device { ...@@ -103,17 +103,17 @@ class IOSDevice extends Device {
String informerPath = (mockIOS != null) String informerPath = (mockIOS != null)
? mockIOS.informerPath ? mockIOS.informerPath
: _checkForCommand('ideviceinfo'); : _checkForCommand('ideviceinfo');
return runSync([informerPath, '-k', 'DeviceName', '-u', deviceID]).trim(); return runSync(<String>[informerPath, '-k', 'DeviceName', '-u', deviceID]).trim();
} }
static final Map<String, String> _commandMap = {}; static final Map<String, String> _commandMap = <String, String>{};
static String _checkForCommand( static String _checkForCommand(
String command, [ String command, [
String macInstructions = _ideviceinstallerInstructions String macInstructions = _ideviceinstallerInstructions
]) { ]) {
return _commandMap.putIfAbsent(command, () { return _commandMap.putIfAbsent(command, () {
try { try {
command = runCheckedSync(['which', command]).trim(); command = runCheckedSync(<String>['which', command]).trim();
} catch (e) { } catch (e) {
if (Platform.isMacOS) { if (Platform.isMacOS) {
printError('$command not found. $macInstructions'); printError('$command not found. $macInstructions');
...@@ -128,7 +128,7 @@ class IOSDevice extends Device { ...@@ -128,7 +128,7 @@ class IOSDevice extends Device {
@override @override
bool installApp(ApplicationPackage app) { bool installApp(ApplicationPackage app) {
try { try {
runCheckedSync([installerPath, '-i', app.localPath]); runCheckedSync(<String>[installerPath, '-i', app.localPath]);
return true; return true;
} catch (e) { } catch (e) {
return false; return false;
...@@ -142,7 +142,7 @@ class IOSDevice extends Device { ...@@ -142,7 +142,7 @@ class IOSDevice extends Device {
@override @override
bool isAppInstalled(ApplicationPackage app) { bool isAppInstalled(ApplicationPackage app) {
try { try {
String apps = runCheckedSync([installerPath, '--list-apps']); String apps = runCheckedSync(<String>[installerPath, '--list-apps']);
if (new RegExp(app.id, multiLine: true).hasMatch(apps)) { if (new RegExp(app.id, multiLine: true).hasMatch(apps)) {
return true; return true;
} }
...@@ -181,7 +181,7 @@ class IOSDevice extends Device { ...@@ -181,7 +181,7 @@ class IOSDevice extends Device {
} }
// Step 3: Attempt to install the application on the device. // Step 3: Attempt to install the application on the device.
int installationResult = await runCommandAndStreamOutput([ int installationResult = await runCommandAndStreamOutput(<String>[
'/usr/bin/env', '/usr/bin/env',
'ios-deploy', 'ios-deploy',
'--id', '--id',
......
...@@ -207,7 +207,7 @@ String _getIOSEngineRevision(ApplicationPackage app) { ...@@ -207,7 +207,7 @@ String _getIOSEngineRevision(ApplicationPackage app) {
} }
Future<Null> _addServicesToBundle(Directory bundle) async { Future<Null> _addServicesToBundle(Directory bundle) async {
List<Map<String, String>> services = []; List<Map<String, String>> services = <Map<String, String>>[];
printTrace("Trying to resolve native pub services."); printTrace("Trying to resolve native pub services.");
// Step 1: Parse the service configuration yaml files present in the service // Step 1: Parse the service configuration yaml files present in the service
...@@ -237,18 +237,18 @@ Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Director ...@@ -237,18 +237,18 @@ Future<Null> _copyServiceFrameworks(List<Map<String, String>> services, Director
continue; continue;
} }
// Shell out so permissions on the dylib are preserved. // Shell out so permissions on the dylib are preserved.
runCheckedSync(['/bin/cp', dylib.path, frameworksDirectory.path]); runCheckedSync(<String>['/bin/cp', dylib.path, frameworksDirectory.path]);
} }
} }
void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File manifest) { void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File manifest) {
printTrace("Creating service definitions manifest at '${manifest.path}'"); printTrace("Creating service definitions manifest at '${manifest.path}'");
List<Map<String, String>> jsonServices = services.map((Map<String, String> service) => { List<Map<String, String>> jsonServices = services.map((Map<String, String> service) => <String, String>{
'name': service['name'], 'name': service['name'],
// Since we have already moved it to the Frameworks directory. Strip away // Since we have already moved it to the Frameworks directory. Strip away
// the directory and basenames. // the directory and basenames.
'framework': path.basenameWithoutExtension(service['ios-framework']) 'framework': path.basenameWithoutExtension(service['ios-framework'])
}).toList(); }).toList();
Map<String, dynamic> json = { 'services' : jsonServices }; Map<String, dynamic> json = <String, dynamic>{ 'services' : jsonServices };
manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); manifest.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
} }
...@@ -36,7 +36,7 @@ bool _inflateXcodeArchive(String directory, List<int> archiveBytes) { ...@@ -36,7 +36,7 @@ bool _inflateXcodeArchive(String directory, List<int> archiveBytes) {
dir.createSync(recursive: true); dir.createSync(recursive: true);
// Unzip the Xcode project into the new empty directory // Unzip the Xcode project into the new empty directory
runCheckedSync(['/usr/bin/unzip', tempFile.path, '-d', dir.path]); runCheckedSync(<String>['/usr/bin/unzip', tempFile.path, '-d', dir.path]);
} catch (error) { } catch (error) {
printTrace('$error'); printTrace('$error');
return false; return false;
......
...@@ -71,7 +71,7 @@ class SimControl { ...@@ -71,7 +71,7 @@ class SimControl {
// "template" is but the built-in 'Blank' seems to work. -l causes xcrun to // "template" is but the built-in 'Blank' seems to work. -l causes xcrun to
// quit after a time limit without killing the simulator. We quit after // quit after a time limit without killing the simulator. We quit after
// 1 second. // 1 second.
List<String> args = [_xcrunPath, 'instruments', '-w', deviceName, '-t', 'Blank', '-l', '1']; List<String> args = <String>[_xcrunPath, 'instruments', '-w', deviceName, '-t', 'Blank', '-l', '1'];
printTrace(args.join(' ')); printTrace(args.join(' '));
runDetached(args); runDetached(args);
printStatus('Waiting for iOS Simulator to boot...'); printStatus('Waiting for iOS Simulator to boot...');
...@@ -112,7 +112,7 @@ class SimControl { ...@@ -112,7 +112,7 @@ class SimControl {
// Create new device // Create new device
String deviceName = '${deviceType.name} $_kFlutterTestDeviceSuffix'; String deviceName = '${deviceType.name} $_kFlutterTestDeviceSuffix';
List<String> args = [_xcrunPath, 'simctl', 'create', deviceName, deviceType.identifier, runtime]; List<String> args = <String>[_xcrunPath, 'simctl', 'create', deviceName, deviceType.identifier, runtime];
printTrace(args.join(' ')); printTrace(args.join(' '));
runCheckedSync(args); runCheckedSync(args);
...@@ -275,11 +275,11 @@ class SimControl { ...@@ -275,11 +275,11 @@ class SimControl {
bool _isAnyConnected() => getConnectedDevices().isNotEmpty; bool _isAnyConnected() => getConnectedDevices().isNotEmpty;
void install(String deviceId, String appPath) { void install(String deviceId, String appPath) {
runCheckedSync([_xcrunPath, 'simctl', 'install', deviceId, appPath]); runCheckedSync(<String>[_xcrunPath, 'simctl', 'install', deviceId, appPath]);
} }
void launch(String deviceId, String appIdentifier, [List<String> launchArgs]) { void launch(String deviceId, String appIdentifier, [List<String> launchArgs]) {
List<String> args = [_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier]; List<String> args = <String>[_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier];
if (launchArgs != null) if (launchArgs != null)
args.addAll(launchArgs); args.addAll(launchArgs);
runCheckedSync(args); runCheckedSync(args);
...@@ -508,7 +508,7 @@ class IOSSimulator extends Device { ...@@ -508,7 +508,7 @@ class IOSSimulator extends Device {
} }
bool _applicationIsInstalledAndRunning(ApplicationPackage app) { bool _applicationIsInstalledAndRunning(ApplicationPackage app) {
bool isInstalled = exitsHappy([ bool isInstalled = exitsHappy(<String>[
'xcrun', 'xcrun',
'simctl', 'simctl',
'get_app_container', 'get_app_container',
...@@ -516,7 +516,7 @@ class IOSSimulator extends Device { ...@@ -516,7 +516,7 @@ class IOSSimulator extends Device {
app.id, app.id,
]); ]);
bool isRunning = exitsHappy([ bool isRunning = exitsHappy(<String>[
'/usr/bin/killall', '/usr/bin/killall',
'Runner', 'Runner',
]); ]);
......
...@@ -74,7 +74,7 @@ abstract class FlutterCommand extends Command { ...@@ -74,7 +74,7 @@ abstract class FlutterCommand extends Command {
} }
BuildMode getBuildMode() { BuildMode getBuildMode() {
List<bool> modeFlags = [argResults['debug'], argResults['profile'], argResults['release']]; List<bool> modeFlags = <bool>[argResults['debug'], argResults['profile'], argResults['release']];
if (modeFlags.where((bool flag) => flag).length > 1) if (modeFlags.where((bool flag) => flag).length > 1)
throw new UsageException('Only one of --debug, --profile, or --release should be specified.', null); throw new UsageException('Only one of --debug, --profile, or --release should be specified.', null);
......
...@@ -51,7 +51,7 @@ Future<Null> parseServiceConfigs( ...@@ -51,7 +51,7 @@ Future<Null> parseServiceConfigs(
} }
for (Map<String, String> service in serviceConfig['services']) { for (Map<String, String> service in serviceConfig['services']) {
services.add({ services.add(<String, String>{
'root': serviceRoot, 'root': serviceRoot,
'name': service['name'], 'name': service['name'],
'android-class': service['android-class'], 'android-class': service['android-class'],
...@@ -92,12 +92,12 @@ File generateServiceDefinitions( ...@@ -92,12 +92,12 @@ File generateServiceDefinitions(
String dir, List<Map<String, String>> servicesIn String dir, List<Map<String, String>> servicesIn
) { ) {
List<Map<String, String>> services = List<Map<String, String>> services =
servicesIn.map((Map<String, String> service) => { servicesIn.map((Map<String, String> service) => <String, String>{
'name': service['name'], 'name': service['name'],
'class': service['android-class'] 'class': service['android-class']
}).toList(); }).toList();
Map<String, dynamic> json = { 'services': services }; Map<String, dynamic> json = <String, dynamic>{ 'services': services };
File servicesFile = new File(path.join(dir, 'services.json')); File servicesFile = new File(path.join(dir, 'services.json'));
servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true); servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
return servicesFile; return servicesFile;
......
...@@ -23,7 +23,7 @@ const String _kPath = '/runner'; ...@@ -23,7 +23,7 @@ const String _kPath = '/runner';
String shellPath; String shellPath;
void installHook() { void installHook() {
hack.registerPlatformPlugin([TestPlatform.vm], () => new FlutterPlatform()); hack.registerPlatformPlugin(<TestPlatform>[TestPlatform.vm], () => new FlutterPlatform());
} }
class _ServerInfo { class _ServerInfo {
...@@ -46,7 +46,7 @@ Future<_ServerInfo> _startServer() async { ...@@ -46,7 +46,7 @@ Future<_ServerInfo> _startServer() async {
Future<Process> _startProcess(String mainPath, { String packages }) { Future<Process> _startProcess(String mainPath, { String packages }) {
assert(shellPath != null || _kSkyShell != null); // Please provide the path to the shell in the SKY_SHELL environment variable. assert(shellPath != null || _kSkyShell != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
return Process.start(shellPath ?? _kSkyShell, [ return Process.start(shellPath ?? _kSkyShell, <String>[
'--enable-checked-mode', '--enable-checked-mode',
'--non-interactive', '--non-interactive',
'--packages=$packages', '--packages=$packages',
......
...@@ -29,7 +29,7 @@ class SnapshotCompiler { ...@@ -29,7 +29,7 @@ class SnapshotCompiler {
assert(mainPath != null); assert(mainPath != null);
assert(snapshotPath != null); assert(snapshotPath != null);
final List<String> args = [ final List<String> args = <String>[
_path, _path,
mainPath, mainPath,
'--packages=${PackageMap.instance.packagesPath}', '--packages=${PackageMap.instance.packagesPath}',
......
...@@ -35,7 +35,9 @@ void main() { ...@@ -35,7 +35,9 @@ void main() {
AnalyzeCommand command = new AnalyzeCommand(); AnalyzeCommand command = new AnalyzeCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
return createTestCommandRunner(command).run(['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]).then((int code) { return createTestCommandRunner(command).run(
<String>['analyze', '--no-current-package', '--no-current-directory', dartFileA.path, dartFileB.path]
).then((int code) {
expect(code, equals(1)); expect(code, equals(1));
expect(testLogger.errorText, '[warning] The imported libraries \'a.dart\' and \'b.dart\' cannot have the same name \'test\' (${dartFileB.path})\n'); expect(testLogger.errorText, '[warning] The imported libraries \'a.dart\' and \'b.dart\' cannot have the same name \'test\' (${dartFileB.path})\n');
expect(testLogger.statusText, 'Analyzing 2 entry points...\n'); expect(testLogger.statusText, 'Analyzing 2 entry points...\n');
......
...@@ -88,7 +88,7 @@ void main() { ...@@ -88,7 +88,7 @@ void main() {
(Map<String, dynamic> result) => responses.add(result), (Map<String, dynamic> result) => responses.add(result),
notifyingLogger: notifyingLogger notifyingLogger: notifyingLogger
); );
commands.add({'id': 0, 'method': 'daemon.shutdown'}); commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
return daemon.onExit.then((int code) { return daemon.onExit.then((int code) {
expect(code, 0); expect(code, 0);
}); });
...@@ -121,7 +121,7 @@ void main() { ...@@ -121,7 +121,7 @@ void main() {
(Map<String, dynamic> result) => responses.add(result), (Map<String, dynamic> result) => responses.add(result),
notifyingLogger: notifyingLogger notifyingLogger: notifyingLogger
); );
commands.add({'id': 0, 'method': 'device.getDevices'}); commands.add(<String, dynamic>{'id': 0, 'method': 'device.getDevices'});
Map<String, dynamic> response = await responses.stream.where(_notEvent).first; Map<String, dynamic> response = await responses.stream.where(_notEvent).first;
expect(response['id'], 0); expect(response['id'], 0);
expect(response['result'], isList); expect(response['result'], isList);
......
...@@ -14,14 +14,14 @@ void main() { ...@@ -14,14 +14,14 @@ void main() {
group('devices', () { group('devices', () {
testUsingContext('returns 0 when called', () { testUsingContext('returns 0 when called', () {
DevicesCommand command = new DevicesCommand(); DevicesCommand command = new DevicesCommand();
return createTestCommandRunner(command).run(['list']).then((int code) { return createTestCommandRunner(command).run(<String>['list']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
}); });
}); });
testUsingContext('no error when no connected devices', () { testUsingContext('no error when no connected devices', () {
DevicesCommand command = new DevicesCommand(); DevicesCommand command = new DevicesCommand();
return createTestCommandRunner(command).run(['list']).then((int code) { return createTestCommandRunner(command).run(<String>['list']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
expect(testLogger.statusText, contains('No connected devices')); expect(testLogger.statusText, contains('No connected devices'));
}); });
......
...@@ -60,7 +60,7 @@ void main() { ...@@ -60,7 +60,7 @@ void main() {
testUsingContext('returns 1 when test file is not found', () { testUsingContext('returns 1 when test file is not found', () {
withMockDevice(); withMockDevice();
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=/some/app/test/e2e.dart', '--target=/some/app/test/e2e.dart',
]; ];
...@@ -84,7 +84,7 @@ void main() { ...@@ -84,7 +84,7 @@ void main() {
await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testApp).writeAsString('main() {}');
await memFs.file(testFile).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}');
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=$testApp', '--target=$testApp',
]; ];
...@@ -102,7 +102,7 @@ void main() { ...@@ -102,7 +102,7 @@ void main() {
useInMemoryFileSystem(cwd: packageDir); useInMemoryFileSystem(cwd: packageDir);
String appFile = '/not/in/my/app.dart'; String appFile = '/not/in/my/app.dart';
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=$appFile', '--target=$appFile',
]; ];
...@@ -120,7 +120,7 @@ void main() { ...@@ -120,7 +120,7 @@ void main() {
useInMemoryFileSystem(cwd: packageDir); useInMemoryFileSystem(cwd: packageDir);
String appFile = '/my/app/main.dart'; String appFile = '/my/app/main.dart';
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=$appFile', '--target=$appFile',
]; ];
...@@ -144,7 +144,7 @@ void main() { ...@@ -144,7 +144,7 @@ void main() {
return new Future<int>.value(0); return new Future<int>.value(0);
}); });
testRunner = expectAsync((List<String> testArgs) { testRunner = expectAsync((List<String> testArgs) {
expect(testArgs, [testFile]); expect(testArgs, <String>[testFile]);
return new Future<int>.value(0); return new Future<int>.value(0);
}); });
appStopper = expectAsync((_) { appStopper = expectAsync((_) {
...@@ -155,7 +155,7 @@ void main() { ...@@ -155,7 +155,7 @@ void main() {
await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testApp).writeAsString('main() {}');
await memFs.file(testFile).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}');
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=$testApp', '--target=$testApp',
]; ];
...@@ -186,7 +186,7 @@ void main() { ...@@ -186,7 +186,7 @@ void main() {
await memFs.file(testApp).writeAsString('main() {}'); await memFs.file(testApp).writeAsString('main() {}');
await memFs.file(testFile).writeAsString('main() {}'); await memFs.file(testFile).writeAsString('main() {}');
List<String> args = [ List<String> args = <String>[
'drive', 'drive',
'--target=$testApp', '--target=$testApp',
]; ];
...@@ -243,7 +243,7 @@ void main() { ...@@ -243,7 +243,7 @@ void main() {
Device emulator = new MockDevice(); Device emulator = new MockDevice();
when(emulator.name).thenReturn('new-simulator'); when(emulator.name).thenReturn('new-simulator');
when(IOSSimulatorUtils.instance.getAttachedDevices()) when(IOSSimulatorUtils.instance.getAttachedDevices())
.thenReturn([emulator]); .thenReturn(<Device>[emulator]);
Device device = await findTargetDevice(); Device device = await findTargetDevice();
expect(device.name, 'new-simulator'); expect(device.name, 'new-simulator');
......
...@@ -21,7 +21,7 @@ void main() { ...@@ -21,7 +21,7 @@ void main() {
when(device.installApp(any)).thenReturn(true); when(device.installApp(any)).thenReturn(true);
testDeviceManager.addDevice(device); testDeviceManager.addDevice(device);
return createTestCommandRunner(command).run(['install']).then((int code) { return createTestCommandRunner(command).run(<String>['install']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
}); });
}); });
...@@ -35,7 +35,7 @@ void main() { ...@@ -35,7 +35,7 @@ void main() {
when(device.installApp(any)).thenReturn(true); when(device.installApp(any)).thenReturn(true);
testDeviceManager.addDevice(device); testDeviceManager.addDevice(device);
return createTestCommandRunner(command).run(['install']).then((int code) { return createTestCommandRunner(command).run(<String>['install']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
}); });
}); });
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
testUsingContext('returns 1 when no device is connected', () { testUsingContext('returns 1 when no device is connected', () {
ListenCommand command = new ListenCommand(singleRun: true); ListenCommand command = new ListenCommand(singleRun: true);
applyMocksToCommand(command); applyMocksToCommand(command);
return createTestCommandRunner(command).run(['listen']).then((int code) { return createTestCommandRunner(command).run(<String>['listen']).then((int code) {
expect(code, equals(1)); expect(code, equals(1));
}); });
}); });
......
...@@ -108,7 +108,7 @@ class MockDoctor extends Doctor { ...@@ -108,7 +108,7 @@ class MockDoctor extends Doctor {
class MockSimControl extends Mock implements SimControl { class MockSimControl extends Mock implements SimControl {
MockSimControl() { MockSimControl() {
when(this.getConnectedDevices()).thenReturn([]); when(this.getConnectedDevices()).thenReturn(<SimDevice>[]);
} }
} }
......
...@@ -20,7 +20,7 @@ void main() { ...@@ -20,7 +20,7 @@ void main() {
MockAndroidDevice device = new MockAndroidDevice(); MockAndroidDevice device = new MockAndroidDevice();
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true)); when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
testDeviceManager.addDevice(device); testDeviceManager.addDevice(device);
return createTestCommandRunner(command).run(['stop']).then((int code) { return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
}); });
}); });
...@@ -32,7 +32,7 @@ void main() { ...@@ -32,7 +32,7 @@ void main() {
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true)); when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
testDeviceManager.addDevice(device); testDeviceManager.addDevice(device);
return createTestCommandRunner(command).run(['stop']).then((int code) { return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
expect(code, equals(0)); expect(code, equals(0));
}); });
}); });
......
...@@ -14,7 +14,7 @@ void main() { ...@@ -14,7 +14,7 @@ void main() {
testUsingContext('returns 1 when no Android device is connected', () { testUsingContext('returns 1 when no Android device is connected', () {
TraceCommand command = new TraceCommand(); TraceCommand command = new TraceCommand();
applyMocksToCommand(command); applyMocksToCommand(command);
return createTestCommandRunner(command).run(['trace']).then((int code) { return createTestCommandRunner(command).run(<String>['trace']).then((int code) {
expect(code, equals(1)); expect(code, equals(1));
}); });
}); });
......
...@@ -16,7 +16,7 @@ Process daemon; ...@@ -16,7 +16,7 @@ Process daemon;
// devices: list devices // devices: list devices
Future<Null> main() async { Future<Null> main() async {
daemon = await Process.start('dart', ['bin/flutter_tools.dart', 'daemon']); daemon = await Process.start('dart', <String>['bin/flutter_tools.dart', 'daemon']);
print('daemon process started, pid: ${daemon.pid}'); print('daemon process started, pid: ${daemon.pid}');
daemon.stdout daemon.stdout
...@@ -28,15 +28,15 @@ Future<Null> main() async { ...@@ -28,15 +28,15 @@ Future<Null> main() async {
stdout.write('> '); stdout.write('> ');
stdin.transform(UTF8.decoder).transform(const LineSplitter()).listen((String line) { stdin.transform(UTF8.decoder).transform(const LineSplitter()).listen((String line) {
if (line == 'version' || line == 'v') { if (line == 'version' || line == 'v') {
_send({'method': 'daemon.version'}); _send(<String, dynamic>{'method': 'daemon.version'});
} else if (line == 'shutdown' || line == 'q') { } else if (line == 'shutdown' || line == 'q') {
_send({'method': 'daemon.shutdown'}); _send(<String, dynamic>{'method': 'daemon.shutdown'});
} else if (line == 'start') { } else if (line == 'start') {
_send({'method': 'app.start'}); _send(<String, dynamic>{'method': 'app.start'});
} else if (line == 'stopAll') { } else if (line == 'stopAll') {
_send({'method': 'app.stopAll'}); _send(<String, dynamic>{'method': 'app.stopAll'});
} else if (line == 'devices') { } else if (line == 'devices') {
_send({'method': 'device.getDevices'}); _send(<String, dynamic>{'method': 'device.getDevices'});
} else { } else {
print('command not understood: $line'); print('command not understood: $line');
} }
......
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