Sort licenses by body (flutter/engine#36577)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,2 +1,2 @@
|
||||
Signature: eeb0c647625047671a862bb877890a5f
|
||||
Signature: ebfee4cf8fc59213ae6efbc0c13dc6c8
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -54,7 +54,7 @@ abstract class _RepositoryLicensedFile extends _RepositoryFile {
|
||||
static final RegExp _readmeNamePattern = RegExp(r'\b_*(?:readme|contributing|patents)_*\b', caseSensitive: false);
|
||||
static final RegExp _buildTimePattern = RegExp(r'^(?!.*gen$)(?:CMakeLists\.txt|(?:pkgdata)?Makefile(?:\.inc)?(?:\.am|\.in|)|configure(?:\.ac|\.in)?|config\.(?:sub|guess)|.+\.m4|install-sh|.+\.sh|.+\.bat|.+\.pyc?|.+\.pl|icu-configure|.+\.gypi?|.*\.gni?|.+\.mk|.+\.cmake|.+\.gradle|.+\.yaml|pubspec\.lock|\.packages|vms_make\.com|pom\.xml|\.project|source\.properties|.+\.obj|.+\.autopkg|Brewfile)$', caseSensitive: false);
|
||||
static final RegExp _docsPattern = RegExp(r'^(?:INSTALL|NEWS|OWNERS|AUTHORS|ChangeLog(?:\.rst|\.[0-9]+)?|.+\.txt|.+\.md|.+\.log|.+\.css|.+\.1|doxygen\.config|Doxyfile|.+\.spec(?:\.in)?)$', caseSensitive: false);
|
||||
static final RegExp _devPattern = RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|swift\.swiftformat|\.gitattributes|\.landmines|\.DS_Store|\.travis\.yml|\.cirrus\.yml|\.cache|\.mailmap)$', caseSensitive: false);
|
||||
static final RegExp _devPattern = RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|swift\.swiftformat|\.gitattributes|\.landmines|\.DS_Store|\.travis\.yml|\.cirrus\.yml|\.cache|\.mailmap|CODEOWNERS|TESTOWNERS)$', caseSensitive: false);
|
||||
static final RegExp _testsPattern = RegExp(r'^(?:tj(?:bench|example)test\.(?:java\.)?in|example\.c)$', caseSensitive: false);
|
||||
// The ICU library has sample code that will never get linked.
|
||||
static final RegExp _icuSamplesPattern = RegExp(r'.*(?:icu\/source\/samples).*$', caseSensitive: false);
|
||||
@@ -2854,16 +2854,19 @@ Future<void> _collectLicensesForComponent(_RepositoryDirectory componentRoot, {
|
||||
}
|
||||
|
||||
sink.writeln('UNUSED LICENSES:\n');
|
||||
final List<String> unusedLicenses = licenses
|
||||
final List<License> rawUnusedLicenses = licenses
|
||||
.where((License license) => !license.isUsed)
|
||||
.toList();
|
||||
rawUnusedLicenses.sort((License a, License b) => a.toStringBody().compareTo(b.toStringBody()));
|
||||
final List<String> unusedLicenses = rawUnusedLicenses
|
||||
.map((License license) => license.toString())
|
||||
.toList();
|
||||
unusedLicenses.sort();
|
||||
sink.writeln(unusedLicenses.join('\n\n'));
|
||||
sink.writeln('~' * 80);
|
||||
|
||||
sink.writeln('USED LICENSES:\n');
|
||||
final List<License> usedLicenses = licenses.where((License license) => license.isUsed).toList();
|
||||
usedLicenses.sort((License a, License b) => a.toStringBody().compareTo(b.toStringBody()));
|
||||
final List<String> output = usedLicenses.map((License license) => license.toString()).toList();
|
||||
for (int index = 0; index < output.length; index += 1) {
|
||||
// The strings we look for here are strings which we do not expect to see in
|
||||
@@ -2907,8 +2910,6 @@ Future<void> _collectLicensesForComponent(_RepositoryDirectory componentRoot, {
|
||||
throw 'Unexpected indecisiveness found in: ${usedLicenses[index].origin}';
|
||||
}
|
||||
}
|
||||
|
||||
output.sort();
|
||||
sink.writeln(output.join('\n\n'));
|
||||
sink.writeln('Total license count: ${licenses.length}');
|
||||
|
||||
@@ -2968,12 +2969,14 @@ Future<void> main(List<String> arguments) async {
|
||||
}
|
||||
progress.label = 'Dumping results...';
|
||||
progress.flush();
|
||||
final List<String?> output = licenses
|
||||
final List<License> sortedLicenses = licenses
|
||||
.where((License license) => license.isUsed)
|
||||
.toList();
|
||||
sortedLicenses.sort((License a, License b) => a.toStringBody().compareTo(b.toStringBody()));
|
||||
final List<String?> output = sortedLicenses
|
||||
.map((License license) => license.toStringFormal())
|
||||
.whereNotNull()
|
||||
.toList();
|
||||
output.sort();
|
||||
print(output.join('\n${"-" * 80}\n'));
|
||||
progress.label = 'Done.';
|
||||
progress.flush();
|
||||
|
||||
Reference in New Issue
Block a user