Unverified Commit b2c98f9a authored by Yegor's avatar Yegor Committed by GitHub

Roll engine to e976be13c51448f89107d082ec81e2b6731671fa (#17266)

* Roll engine to e976be13c51448f89107d082ec81e2b6731671fa

* move away from deprecated constants
parent c9954f10
ae0d3a553688bcc11fd367faf5675159585990a5
e976be13c51448f89107d082ec81e2b6731671fa
......@@ -11,7 +11,7 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
test('test smoke test -- this test should fail', () async {
if (system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV)) {
if (system.Process.killPid(system.pid, system.ProcessSignal.sigsegv)) {
print('system.Process.killPid returned before the process ended!');
print('Sleeping for a few seconds just in case signal delivery is delayed or our signal handler is being slow...');
system.sleep(const Duration(seconds: 10)); // don't sleep too much, we must not time out
......
......@@ -8,5 +8,5 @@ import 'dart:io' as system;
// see //flutter/dev/bots/test.dart
void main() {
system.Process.killPid(system.pid, system.ProcessSignal.SIGSEGV);
system.Process.killPid(system.pid, system.ProcessSignal.sigsegv);
}
\ No newline at end of file
......@@ -131,7 +131,7 @@ class FlutterProject {
final File buildScript = new File(
path.join(androidPath, 'app', 'build.gradle'),
);
buildScript.openWrite(mode: FileMode.APPEND).write('''
buildScript.openWrite(mode: FileMode.append).write('''
android {
buildTypes {
......@@ -147,7 +147,7 @@ android {
final File buildScript = new File(
path.join(androidPath, 'app', 'build.gradle'),
);
buildScript.openWrite(mode: FileMode.APPEND).write('''
buildScript.openWrite(mode: FileMode.append).write('''
android {
flavorDimensions "mode"
......
......@@ -52,7 +52,7 @@ Future<Null> _patchXcconfigFilesIfNotPatched(String flutterProjectPath) async {
final String contents = await file.readAsString();
final bool alreadyPatched = contents.contains(include);
if (!alreadyPatched) {
final IOSink patchOut = file.openWrite(mode: FileMode.APPEND);
final IOSink patchOut = file.openWrite(mode: FileMode.append);
patchOut.writeln(); // in case EOF is not preceded by line break
patchOut.writeln(include);
await patchOut.close();
......
......@@ -67,14 +67,14 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent: false }) as
await runner.exitCode.timeout(const Duration(seconds: 1));
return taskResult;
} on TimeoutException catch (timeout) {
runner.kill(ProcessSignal.SIGINT);
runner.kill(ProcessSignal.sigint);
return <String, dynamic>{
'success': false,
'reason': 'Timeout waiting for $waitingFor: ${timeout.message}',
};
} finally {
if (!runnerFinished)
runner.kill(ProcessSignal.SIGKILL);
runner.kill(ProcessSignal.sigkill);
await stdoutSub.cancel();
await stderrSub.cancel();
}
......
......@@ -460,7 +460,7 @@ Future<int> findAvailablePort() async {
while (true) {
try {
final ServerSocket socket =
await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, port);
await ServerSocket.bind(InternetAddress.loopbackIPv4, port);
await socket.close();
return port;
} catch (_) {
......
......@@ -126,7 +126,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
if (line.contains(jsonEnd)) {
jsonStarted = false;
processWasKilledIntentionally = true;
process.kill(ProcessSignal.SIGINT); // flutter run doesn't quit automatically
process.kill(ProcessSignal.sigint); // flutter run doesn't quit automatically
final String jsonOutput = jsonBuf.toString();
try {
completer.complete(json.decode(jsonOutput));
......
......@@ -373,7 +373,7 @@ class FlutterDriver {
if (_logCommunicationToFile) {
final f.File file = fs.file(p.join(testOutputsDirectory, 'flutter_driver_commands_$_driverId.log'));
file.createSync(recursive: true); // no-op if file exists
file.writeAsStringSync('${new DateTime.now()} $message\n', mode: f.FileMode.APPEND, flush: true);
file.writeAsStringSync('${new DateTime.now()} $message\n', mode: f.FileMode.append, flush: true);
}
}
......
......@@ -209,8 +209,8 @@ class GoldensClient {
Future<void> _obtainLock() async {
final File lockFile = flutterRoot.childFile(fs.path.join('bin', 'cache', 'goldens.lockfile'));
await lockFile.create(recursive: true);
_lock = await lockFile.open(mode: io.FileMode.WRITE);
await _lock.lock(io.FileLock.BLOCKING_EXCLUSIVE);
_lock = await lockFile.open(mode: io.FileMode.write);
await _lock.lock(io.FileLock.blockingExclusive);
}
Future<void> _releaseLock() async {
......
......@@ -78,7 +78,7 @@ class _ManifestAssetBundle implements AssetBundle {
return true;
final FileStat stat = fs.file(manifestPath).statSync();
if (stat.type == FileSystemEntityType.NOT_FOUND)
if (stat.type == FileSystemEntityType.notFound)
return true;
return stat.modified.isAfter(_lastBuildTimestamp);
......
......@@ -104,15 +104,15 @@ void copyDirectorySync(Directory srcDir, Directory destDir, [void onFileCopied(F
Directory getRecordingSink(String dirname, String basename) {
final String location = _kLocalFs.path.join(dirname, basename);
switch (_kLocalFs.typeSync(location, followLinks: false)) {
case FileSystemEntityType.FILE:
case FileSystemEntityType.LINK:
case FileSystemEntityType.file:
case FileSystemEntityType.link:
throwToolExit('Invalid record-to location: $dirname ("$basename" exists as non-directory)');
break;
case FileSystemEntityType.DIRECTORY:
case FileSystemEntityType.directory:
if (_kLocalFs.directory(location).listSync(followLinks: false).isNotEmpty)
throwToolExit('Invalid record-to location: $dirname ("$basename" is not empty)');
break;
case FileSystemEntityType.NOT_FOUND:
case FileSystemEntityType.notFound:
_kLocalFs.directory(location).createSync(recursive: true);
}
return _kLocalFs.directory(location);
......
......@@ -41,7 +41,7 @@ export 'dart:io'
exitCode,
// File NO! Use `file_system.dart`
// FileSystemEntity NO! Use `file_system.dart`
GZIP,
gzip,
HandshakeException,
HttpClient,
HttpClientRequest,
......@@ -71,7 +71,7 @@ export 'dart:io'
// stdout, NO! Use `io.dart`
Socket,
SocketException,
SYSTEM_ENCODING,
systemEncoding,
WebSocket,
WebSocketException,
WebSocketTransformer;
......@@ -116,11 +116,12 @@ class ProcessSignal implements io.ProcessSignal {
@visibleForTesting
const ProcessSignal(this._delegate);
static const ProcessSignal SIGWINCH = const _PosixProcessSignal._(io.ProcessSignal.SIGWINCH);
static const ProcessSignal SIGTERM = const _PosixProcessSignal._(io.ProcessSignal.SIGTERM);
static const ProcessSignal SIGUSR1 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR1);
static const ProcessSignal SIGUSR2 = const _PosixProcessSignal._(io.ProcessSignal.SIGUSR2);
static const ProcessSignal SIGINT = const ProcessSignal(io.ProcessSignal.SIGINT);
// TODO(yjbanov): make these names consistent with dart:io ones
static const ProcessSignal SIGWINCH = const _PosixProcessSignal._(io.ProcessSignal.sigwinch);
static const ProcessSignal SIGTERM = const _PosixProcessSignal._(io.ProcessSignal.sigterm);
static const ProcessSignal SIGUSR1 = const _PosixProcessSignal._(io.ProcessSignal.sigusr1);
static const ProcessSignal SIGUSR2 = const _PosixProcessSignal._(io.ProcessSignal.sigusr2);
static const ProcessSignal SIGINT = const ProcessSignal(io.ProcessSignal.sigint);
final io.ProcessSignal _delegate;
......
......@@ -46,7 +46,7 @@ class HostPortScanner extends PortScanner {
Future<bool> isPortAvailable(int port) async {
try {
// TODO(ianh): This is super racy.
final ServerSocket socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, port);
final ServerSocket socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, port);
await socket.close();
return true;
} catch (error) {
......@@ -58,9 +58,9 @@ class HostPortScanner extends PortScanner {
Future<int> findAvailablePort() async {
ServerSocket socket;
try {
socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0);
socket = await ServerSocket.bind(InternetAddress.loopbackIPv4, 0);
} on SocketException {
socket = await ServerSocket.bind(InternetAddress.LOOPBACK_IP_V6, 0, v6Only: true);
socket = await ServerSocket.bind(InternetAddress.loopbackIPv6, 0, v6Only: true);
}
final int port = socket.port;
await socket.close();
......
......@@ -213,7 +213,7 @@ Future<Process> runDetached(List<String> cmd) {
_traceCommand(cmd);
final Future<Process> proc = processManager.start(
cmd,
mode: ProcessStartMode.DETACHED,
mode: ProcessStartMode.detached,
);
return proc;
}
......
......@@ -74,7 +74,7 @@ class Cache {
if (!_lockEnabled)
return null;
assert(_lock == null);
_lock = await fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')).open(mode: FileMode.WRITE);
_lock = await fs.file(fs.path.join(flutterRoot, 'bin', 'cache', 'lockfile')).open(mode: FileMode.write);
bool locked = false;
bool printed = false;
while (!locked) {
......
......@@ -26,7 +26,7 @@ abstract class AnalyzeBase {
void dumpErrors(Iterable<String> errors) {
if (argResults['write'] != null) {
try {
final RandomAccessFile resultsFile = fs.file(argResults['write']).openSync(mode: FileMode.WRITE);
final RandomAccessFile resultsFile = fs.file(argResults['write']).openSync(mode: FileMode.write);
try {
resultsFile.lockSync();
resultsFile.writeStringSync(errors.join('\n'));
......
......@@ -408,12 +408,12 @@ String _validateProjectDir(String dirPath, { String flutterRoot }) {
final FileSystemEntityType type = fs.typeSync(dirPath);
if (type != FileSystemEntityType.NOT_FOUND) {
if (type != FileSystemEntityType.notFound) {
switch (type) {
case FileSystemEntityType.FILE:
case FileSystemEntityType.file:
// Do not overwrite files.
return "Invalid project name: '$dirPath' - file exists.";
case FileSystemEntityType.LINK:
case FileSystemEntityType.link:
// Do not overwrite links.
return "Invalid project name: '$dirPath' - refers to a link.";
}
......
......@@ -94,7 +94,7 @@ class DriveCommand extends RunCommandBase {
if (device == null)
throwToolExit(null);
if (await fs.type(testFile) != FileSystemEntityType.FILE)
if (await fs.type(testFile) != FileSystemEntityType.file)
throwToolExit('Test file not found: $testFile');
String observatoryUri;
......@@ -225,7 +225,7 @@ void restoreAppStarter() {
Future<LaunchResult> _startApp(DriveCommand command) async {
final String mainPath = findMainDartFile(command.targetFile);
if (await fs.type(mainPath) != FileSystemEntityType.FILE) {
if (await fs.type(mainPath) != FileSystemEntityType.file) {
printError('Tried to run $mainPath, but that file does not exist.');
return null;
}
......
......@@ -27,7 +27,7 @@ import '../vmservice.dart';
// $ flutter fuchsia_reload -f ~/fuchsia -a 192.168.1.39 \
// -g //lib/flutter/examples/flutter_gallery:flutter_gallery
final String ipv4Loopback = InternetAddress.LOOPBACK_IP_V4.address;
final String ipv4Loopback = InternetAddress.loopbackIPv4.address;
class FuchsiaReloadCommand extends FlutterCommand {
FuchsiaReloadCommand() {
......
......@@ -261,9 +261,9 @@ class IdeConfigCommand extends FlutterCommand {
String _validateFlutterDir(String dirPath, {String flutterRoot}) {
final FileSystemEntityType type = fs.typeSync(dirPath);
if (type != FileSystemEntityType.NOT_FOUND) {
if (type != FileSystemEntityType.notFound) {
switch (type) {
case FileSystemEntityType.LINK:
case FileSystemEntityType.link:
// Do not overwrite links.
return "Invalid project root dir: '$dirPath' - refers to a link.";
}
......
......@@ -30,7 +30,7 @@ class DependencyChecker {
for (String path in _dependencies) {
final File file = fs.file(path);
final FileStat stat = file.statSync();
if (stat.type == FileSystemEntityType.NOT_FOUND) {
if (stat.type == FileSystemEntityType.notFound) {
printTrace('DependencyChecker: Error stating $path.');
return true;
}
......
......@@ -46,7 +46,7 @@ abstract class DevFSContent {
Stream<List<int>> contentsAsStream();
Stream<List<int>> contentsAsCompressedStream() {
return contentsAsStream().transform(GZIP.encoder);
return contentsAsStream().transform(gzip.encoder);
}
/// Return the list of files this content depends on.
......@@ -86,7 +86,7 @@ class DevFSFileContent extends DevFSContent {
return;
}
_fileStat = file.statSync();
if (_fileStat.type == FileSystemEntityType.LINK) {
if (_fileStat.type == FileSystemEntityType.link) {
// Resolve, stat, and maybe cache the symlink target.
final String resolved = file.resolveSymbolicLinksSync();
final FileSystemEntity linkTarget = fs.file(resolved);
......@@ -661,7 +661,7 @@ class DevFS {
try {
final FileSystemEntityType linkType =
fs.statSync(file.resolveSymbolicLinksSync()).type;
if (linkType == FileSystemEntityType.DIRECTORY)
if (linkType == FileSystemEntityType.directory)
continue;
} on FileSystemException catch (e) {
_printScanDirectoryError(file.path, e);
......
......@@ -623,7 +623,7 @@ void _copyServiceDefinitionsManifest(List<Map<String, String>> services, File ma
'framework': fs.path.basenameWithoutExtension(service['ios-framework'])
}).toList();
final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services' : jsonServices };
manifest.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true);
manifest.writeAsStringSync(json.encode(jsonObject), mode: FileMode.write, flush: true);
}
Future<bool> upgradePbxProjWithFlutterAssets(String app) async {
......
......@@ -454,7 +454,7 @@ class IOSSimulator extends Device {
void clearLogs() {
final File logFile = fs.file(logFilePath);
if (logFile.existsSync()) {
final RandomAccessFile randomFile = logFile.openSync(mode: FileMode.WRITE);
final RandomAccessFile randomFile = logFile.openSync(mode: FileMode.write);
randomFile.truncateSync(0);
randomFile.closeSync();
}
......
......@@ -97,7 +97,7 @@ class ProtocolDiscovery {
assert(new InternetAddress(hostUri.host).isLoopback);
if (ipv6) {
hostUri = hostUri.replace(host: InternetAddress.LOOPBACK_IP_V6.host);
hostUri = hostUri.replace(host: InternetAddress.loopbackIPv6.host);
}
return hostUri;
......
......@@ -808,7 +808,7 @@ abstract class ResidentRunner {
if (path == null)
return true;
final FileStat stat = fs.file(path).statSync();
if (stat.type != FileSystemEntityType.FILE)
if (stat.type != FileSystemEntityType.file)
return true;
if (!fs.file(path).existsSync())
return true;
......
......@@ -105,6 +105,6 @@ File generateServiceDefinitions(
final Map<String, dynamic> jsonObject = <String, dynamic>{ 'services': services };
final File servicesFile = fs.file(fs.path.join(dir, 'services.json'));
servicesFile.writeAsStringSync(json.encode(jsonObject), mode: FileMode.WRITE, flush: true);
servicesFile.writeAsStringSync(json.encode(jsonObject), mode: FileMode.write, flush: true);
return servicesFile;
}
......@@ -52,8 +52,8 @@ const String _kProjectRootSentinel = 'pubspec.yaml';
/// The address at which our WebSocket server resides and at which the sky_shell
/// processes will host the Observatory server.
final Map<InternetAddressType, InternetAddress> _kHosts = <InternetAddressType, InternetAddress>{
InternetAddressType.IP_V4: InternetAddress.LOOPBACK_IP_V4,
InternetAddressType.IP_V6: InternetAddress.LOOPBACK_IP_V6,
InternetAddressType.IPv4: InternetAddress.loopbackIPv4,
InternetAddressType.IPv6: InternetAddress.loopbackIPv6,
};
/// Configure the `test` package to work with Flutter.
......@@ -73,7 +73,7 @@ void installHook({
bool trackWidgetCreation: false,
bool updateGoldens: false,
int observatoryPort,
InternetAddressType serverType: InternetAddressType.IP_V4,
InternetAddressType serverType: InternetAddressType.IPv4,
}) {
assert(!enableObservatory || (!startPaused && observatoryPort == null));
hack.registerPlatformPlugin(
......@@ -622,7 +622,7 @@ class _FlutterPlatform extends PlatformPlugin {
}
String _getWebSocketUrl() {
return host.type == InternetAddressType.IP_V4
return host.type == InternetAddressType.IPv4
? 'ws://${host.address}'
: 'ws://[${host.address}]';
}
......@@ -766,7 +766,7 @@ void main() {
} else {
command.add('--disable-observatory');
}
if (host.type == InternetAddressType.IP_V6)
if (host.type == InternetAddressType.IPv6)
command.add('--ipv6');
if (bundlePath != null) {
command.add('--flutter-assets-dir=$bundlePath');
......@@ -838,13 +838,13 @@ void main() {
return 'Shell subprocess cleanly reported an error $when. Check the logs above for an error message.';
case 0:
return 'Shell subprocess ended cleanly $when. Did main() call exit()?';
case -0x0f: // ProcessSignal.SIGTERM
case -0x0f: // ProcessSignal.sigterm
return 'Shell subprocess crashed with SIGTERM ($exitCode) $when.';
case -0x0b: // ProcessSignal.SIGSEGV
case -0x0b: // ProcessSignal.sigsegv
return 'Shell subprocess crashed with segmentation fault $when.';
case -0x06: // ProcessSignal.SIGABRT
case -0x06: // ProcessSignal.sigabrt
return 'Shell subprocess crashed with SIGABRT ($exitCode) $when.';
case -0x02: // ProcessSignal.SIGINT
case -0x02: // ProcessSignal.sigint
return 'Shell subprocess terminated by ^C (SIGINT, $exitCode) $when.';
default:
return 'Shell subprocess crashed with unexpected exit code $exitCode $when.';
......
......@@ -77,7 +77,7 @@ Future<int> runTests(
throwToolExit('Cannot find Flutter shell at $shellPath');
final InternetAddressType serverType =
ipv6 ? InternetAddressType.IP_V6 : InternetAddressType.IP_V4;
ipv6 ? InternetAddressType.IPv6 : InternetAddressType.IPv4;
loader.installHook(
shellPath: shellPath,
......
......@@ -26,7 +26,7 @@ void main() {
});
testUsingContext('toString() works', () async {
expect(io.ProcessSignal.SIGINT.toString(), ProcessSignal.SIGINT.toString());
expect(io.ProcessSignal.sigint.toString(), ProcessSignal.SIGINT.toString());
});
});
}
......
......@@ -124,7 +124,7 @@ class MockFileSystem extends ForwardingFileSystem {
class MockFile extends Mock implements File {
@override
Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) async {
Future<RandomAccessFile> open({FileMode mode: FileMode.read}) async {
return new MockRandomAccessFile();
}
}
......
......@@ -508,7 +508,7 @@ class LoggingProcessManager extends LocalProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
ProcessStartMode mode: ProcessStartMode.NORMAL,
ProcessStartMode mode: ProcessStartMode.normal,
}) {
commands.add(command);
return super.start(
......
......@@ -48,8 +48,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
Encoding stdoutEncoding: SYSTEM_ENCODING,
Encoding stderrEncoding: SYSTEM_ENCODING,
Encoding stdoutEncoding: systemEncoding,
Encoding stderrEncoding: systemEncoding,
}) async {
return new ProcessResult(0, 0, '', '');
}
......@@ -61,8 +61,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
Encoding stdoutEncoding: SYSTEM_ENCODING,
Encoding stderrEncoding: SYSTEM_ENCODING,
Encoding stdoutEncoding: systemEncoding,
Encoding stderrEncoding: systemEncoding,
}) {
return new ProcessResult(0, 0, '', '');
}
......
......@@ -38,8 +38,8 @@ class MockProcessManager extends Mock implements ProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
Encoding stdoutEncoding: SYSTEM_ENCODING,
Encoding stderrEncoding: SYSTEM_ENCODING,
Encoding stdoutEncoding: systemEncoding,
Encoding stderrEncoding: systemEncoding,
}) async {
return new ProcessResult(0, 0, '1234\n5678\n5', '');
}
......
......@@ -164,7 +164,7 @@ class MockProcessManager implements ProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
ProcessStartMode mode: ProcessStartMode.NORMAL,
ProcessStartMode mode: ProcessStartMode.normal,
}) {
lastPubEnvironment = environment['PUB_ENVIRONMENT'];
lastPubCache = environment['PUB_CACHE'];
......@@ -237,7 +237,7 @@ class MockFileSystem extends ForwardingFileSystem {
class MockFile implements File {
@override
Future<RandomAccessFile> open({FileMode mode: FileMode.READ}) async {
Future<RandomAccessFile> open({FileMode mode: FileMode.read}) async {
return new MockRandomAccessFile();
}
......
......@@ -388,11 +388,11 @@ class MockVMService extends BasicMock implements VMService {
Future<Null> setUp() async {
try {
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V6, 0);
_server = await HttpServer.bind(InternetAddress.loopbackIPv6, 0);
_httpAddress = Uri.parse('http://[::1]:${_server.port}');
} on SocketException {
// Fall back to IPv4 if the host doesn't support binding to IPv6 localhost
_server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 0);
_server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
_httpAddress = Uri.parse('http://127.0.0.1:${_server.port}');
}
_server.listen((HttpRequest request) {
......
......@@ -122,7 +122,7 @@ class MockProcessManager implements ProcessManager {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
ProcessStartMode mode: ProcessStartMode.NORMAL,
ProcessStartMode mode: ProcessStartMode.normal,
}) {
if (!succeed) {
final String executable = command[0];
......
......@@ -13,9 +13,9 @@ import 'common/network.dart';
import 'dart/dart_vm.dart';
import 'runners/ssh_command_runner.dart';
final String _ipv4Loopback = InternetAddress.LOOPBACK_IP_V4.address;
final String _ipv4Loopback = InternetAddress.loopbackIPv4.address;
final String _ipv6Loopback = InternetAddress.LOOPBACK_IP_V6.address;
final String _ipv6Loopback = InternetAddress.loopbackIPv6.address;
const ProcessManager _processManager = const LocalProcessManager();
......
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