Track files that do not need to be migrated in the NNBD progress script.

Change-Id: I77014aad502ae6e44a9d0c20c288efb822bd1068
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/128984
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
Robert Nystrom 2019-12-20 21:25:35 +00:00 committed by commit-bot@chromium.org
parent 5eb585cfaf
commit fd501c74a5
3 changed files with 14 additions and 9 deletions

View file

@ -3,7 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
// Dart test for testing regular expressions in Dart.
// Note: This test deliberately has no NNBD version in corelib/.
// [NNBD non-migrated] Note: This test is specific to legacy mode and
// deliberately does not have a counter-part in corelib/.
import "package:expect/expect.dart";

View file

@ -5,8 +5,8 @@
// This test ensures that the modifiers added as part of NNBD are not enabled
// until NNBD is enabled by default. At that time, this test should be removed.
// NNBD note: This test is specific to legacy mode and deliberately does not
// have a counter-part in language/.
// [NNBD non-migrated] Note: This test is specific to legacy mode and
// deliberately does not have a counter-part in language/.
import 'package:expect/expect.dart';

View file

@ -26,6 +26,11 @@ const _nonCoreLibs = [
"standalone_2/io/",
];
/// Some legacy files test behavior that doesn't apply to NNBD at all which
/// means they don't end up in the migrated directory but are done. We put this
/// comment in the *legacy* file to track that it has been migrated.
const _nonMigratedMarker = "[NNBD non-migrated]";
void main(List<String> arguments) {
var totalFiles = 0;
var totalLines = 0;
@ -44,15 +49,14 @@ void main(List<String> arguments) {
}
files++;
var lineCount = readFileLines(legacyPath).length;
lines += lineCount;
var sourceLines = readFileLines(legacyPath);
lines += sourceLines.length;
var nnbdPath = toNnbdPath(legacyPath);
// TODO(rnystrom): Look for a marker comment in legacy files that we know
// are not intended to be migrated and count those as done.
if (fileExists(nnbdPath)) {
if (fileExists(nnbdPath) ||
sourceLines.any((line) => line.contains(_nonMigratedMarker))) {
migratedFiles++;
migratedLines += lineCount;
migratedLines += sourceLines.length;
}
}