Nurhan Turgut deef2663ac
Run integration tests on ci (#17598)
* changing felt script to fetch flutter

* changing the clone_flutter.sh code

* running integration tests with felt on cirrus. fetch framework in CI (not in local).

* only run cirrus tests on chrome. fix a comma in the flutter command path

* adding comments to public flags

* use local engine parameter for flutter pub get

* change flutter executable used for flutter drive command

* fix a cleanup issue. address comments. add toolException. enable web in flutter

* address reviwer comments. fix issue with local-engine

* address reviwer comments. fix issue with local-engine

* using engine/flutter/.dart_tools as clone directory. enabling clone script for local usage

* clean flutter repo with felt clean. add a flag to skip cloning the repo. always clone the repo even for local development, unless this flag is set

* fixing typos. updating readme for the new flag.

* fix directory error

* addressing reviewer comments
2020-04-13 09:54:54 -07:00

79 lines
2.0 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// @dart = 2.6
import 'dart:io' as io;
import 'package:args/command_runner.dart';
import 'build.dart';
import 'clean.dart';
import 'licenses.dart';
import 'exceptions.dart';
import 'test_runner.dart';
import 'utils.dart';
CommandRunner runner = CommandRunner<bool>(
'felt',
'Command-line utility for building and testing Flutter web engine.',
)
..addCommand(CleanCommand())
..addCommand(LicensesCommand())
..addCommand(TestCommand())
..addCommand(BuildCommand());
void main(List<String> args) async {
if (args.isEmpty) {
// The felt tool was invoked with no arguments. Print usage.
runner.printUsage();
io.exit(64); // Exit code 64 indicates a usage error.
}
_listenToShutdownSignals();
int exitCode = -1;
try {
final bool result = (await runner.run(args)) as bool;
if (result == false) {
print('Sub-command returned false: `${args.join(' ')}`');
exitCode = 1;
}
} on UsageException catch (e) {
print(e);
exitCode = 64; // Exit code 64 indicates a usage error.
} on ToolException catch (e) {
io.stderr.writeln(e.message);
exitCode = 1;
} catch (e) {
rethrow;
} finally {
await cleanup();
// The exit code is changed by one of the branches.
if(exitCode != -1) {
io.exit(exitCode);
}
}
// Sometimes the Dart VM refuses to quit.
io.exit(io.exitCode);
}
void _listenToShutdownSignals() async {
io.ProcessSignal.sigint.watch().listen((_) async {
print('Received SIGINT. Shutting down.');
await cleanup();
io.exit(1);
});
// SIGTERM signals are not generated under Windows.
// See https://docs.microsoft.com/en-us/previous-versions/xdkz3x12(v%3Dvs.140)
if (!io.Platform.isWindows) {
io.ProcessSignal.sigterm.watch().listen((_) async {
await cleanup();
print('Received SIGTERM. Shutting down.');
io.exit(1);
});
}
}