fix analysis errors (#3677)
* fix analysis errors * review comments; fix test * re-add an export for debugPrint
This commit is contained in:
parent
76724e857f
commit
c9010c91f6
@ -5,7 +5,7 @@
|
||||
import 'package:flutter/painting.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
|
||||
/// boxes, such as RenderPadding, to draw construction lines.
|
||||
|
@ -9,7 +9,7 @@ import 'package:sky_services/flutter/platform/system_chrome.mojom.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 proxy = new mojom.SystemChromeProxy.unbound();
|
||||
|
@ -32,7 +32,6 @@ export 'package:flutter/rendering.dart' show
|
||||
MaxTileWidthGridDelegate,
|
||||
MultiChildLayoutDelegate,
|
||||
PaintingContext,
|
||||
PlainTextSpan,
|
||||
PointerCancelEvent,
|
||||
PointerCancelEventListener,
|
||||
PointerDownEvent,
|
||||
|
@ -9,7 +9,6 @@ import 'package:vector_math/vector_math_64.dart' show Matrix4;
|
||||
import 'basic.dart';
|
||||
import 'framework.dart';
|
||||
|
||||
export 'package:flutter/animation.dart' show AnimationDirection;
|
||||
export 'package:flutter/rendering.dart' show RelativeRect;
|
||||
|
||||
/// A widget that rebuilds when the given animation changes value.
|
||||
|
@ -32,14 +32,10 @@ export 'src/health.dart' show
|
||||
HealthStatus;
|
||||
|
||||
export 'src/message.dart' show
|
||||
Message,
|
||||
Command,
|
||||
CommandWithTarget,
|
||||
Result;
|
||||
|
||||
export 'src/timeline_summary.dart' show
|
||||
summarizeTimeline,
|
||||
EventTrace,
|
||||
TimelineSummary;
|
||||
|
||||
export 'src/timeline.dart' show
|
||||
|
@ -23,7 +23,7 @@ class Adb {
|
||||
|
||||
bool exists() {
|
||||
try {
|
||||
runCheckedSync([adbPath, 'version']);
|
||||
runCheckedSync(<String>[adbPath, 'version']);
|
||||
return true;
|
||||
} catch (exception) {
|
||||
return false;
|
||||
@ -36,18 +36,18 @@ class Adb {
|
||||
/// Revision eac51f2bb6a8-android
|
||||
///
|
||||
/// 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
|
||||
/// adb server.
|
||||
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
|
||||
/// adb server.
|
||||
void killServer() {
|
||||
runCheckedSync([adbPath, 'kill-server']);
|
||||
runCheckedSync(<String>[adbPath, 'kill-server']);
|
||||
}
|
||||
|
||||
/// Ask the ADB server for its internal version number.
|
||||
|
@ -56,7 +56,9 @@ class AndroidDevice extends Device {
|
||||
if (_isLocalEmulator == null) {
|
||||
// http://developer.android.com/ndk/guides/abis.html (x86, armeabi-v7a, ...)
|
||||
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');
|
||||
} catch (error) {
|
||||
_isLocalEmulator = false;
|
||||
@ -164,7 +166,7 @@ class AndroidDevice extends Device {
|
||||
@override
|
||||
bool isAppInstalled(ApplicationPackage app) {
|
||||
// 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;
|
||||
|
||||
// Check the application SHA.
|
||||
@ -405,7 +407,7 @@ class AndroidDevice extends Device {
|
||||
///
|
||||
/// [mockAdbOutput] is public for testing.
|
||||
List<AndroidDevice> getAdbDevices({ String mockAdbOutput }) {
|
||||
List<AndroidDevice> devices = [];
|
||||
List<AndroidDevice> devices = <AndroidDevice>[];
|
||||
List<String> output;
|
||||
|
||||
if (mockAdbOutput == null) {
|
||||
|
@ -57,6 +57,6 @@ class AppContext {
|
||||
}
|
||||
|
||||
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 {
|
||||
|
||||
@override
|
||||
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`
|
||||
|
@ -18,7 +18,7 @@ typedef String StringConverter(String string);
|
||||
Future<Process> runCommand(List<String> cmd, { String workingDirectory }) async {
|
||||
printTrace(cmd.join(' '));
|
||||
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(
|
||||
executable,
|
||||
arguments,
|
||||
|
@ -206,12 +206,12 @@ class FlutterEngine {
|
||||
// Return a list of (cache directory path, download URL path) tuples.
|
||||
List<List<String>> _getToolsDirs() {
|
||||
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)
|
||||
return <List<String>>[
|
||||
['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'],
|
||||
['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'],
|
||||
<String>['linux-x64', 'linux-x64/artifacts.zip'],
|
||||
<String>['android-arm-profile/linux-x64', 'android-arm-profile/linux-x64.zip'],
|
||||
<String>['android-arm-release/linux-x64', 'android-arm-release/linux-x64.zip'],
|
||||
];
|
||||
else
|
||||
return <List<String>>[];
|
||||
|
@ -107,7 +107,7 @@ String buildAotSnapshot(
|
||||
String vmServicePath = path.join(skyEngineSdkExt, 'dart', 'runtime', 'bin', 'vmservice', 'vmservice_io.dart');
|
||||
String jniPath = path.join(skyEngineSdkExt, 'dart_jni', 'jni.dart');
|
||||
|
||||
List<String> filePaths = [
|
||||
List<String> filePaths = <String>[
|
||||
genSnapshot, vmEntryPoints, vmEntryPointsAndroid, mojoInternalPath, uiPath, vmServicePath, jniPath
|
||||
];
|
||||
List<String> missingFiles = filePaths.where((String p) => !FileSystemEntity.isFileSync(p)).toList();
|
||||
@ -116,7 +116,7 @@ String buildAotSnapshot(
|
||||
return null;
|
||||
}
|
||||
|
||||
List<String> genSnapshotCmd = [
|
||||
List<String> genSnapshotCmd = <String>[
|
||||
genSnapshot,
|
||||
'--vm_isolate_snapshot=$vmIsolateSnapshot',
|
||||
'--isolate_snapshot=$isolateSnapshot',
|
||||
@ -133,7 +133,7 @@ String buildAotSnapshot(
|
||||
];
|
||||
|
||||
if (!(tools.engineRelease || buildMode == BuildMode.release)) {
|
||||
genSnapshotCmd.addAll([
|
||||
genSnapshotCmd.addAll(<String>[
|
||||
'--no-checked',
|
||||
'--conditional_directives',
|
||||
]);
|
||||
|
@ -111,7 +111,7 @@ class _ApkBuilder {
|
||||
'-F', outputApk.path,
|
||||
];
|
||||
if (resources != null)
|
||||
packageArgs.addAll(['-S', resources.absolute.path]);
|
||||
packageArgs.addAll(<String>['-S', resources.absolute.path]);
|
||||
packageArgs.add(artifacts.path);
|
||||
runCheckedSync(packageArgs);
|
||||
}
|
||||
@ -136,7 +136,7 @@ class _ApkComponents {
|
||||
File manifest;
|
||||
File icuData;
|
||||
List<File> jars;
|
||||
List<Map<String, String>> services = [];
|
||||
List<Map<String, String>> services = <Map<String, String>>[];
|
||||
File libSkyShell;
|
||||
File debugKeystore;
|
||||
Directory resources;
|
||||
@ -408,7 +408,7 @@ bool _needsRebuild(String apkPath, String manifest) {
|
||||
// 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
|
||||
// over the network without needing to rebuild (at least on Android).
|
||||
Iterable<FileStat> dependenciesStat = [
|
||||
Iterable<FileStat> dependenciesStat = <String>[
|
||||
manifest,
|
||||
_kFlutterManifestPath,
|
||||
_kPackagesStatusPath
|
||||
|
@ -135,7 +135,7 @@ class Daemon {
|
||||
|
||||
_domainMap[prefix].handleCommand(name, id, request['params']);
|
||||
} catch (error) {
|
||||
_send({'id': id, 'error': _toJsonable(error)});
|
||||
_send(<String, dynamic>{'id': id, 'error': _toJsonable(error)});
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ abstract class Domain {
|
||||
}
|
||||
|
||||
void sendEvent(String name, [dynamic args]) {
|
||||
Map<String, dynamic> map = { 'event': name };
|
||||
Map<String, dynamic> map = <String, dynamic>{ 'event': name };
|
||||
if (args != null)
|
||||
map['params'] = _toJsonable(args);
|
||||
_send(map);
|
||||
@ -202,13 +202,13 @@ class DaemonDomain extends Domain {
|
||||
|
||||
_subscription = daemon.notifyingLogger.onMessage.listen((LogMessage message) {
|
||||
if (message.stackTrace != null) {
|
||||
sendEvent('daemon.logMessage', {
|
||||
sendEvent('daemon.logMessage', <String, dynamic>{
|
||||
'level': message.level,
|
||||
'message': message.message,
|
||||
'stackTrace': message.stackTrace.toString()
|
||||
});
|
||||
} else {
|
||||
sendEvent('daemon.logMessage', {
|
||||
sendEvent('daemon.logMessage', <String, dynamic>{
|
||||
'level': message.level,
|
||||
'message': message.message
|
||||
});
|
||||
|
@ -109,7 +109,7 @@ class DriveCommand extends RunCommandBase {
|
||||
}
|
||||
|
||||
try {
|
||||
return await testRunner([testFile])
|
||||
return await testRunner(<String>[testFile])
|
||||
.catchError((dynamic error, dynamic stackTrace) {
|
||||
printError('CAUGHT EXCEPTION: $error\n$stackTrace');
|
||||
return 1;
|
||||
@ -162,7 +162,7 @@ class DriveCommand extends RunCommandBase {
|
||||
// if the application is `lib/foo/bar.dart`, the test file is expected to
|
||||
// be `test_driver/foo/bar_test.dart`.
|
||||
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)}';
|
||||
}
|
||||
}
|
||||
|
@ -247,12 +247,12 @@ abstract class Device {
|
||||
}
|
||||
|
||||
await client.sendRequest('_setVMTimelineFlags',
|
||||
{'recordedStreams': ['Compiler', 'Dart', 'Embedder', 'GC']}
|
||||
<String, dynamic>{'recordedStreams': <String>['Compiler', 'Dart', 'Embedder', 'GC']}
|
||||
);
|
||||
await client.sendRequest('_clearVMTimeline');
|
||||
}
|
||||
|
||||
/// Stops tracing, optionally waiting
|
||||
/// Stops tracing, optionally waiting
|
||||
Future<Map<String, dynamic>> stopTracingAndDownloadTimeline(int observatoryPort, {bool waitForFirstFrame: false}) async {
|
||||
rpc.Peer peer;
|
||||
try {
|
||||
@ -270,7 +270,7 @@ abstract class Device {
|
||||
|
||||
if (!waitForFirstFrame) {
|
||||
// Stop tracing immediately and get the timeline
|
||||
await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'});
|
||||
await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'});
|
||||
timeline = await fetchTimeline();
|
||||
} else {
|
||||
Completer<Null> whenFirstFrameRendered = new Completer<Null>();
|
||||
@ -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(
|
||||
const Duration(seconds: 10),
|
||||
onTimeout: () {
|
||||
@ -298,7 +298,7 @@ abstract class Device {
|
||||
}
|
||||
);
|
||||
timeline = await fetchTimeline();
|
||||
await peer.sendRequest('_setVMTimelineFlags', {'recordedStreams': '[]'});
|
||||
await peer.sendRequest('_setVMTimelineFlags', <String, dynamic>{'recordedStreams': '[]'});
|
||||
}
|
||||
|
||||
return timeline;
|
||||
|
@ -81,7 +81,7 @@ class IOSDevice extends Device {
|
||||
if (!doctor.iosWorkflow.hasIDeviceId)
|
||||
return <IOSDevice>[];
|
||||
|
||||
List<IOSDevice> devices = [];
|
||||
List<IOSDevice> devices = <IOSDevice>[];
|
||||
for (String id in _getAttachedDeviceIDs(mockIOS)) {
|
||||
String name = _getDeviceName(id, mockIOS);
|
||||
devices.add(new IOSDevice(id, name: name));
|
||||
@ -92,7 +92,7 @@ class IOSDevice extends Device {
|
||||
static Iterable<String> _getAttachedDeviceIDs([IOSDevice mockIOS]) {
|
||||
String listerPath = (mockIOS != null) ? mockIOS.listerPath : _checkForCommand('idevice_id');
|
||||
try {
|
||||
String output = runSync([listerPath, '-l']);
|
||||
String output = runSync(<String>[listerPath, '-l']);
|
||||
return output.trim().split('\n').where((String s) => s != null && s.isNotEmpty);
|
||||
} catch (e) {
|
||||
return <String>[];
|
||||
@ -103,17 +103,17 @@ class IOSDevice extends Device {
|
||||
String informerPath = (mockIOS != null)
|
||||
? mockIOS.informerPath
|
||||
: _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(
|
||||
String command, [
|
||||
String macInstructions = _ideviceinstallerInstructions
|
||||
]) {
|
||||
return _commandMap.putIfAbsent(command, () {
|
||||
try {
|
||||
command = runCheckedSync(['which', command]).trim();
|
||||
command = runCheckedSync(<String>['which', command]).trim();
|
||||
} catch (e) {
|
||||
if (Platform.isMacOS) {
|
||||
printError('$command not found. $macInstructions');
|
||||
@ -128,7 +128,7 @@ class IOSDevice extends Device {
|
||||
@override
|
||||
bool installApp(ApplicationPackage app) {
|
||||
try {
|
||||
runCheckedSync([installerPath, '-i', app.localPath]);
|
||||
runCheckedSync(<String>[installerPath, '-i', app.localPath]);
|
||||
return true;
|
||||
} catch (e) {
|
||||
return false;
|
||||
@ -142,7 +142,7 @@ class IOSDevice extends Device {
|
||||
@override
|
||||
bool isAppInstalled(ApplicationPackage app) {
|
||||
try {
|
||||
String apps = runCheckedSync([installerPath, '--list-apps']);
|
||||
String apps = runCheckedSync(<String>[installerPath, '--list-apps']);
|
||||
if (new RegExp(app.id, multiLine: true).hasMatch(apps)) {
|
||||
return true;
|
||||
}
|
||||
@ -181,7 +181,7 @@ class IOSDevice extends Device {
|
||||
}
|
||||
|
||||
// Step 3: Attempt to install the application on the device.
|
||||
int installationResult = await runCommandAndStreamOutput([
|
||||
int installationResult = await runCommandAndStreamOutput(<String>[
|
||||
'/usr/bin/env',
|
||||
'ios-deploy',
|
||||
'--id',
|
||||
|
@ -207,7 +207,7 @@ String _getIOSEngineRevision(ApplicationPackage app) {
|
||||
}
|
||||
|
||||
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.");
|
||||
|
||||
// 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
|
||||
continue;
|
||||
}
|
||||
// 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) {
|
||||
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'],
|
||||
// Since we have already moved it to the Frameworks directory. Strip away
|
||||
// the directory and basenames.
|
||||
'framework': path.basenameWithoutExtension(service['ios-framework'])
|
||||
}).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);
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ bool _inflateXcodeArchive(String directory, List<int> archiveBytes) {
|
||||
dir.createSync(recursive: true);
|
||||
|
||||
// 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) {
|
||||
printTrace('$error');
|
||||
return false;
|
||||
|
@ -71,7 +71,7 @@ class SimControl {
|
||||
// "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
|
||||
// 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(' '));
|
||||
runDetached(args);
|
||||
printStatus('Waiting for iOS Simulator to boot...');
|
||||
@ -112,7 +112,7 @@ class SimControl {
|
||||
|
||||
// Create new device
|
||||
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(' '));
|
||||
runCheckedSync(args);
|
||||
|
||||
@ -275,11 +275,11 @@ class SimControl {
|
||||
bool _isAnyConnected() => getConnectedDevices().isNotEmpty;
|
||||
|
||||
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]) {
|
||||
List<String> args = [_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier];
|
||||
List<String> args = <String>[_xcrunPath, 'simctl', 'launch', deviceId, appIdentifier];
|
||||
if (launchArgs != null)
|
||||
args.addAll(launchArgs);
|
||||
runCheckedSync(args);
|
||||
@ -508,7 +508,7 @@ class IOSSimulator extends Device {
|
||||
}
|
||||
|
||||
bool _applicationIsInstalledAndRunning(ApplicationPackage app) {
|
||||
bool isInstalled = exitsHappy([
|
||||
bool isInstalled = exitsHappy(<String>[
|
||||
'xcrun',
|
||||
'simctl',
|
||||
'get_app_container',
|
||||
@ -516,7 +516,7 @@ class IOSSimulator extends Device {
|
||||
app.id,
|
||||
]);
|
||||
|
||||
bool isRunning = exitsHappy([
|
||||
bool isRunning = exitsHappy(<String>[
|
||||
'/usr/bin/killall',
|
||||
'Runner',
|
||||
]);
|
||||
|
@ -74,7 +74,7 @@ abstract class FlutterCommand extends Command {
|
||||
}
|
||||
|
||||
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)
|
||||
throw new UsageException('Only one of --debug, --profile, or --release should be specified.', null);
|
||||
|
||||
|
@ -51,7 +51,7 @@ Future<Null> parseServiceConfigs(
|
||||
}
|
||||
|
||||
for (Map<String, String> service in serviceConfig['services']) {
|
||||
services.add({
|
||||
services.add(<String, String>{
|
||||
'root': serviceRoot,
|
||||
'name': service['name'],
|
||||
'android-class': service['android-class'],
|
||||
@ -92,12 +92,12 @@ File generateServiceDefinitions(
|
||||
String dir, List<Map<String, String>> servicesIn
|
||||
) {
|
||||
List<Map<String, String>> services =
|
||||
servicesIn.map((Map<String, String> service) => {
|
||||
servicesIn.map((Map<String, String> service) => <String, String>{
|
||||
'name': service['name'],
|
||||
'class': service['android-class']
|
||||
}).toList();
|
||||
|
||||
Map<String, dynamic> json = { 'services': services };
|
||||
Map<String, dynamic> json = <String, dynamic>{ 'services': services };
|
||||
File servicesFile = new File(path.join(dir, 'services.json'));
|
||||
servicesFile.writeAsStringSync(JSON.encode(json), mode: FileMode.WRITE, flush: true);
|
||||
return servicesFile;
|
||||
|
@ -23,7 +23,7 @@ const String _kPath = '/runner';
|
||||
String shellPath;
|
||||
|
||||
void installHook() {
|
||||
hack.registerPlatformPlugin([TestPlatform.vm], () => new FlutterPlatform());
|
||||
hack.registerPlatformPlugin(<TestPlatform>[TestPlatform.vm], () => new FlutterPlatform());
|
||||
}
|
||||
|
||||
class _ServerInfo {
|
||||
@ -46,7 +46,7 @@ Future<_ServerInfo> _startServer() async {
|
||||
|
||||
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.
|
||||
return Process.start(shellPath ?? _kSkyShell, [
|
||||
return Process.start(shellPath ?? _kSkyShell, <String>[
|
||||
'--enable-checked-mode',
|
||||
'--non-interactive',
|
||||
'--packages=$packages',
|
||||
|
@ -29,7 +29,7 @@ class SnapshotCompiler {
|
||||
assert(mainPath != null);
|
||||
assert(snapshotPath != null);
|
||||
|
||||
final List<String> args = [
|
||||
final List<String> args = <String>[
|
||||
_path,
|
||||
mainPath,
|
||||
'--packages=${PackageMap.instance.packagesPath}',
|
||||
|
@ -35,7 +35,9 @@ void main() {
|
||||
|
||||
AnalyzeCommand command = new AnalyzeCommand();
|
||||
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(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');
|
||||
|
@ -88,7 +88,7 @@ void main() {
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
notifyingLogger: notifyingLogger
|
||||
);
|
||||
commands.add({'id': 0, 'method': 'daemon.shutdown'});
|
||||
commands.add(<String, dynamic>{'id': 0, 'method': 'daemon.shutdown'});
|
||||
return daemon.onExit.then((int code) {
|
||||
expect(code, 0);
|
||||
});
|
||||
@ -121,7 +121,7 @@ void main() {
|
||||
(Map<String, dynamic> result) => responses.add(result),
|
||||
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;
|
||||
expect(response['id'], 0);
|
||||
expect(response['result'], isList);
|
||||
|
@ -14,14 +14,14 @@ void main() {
|
||||
group('devices', () {
|
||||
testUsingContext('returns 0 when called', () {
|
||||
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));
|
||||
});
|
||||
});
|
||||
|
||||
testUsingContext('no error when no connected devices', () {
|
||||
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(testLogger.statusText, contains('No connected devices'));
|
||||
});
|
||||
|
@ -60,7 +60,7 @@ void main() {
|
||||
|
||||
testUsingContext('returns 1 when test file is not found', () {
|
||||
withMockDevice();
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=/some/app/test/e2e.dart',
|
||||
];
|
||||
@ -84,7 +84,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@ -102,7 +102,7 @@ void main() {
|
||||
useInMemoryFileSystem(cwd: packageDir);
|
||||
|
||||
String appFile = '/not/in/my/app.dart';
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$appFile',
|
||||
];
|
||||
@ -120,7 +120,7 @@ void main() {
|
||||
useInMemoryFileSystem(cwd: packageDir);
|
||||
|
||||
String appFile = '/my/app/main.dart';
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$appFile',
|
||||
];
|
||||
@ -144,7 +144,7 @@ void main() {
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
testRunner = expectAsync((List<String> testArgs) {
|
||||
expect(testArgs, [testFile]);
|
||||
expect(testArgs, <String>[testFile]);
|
||||
return new Future<int>.value(0);
|
||||
});
|
||||
appStopper = expectAsync((_) {
|
||||
@ -155,7 +155,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@ -186,7 +186,7 @@ void main() {
|
||||
await memFs.file(testApp).writeAsString('main() {}');
|
||||
await memFs.file(testFile).writeAsString('main() {}');
|
||||
|
||||
List<String> args = [
|
||||
List<String> args = <String>[
|
||||
'drive',
|
||||
'--target=$testApp',
|
||||
];
|
||||
@ -243,7 +243,7 @@ void main() {
|
||||
Device emulator = new MockDevice();
|
||||
when(emulator.name).thenReturn('new-simulator');
|
||||
when(IOSSimulatorUtils.instance.getAttachedDevices())
|
||||
.thenReturn([emulator]);
|
||||
.thenReturn(<Device>[emulator]);
|
||||
|
||||
Device device = await findTargetDevice();
|
||||
expect(device.name, 'new-simulator');
|
||||
|
@ -21,7 +21,7 @@ void main() {
|
||||
when(device.installApp(any)).thenReturn(true);
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['install']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['install']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
@ -35,7 +35,7 @@ void main() {
|
||||
when(device.installApp(any)).thenReturn(true);
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['install']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['install']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ void main() {
|
||||
testUsingContext('returns 1 when no device is connected', () {
|
||||
ListenCommand command = new ListenCommand(singleRun: true);
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(['listen']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['listen']).then((int code) {
|
||||
expect(code, equals(1));
|
||||
});
|
||||
});
|
||||
|
@ -108,7 +108,7 @@ class MockDoctor extends Doctor {
|
||||
|
||||
class MockSimControl extends Mock implements SimControl {
|
||||
MockSimControl() {
|
||||
when(this.getConnectedDevices()).thenReturn([]);
|
||||
when(this.getConnectedDevices()).thenReturn(<SimDevice>[]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@ void main() {
|
||||
MockAndroidDevice device = new MockAndroidDevice();
|
||||
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
|
||||
testDeviceManager.addDevice(device);
|
||||
return createTestCommandRunner(command).run(['stop']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
@ -32,7 +32,7 @@ void main() {
|
||||
when(device.stopApp(any)).thenReturn(new Future<bool>.value(true));
|
||||
testDeviceManager.addDevice(device);
|
||||
|
||||
return createTestCommandRunner(command).run(['stop']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['stop']).then((int code) {
|
||||
expect(code, equals(0));
|
||||
});
|
||||
});
|
||||
|
@ -14,7 +14,7 @@ void main() {
|
||||
testUsingContext('returns 1 when no Android device is connected', () {
|
||||
TraceCommand command = new TraceCommand();
|
||||
applyMocksToCommand(command);
|
||||
return createTestCommandRunner(command).run(['trace']).then((int code) {
|
||||
return createTestCommandRunner(command).run(<String>['trace']).then((int code) {
|
||||
expect(code, equals(1));
|
||||
});
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ Process daemon;
|
||||
// devices: list devices
|
||||
|
||||
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}');
|
||||
|
||||
daemon.stdout
|
||||
@ -28,15 +28,15 @@ Future<Null> main() async {
|
||||
stdout.write('> ');
|
||||
stdin.transform(UTF8.decoder).transform(const LineSplitter()).listen((String line) {
|
||||
if (line == 'version' || line == 'v') {
|
||||
_send({'method': 'daemon.version'});
|
||||
_send(<String, dynamic>{'method': 'daemon.version'});
|
||||
} else if (line == 'shutdown' || line == 'q') {
|
||||
_send({'method': 'daemon.shutdown'});
|
||||
_send(<String, dynamic>{'method': 'daemon.shutdown'});
|
||||
} else if (line == 'start') {
|
||||
_send({'method': 'app.start'});
|
||||
_send(<String, dynamic>{'method': 'app.start'});
|
||||
} else if (line == 'stopAll') {
|
||||
_send({'method': 'app.stopAll'});
|
||||
_send(<String, dynamic>{'method': 'app.stopAll'});
|
||||
} else if (line == 'devices') {
|
||||
_send({'method': 'device.getDevices'});
|
||||
_send(<String, dynamic>{'method': 'device.getDevices'});
|
||||
} else {
|
||||
print('command not understood: $line');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user