blob: 30c54d11c2e012855344c8b32cf8cab0dfdb0c75 [file] [log] [blame]
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:io';
import "explicit_creation_impl.dart" show runExplicitCreationTest;
import 'testing_utils.dart' show getGitFiles;
import "utils/io_utils.dart" show computeRepoDirUri;
Future<void> main(List<String> args) async {
final Uri repoDir = computeRepoDirUri();
Set<Uri> libUris = {};
if (args.isEmpty) {
libUris.add(repoDir.resolve("pkg/front_end/lib/"));
libUris.add(repoDir.resolve("pkg/_fe_analyzer_shared/lib/"));
libUris.add(repoDir.resolve("pkg/frontend_server/"));
} else {
for (String arg in args) {
if (arg == "--front-end-only") {
libUris.add(repoDir.resolve("pkg/front_end/lib/"));
} else if (arg == "--shared-only") {
libUris.add(repoDir.resolve("pkg/_fe_analyzer_shared/lib/"));
} else if (arg == "--frontend_server-only") {
libUris.add(repoDir.resolve("pkg/frontend_server/"));
} else {
throw "Unsupported arguments: $args";
}
}
}
Set<Uri> inputs = {};
for (Uri uri in libUris) {
Set<Uri> gitFiles = await getGitFiles(uri);
List<FileSystemEntity> entities =
new Directory.fromUri(uri).listSync(recursive: true);
for (FileSystemEntity entity in entities) {
if (entity is File &&
entity.path.endsWith(".dart") &&
gitFiles.contains(entity.uri)) {
inputs.add(entity.uri);
}
}
}
int explicitCreationErrorsFound = await runExplicitCreationTest(
includedFiles: inputs, includedDirectoryUris: libUris, repoDir: repoDir);
if (explicitCreationErrorsFound > 0) {
exitCode = 1;
}
}