Update license script to run with newer Dart versions (flutter/engine#5748)

This commit is contained in:
Michael Goderbauer
2018-07-13 17:33:03 -07:00
committed by GitHub
parent b07e9faa35
commit fa82075a5e
3 changed files with 21 additions and 13 deletions

View File

@@ -114,7 +114,7 @@ abstract class License implements Comparable<License> {
if (result is! UniqueLicense || result.type != type)
throw 'tried to add a UniqueLicense $type, but it was a duplicate of a ${result.runtimeType} ${result.type}';
return true;
});
}());
return result;
}
@@ -126,7 +126,7 @@ abstract class License implements Comparable<License> {
if (result is! TemplateLicense || result.type != type)
throw 'tried to add a TemplateLicense $type, but it was a duplicate of a ${result.runtimeType} ${result.type}';
return true;
});
}());
return result;
}
@@ -138,7 +138,7 @@ abstract class License implements Comparable<License> {
if (result is! MessageLicense || result.type != type)
throw 'tried to add a MessageLicense $type, but it was a duplicate of a ${result.runtimeType} ${result.type}';
return true;
});
}());
return result;
}
@@ -148,7 +148,7 @@ abstract class License implements Comparable<License> {
if (result is! BlankLicense || result.type != type)
throw 'tried to add a BlankLicense $type, but it was a duplicate of a ${result.runtimeType} ${result.type}';
return true;
});
}());
return result;
}
@@ -310,7 +310,7 @@ abstract class License implements Comparable<License> {
throw 'incorrectly created a $runtimeType for a $type';
}
return true;
});
}());
final LicenseType detectedType = convertBodyToType(body);
if (detectedType != LicenseType.unknown && detectedType != type && !yesWeKnowWhatItLooksLikeButItIsNot)
throw 'Created a license of type $type but it looks like $detectedType\.';
@@ -789,7 +789,7 @@ Iterable<_LicenseMatch> _tryReferenceByType(String body, RegExp pattern, License
String copyrights = _reformat(match.getCopyrights());
assert(needsCopyright && copyrights.isNotEmpty || !needsCopyright && copyrights.isEmpty);
return true;
});
}());
if (needsCopyright)
yield* _expand(template, match.getCopyrights(), match.getEntireLicense(), match.start, match.end, debug: '_tryReferenceByType', origin: origin);
else

View File

@@ -956,7 +956,7 @@ class RepositoryDirectory extends RepositoryEntry implements LicenseSource {
}
}
int get count => _files.length + _subdirectories.fold(0, (int count, RepositoryDirectory child) => count + child.count);
int get count => _files.length + _subdirectories.fold<int>(0, (int count, RepositoryDirectory child) => count + child.count);
@override
List<License> nearestLicensesFor(String name) {

View File

@@ -1,53 +1,61 @@
# Generated by pub
# See http://pub.dartlang.org/doc/glossary.html#lockfile
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
archive:
dependency: "direct main"
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.33"
args:
dependency: "direct main"
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "0.13.7"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.5"
version: "1.14.10"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
crypto:
dependency: "direct main"
description:
name: crypto
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2+1"
version: "2.0.6"
path:
dependency: "direct main"
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.1"
version: "1.6.1"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.5"
sdks:
dart: ">=1.21.0 <2.0.0"
dart: ">=2.0.0-dev.62.0 <=2.0.0-dev.67.0.flutter-84ca27a09e"