small clean-up of the license script (flutter/engine#26659)

* small clean-up of the license script
This commit is contained in:
Yegor
2021-06-09 16:22:35 -07:00
committed by GitHub
parent 352b80ad80
commit 3d93c2d50f
4 changed files with 31 additions and 20 deletions

View File

@@ -130,8 +130,6 @@ FILE: ../../../flutter/flow/surface_frame.h
FILE: ../../../flutter/flow/texture_unittests.cc
FILE: ../../../flutter/flow/view_holder.cc
FILE: ../../../flutter/flow/view_holder.h
FILE: ../../../flutter/flutter_frontend_server/bin/starter.dart
FILE: ../../../flutter/flutter_frontend_server/lib/server.dart
FILE: ../../../flutter/fml/ascii_trie.cc
FILE: ../../../flutter/fml/ascii_trie.h
FILE: ../../../flutter/fml/ascii_trie_unittests.cc
@@ -1776,11 +1774,6 @@ FILE: ../../../flutter/vulkan/vulkan_utilities.cc
FILE: ../../../flutter/vulkan/vulkan_utilities.h
FILE: ../../../flutter/vulkan/vulkan_window.cc
FILE: ../../../flutter/vulkan/vulkan_window.h
FILE: ../../../flutter/web_sdk/libraries.json
FILE: ../../../flutter/web_sdk/sdk_rewriter.dart
FILE: ../../../flutter/web_sdk/web_test_utils/lib/environment.dart
FILE: ../../../flutter/web_sdk/web_test_utils/lib/goldens.dart
FILE: ../../../flutter/web_sdk/web_test_utils/lib/image_compare.dart
----------------------------------------------------------------------------------------------------
Copyright 2013 The Flutter Authors. All rights reserved.

View File

@@ -1,2 +1,2 @@
Signature: 0cdf6cc7db53edb79b6010ee16d5ec19
Signature: f816a2124a3bfcf0c831a0e3713cb6ee

View File

@@ -69,7 +69,7 @@ class LicensesCommand extends Command<bool> {
);
_expect(
head[2] == '// found in the LICENSE file.',
'Invalid second line of license header in file ${file.path}',
'Invalid third line of license header in file ${file.path}',
);
}

View File

@@ -914,7 +914,15 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource {
// direct child of this directory's filesystem node.
List<_RepositoryDirectory> get virtualSubdirectories => <_RepositoryDirectory>[];
// TODO(nurhan): soon add e2etests here.
/// Standard directory names containing files that should be ignored by the
/// license script.
///
/// Do not include repository-level directories here. Instead use one of:
///
/// - [_RepositoryFlutterDirectory], to filter specific sub-directories at the
/// flutter/engine repository level.
/// - [_EngineSrcDirectory], to filter specific sub-directories under the src/
/// directory (a.k.a. buildroot).
bool shouldRecurse(fs.IoNode entry) {
return !entry.fullName.endsWith('third_party/gn') &&
entry.name != '.cipd' &&
@@ -929,9 +937,6 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource {
entry.name != 'tests' &&
entry.name != 'javatests' &&
entry.name != 'testing' &&
// The directory that contains end to end tests.
// Should be excluded from the licence checks.
entry.name != 'e2etests' &&
entry.name != '.dart_tool'; // Generated by various Dart tools, such as pub and
// build_runner. Skip it because it does not contain
// source code.
@@ -2111,7 +2116,13 @@ class _RepositoryFlutterDirectory extends _RepositoryDirectory {
&& entry.name != 'examples'
&& entry.name != 'build'
&& entry.name != 'ci'
&& entry.name != 'frontend_server'
&& entry.name != 'flutter_frontend_server'
// The directory that contains end to end tests.
// Should be excluded from the licence checks.
&& entry.name != 'e2etests'
// None of the web_sdk code is linked into Flutter apps. It's only used
// by engine tests and tools.
&& entry.name != 'web_sdk'
&& super.shouldRecurse(entry);
}
@@ -2300,8 +2311,16 @@ class _RepositoryFlutterLicenseToolDirectory extends _RepositoryDirectory {
}
}
class _RepositoryRoot extends _RepositoryDirectory {
_RepositoryRoot(fs.Directory io) : super(null, io);
/// The `src/` directory created by gclient sync (a.k.a. buildroot).
///
/// This directory is the parent of the flutter/engine repository. The license
/// crawler begins its search starting from this directory and recurses down
/// from it.
///
/// This is not the root of the flutter/engine repository.
/// [_RepositoryFlutterDirectory] represents that.
class _EngineSrcDirectory extends _RepositoryDirectory {
_EngineSrcDirectory(fs.Directory io) : super(null, io);
@override
String get libraryName {
@@ -2317,8 +2336,7 @@ class _RepositoryRoot extends _RepositoryDirectory {
@override
bool shouldRecurse(fs.IoNode entry) {
return entry.name != 'testing' // only used by tests
&& entry.name != 'build' // only used by build
return entry.name != 'build' // only used by build
&& entry.name != 'buildtools' // only used by build
&& entry.name != 'build_overrides' // only used by build
&& entry.name != 'ios_tools' // only used by build
@@ -2575,7 +2593,7 @@ Future<void> main(List<String> arguments) async {
try {
system.stderr.writeln('Finding files...');
final fs.FileSystemDirectory rootDirectory = fs.FileSystemDirectory.fromPath(argResults['src']);
final _RepositoryDirectory root = _RepositoryRoot(rootDirectory);
final _RepositoryDirectory root = _EngineSrcDirectory(rootDirectory);
if (releaseMode) {
system.stderr.writeln('Collecting licenses...');
@@ -2623,7 +2641,7 @@ Future<void> main(List<String> arguments) async {
// For other components, we need a clean repository that does not
// contain any state left over from previous components.
clearLicenseRegistry();
componentRoot = _RepositoryRoot(rootDirectory).subdirectories
componentRoot = _EngineSrcDirectory(rootDirectory).subdirectories
.firstWhere((_RepositoryDirectory dir) => dir.name == component.name);
}