From fa82075a5eb58e32c659a3316e4863bb0dbea485 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 13 Jul 2018 17:33:03 -0700 Subject: [PATCH] Update license script to run with newer Dart versions (flutter/engine#5748) --- .../flutter/tools/licenses/lib/licenses.dart | 12 +++++------ .../src/flutter/tools/licenses/lib/main.dart | 2 +- .../src/flutter/tools/licenses/pubspec.lock | 20 +++++++++++++------ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/engine/src/flutter/tools/licenses/lib/licenses.dart b/engine/src/flutter/tools/licenses/lib/licenses.dart index bbcfdb00b2..e38b2dfd56 100644 --- a/engine/src/flutter/tools/licenses/lib/licenses.dart +++ b/engine/src/flutter/tools/licenses/lib/licenses.dart @@ -114,7 +114,7 @@ abstract class License implements Comparable { 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 { 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 { 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 { 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 { 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 diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index a8cf05f2bd..ed88763d1b 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -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(0, (int count, RepositoryDirectory child) => count + child.count); @override List nearestLicensesFor(String name) { diff --git a/engine/src/flutter/tools/licenses/pubspec.lock b/engine/src/flutter/tools/licenses/pubspec.lock index 75d0f144fd..ef590e2492 100644 --- a/engine/src/flutter/tools/licenses/pubspec.lock +++ b/engine/src/flutter/tools/licenses/pubspec.lock @@ -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"