diff --git a/engine/src/flutter/ci/licenses_golden/tool_signature b/engine/src/flutter/ci/licenses_golden/tool_signature index d0448b285a..93778661b9 100644 --- a/engine/src/flutter/ci/licenses_golden/tool_signature +++ b/engine/src/flutter/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: d2c90af3896928c85f00e941ad07ce23 +Signature: 44f83506f783ec3ec678f053b2757fc7 diff --git a/engine/src/flutter/tools/licenses/analysis_options.yaml b/engine/src/flutter/tools/licenses/analysis_options.yaml index ffb8ee486a..e5cfbeb84b 100644 --- a/engine/src/flutter/tools/licenses/analysis_options.yaml +++ b/engine/src/flutter/tools/licenses/analysis_options.yaml @@ -53,4 +53,5 @@ linter: - unawaited_futures - unnecessary_brace_in_string_interps - unnecessary_getters_setters + - unnecessary_new - package_names diff --git a/engine/src/flutter/tools/licenses/lib/cache.dart b/engine/src/flutter/tools/licenses/lib/cache.dart index 5d55559917..159ef1e217 100644 --- a/engine/src/flutter/tools/licenses/lib/cache.dart +++ b/engine/src/flutter/tools/licenses/lib/cache.dart @@ -4,7 +4,7 @@ import 'dart:collection'; -Map _cache = new LinkedHashMap(); +Map _cache = LinkedHashMap(); const int _maxSize = 10; T cache(Key key, T getter()) { diff --git a/engine/src/flutter/tools/licenses/lib/filesystem.dart b/engine/src/flutter/tools/licenses/lib/filesystem.dart index 81f741d97d..396c8d6848 100644 --- a/engine/src/flutter/tools/licenses/lib/filesystem.dart +++ b/engine/src/flutter/tools/licenses/lib/filesystem.dart @@ -313,7 +313,7 @@ mixin UTF8TextFile implements TextFile { @override String readString() { try { - return cache(new UTF8Of(this), () => utf8.decode(readBytes())); + return cache(UTF8Of(this), () => utf8.decode(readBytes())); } on FormatException { print(fullName); rethrow; @@ -324,13 +324,13 @@ mixin UTF8TextFile implements TextFile { mixin Latin1TextFile implements TextFile { @override String readString() { - return cache(new Latin1Of(this), () { + return cache(Latin1Of(this), () { final List bytes = readBytes(); if (bytes.any((int byte) => byte == 0x00)) throw '$fullName contains a U+0000 NULL and is probably not actually encoded as Win1252'; bool isUTF8 = false; try { - cache(new UTF8Of(this), () => utf8.decode(readBytes())); + cache(UTF8Of(this), () => utf8.decode(readBytes())); isUTF8 = true; } on FormatException { } @@ -355,7 +355,7 @@ mixin ZipFile on File implements Directory { @override Iterable get walk { try { - _root ??= ArchiveDirectory.parseArchive(new a.ZipDecoder().decodeBytes(readBytes()), fullName); + _root ??= ArchiveDirectory.parseArchive(a.ZipDecoder().decodeBytes(readBytes()), fullName); return _root.walk; } catch (exception) { print('failed to parse archive:\n$fullName'); @@ -370,7 +370,7 @@ mixin TarFile on File implements Directory { @override Iterable get walk { try { - _root ??= ArchiveDirectory.parseArchive(new a.TarDecoder().decodeBytes(readBytes()), fullName); + _root ??= ArchiveDirectory.parseArchive(a.TarDecoder().decodeBytes(readBytes()), fullName); return _root.walk; } catch (exception) { print('failed to parse archive:\n$fullName'); @@ -386,7 +386,7 @@ mixin GZipFile on File implements Directory { Iterable get walk sync* { try { String innerName = path.basenameWithoutExtension(fullName); - _data ??= InMemoryFile.parse(fullName + '!' + innerName, new a.GZipDecoder().decodeBytes(readBytes())); + _data ??= InMemoryFile.parse(fullName + '!' + innerName, a.GZipDecoder().decodeBytes(readBytes())); if (_data != null) yield _data; } catch (exception) { @@ -403,7 +403,7 @@ mixin BZip2File on File implements Directory { Iterable get walk sync* { try { String innerName = path.basenameWithoutExtension(fullName); - _data ??= InMemoryFile.parse(fullName + '!' + innerName, new a.BZip2Decoder().decodeBytes(readBytes())); + _data ??= InMemoryFile.parse(fullName + '!' + innerName, a.BZip2Decoder().decodeBytes(readBytes())); if (_data != null) yield _data; } catch (exception) { @@ -420,7 +420,7 @@ class FileSystemDirectory extends IoNode implements Directory { FileSystemDirectory(this._directory); factory FileSystemDirectory.fromPath(String name) { - return new FileSystemDirectory(new io.Directory(name)); + return FileSystemDirectory(io.Directory(name)); } final io.Directory _directory; @@ -432,7 +432,7 @@ class FileSystemDirectory extends IoNode implements Directory { String get fullName => _directory.path; List _readBytes(io.File file) { - return cache/*List*/(new BytesOf(file), () => file.readAsBytesSync()); + return cache/*List*/(BytesOf(file), () => file.readAsBytesSync()); } @override @@ -441,21 +441,21 @@ class FileSystemDirectory extends IoNode implements Directory { list.sort((io.FileSystemEntity a, io.FileSystemEntity b) => a.path.compareTo(b.path)); for (io.FileSystemEntity entity in list) { if (entity is io.Directory) { - yield new FileSystemDirectory(entity); + yield FileSystemDirectory(entity); } else if (entity is io.Link) { - yield new FileSystemLink(entity); + yield FileSystemLink(entity); } else { assert(entity is io.File); io.File fileEntity = entity; if (fileEntity.lengthSync() > 0) { switch (identifyFile(fileEntity.path, () => _readBytes(fileEntity))) { - case FileType.binary: yield new FileSystemFile(fileEntity); break; - case FileType.zip: yield new FileSystemZipFile(fileEntity); break; - case FileType.tar: yield new FileSystemTarFile(fileEntity); break; - case FileType.gz: yield new FileSystemGZipFile(fileEntity); break; - case FileType.bzip2: yield new FileSystemBZip2File(fileEntity); break; - case FileType.text: yield new FileSystemUTF8TextFile(fileEntity); break; - case FileType.latin1Text: yield new FileSystemLatin1TextFile(fileEntity); break; + case FileType.binary: yield FileSystemFile(fileEntity); break; + case FileType.zip: yield FileSystemZipFile(fileEntity); break; + case FileType.tar: yield FileSystemTarFile(fileEntity); break; + case FileType.gz: yield FileSystemGZipFile(fileEntity); break; + case FileType.bzip2: yield FileSystemBZip2File(fileEntity); break; + case FileType.text: yield FileSystemUTF8TextFile(fileEntity); break; + case FileType.latin1Text: yield FileSystemLatin1TextFile(fileEntity); break; case FileType.metadata: break; // ignore this file } } @@ -489,7 +489,7 @@ class FileSystemFile extends IoNode implements File { @override List readBytes() { - return cache(new BytesOf(_file), () => _file.readAsBytesSync()); + return cache(BytesOf(_file), () => _file.readAsBytesSync()); } } @@ -529,7 +529,7 @@ class ArchiveDirectory extends IoNode implements Directory { @override final String name; - Map _subdirectories = new SplayTreeMap(); + Map _subdirectories = SplayTreeMap(); List _files = []; void _add(a.ArchiveFile entry, List remainingPath) { @@ -537,19 +537,19 @@ class ArchiveDirectory extends IoNode implements Directory { final String subdirectoryName = remainingPath.removeAt(0); _subdirectories.putIfAbsent( subdirectoryName, - () => new ArchiveDirectory('$fullName/$subdirectoryName', subdirectoryName) + () => ArchiveDirectory('$fullName/$subdirectoryName', subdirectoryName) )._add(entry, remainingPath); } else { if (entry.size > 0) { final String entryFullName = fullName + '/' + path.basename(entry.name); switch (identifyFile(entry.name, () => entry.content)) { - case FileType.binary: _files.add(new ArchiveFile(entryFullName, entry)); break; - case FileType.zip: _files.add(new ArchiveZipFile(entryFullName, entry)); break; - case FileType.tar: _files.add(new ArchiveTarFile(entryFullName, entry)); break; - case FileType.gz: _files.add(new ArchiveGZipFile(entryFullName, entry)); break; - case FileType.bzip2: _files.add(new ArchiveBZip2File(entryFullName, entry)); break; - case FileType.text: _files.add(new ArchiveUTF8TextFile(entryFullName, entry)); break; - case FileType.latin1Text: _files.add(new ArchiveLatin1TextFile(entryFullName, entry)); break; + case FileType.binary: _files.add(ArchiveFile(entryFullName, entry)); break; + case FileType.zip: _files.add(ArchiveZipFile(entryFullName, entry)); break; + case FileType.tar: _files.add(ArchiveTarFile(entryFullName, entry)); break; + case FileType.gz: _files.add(ArchiveGZipFile(entryFullName, entry)); break; + case FileType.bzip2: _files.add(ArchiveBZip2File(entryFullName, entry)); break; + case FileType.text: _files.add(ArchiveUTF8TextFile(entryFullName, entry)); break; + case FileType.latin1Text: _files.add(ArchiveLatin1TextFile(entryFullName, entry)); break; case FileType.metadata: break; // ignore this file } } @@ -557,7 +557,7 @@ class ArchiveDirectory extends IoNode implements Directory { } static ArchiveDirectory parseArchive(a.Archive archive, String ownerPath) { - final ArchiveDirectory root = new ArchiveDirectory('$ownerPath!', ''); + final ArchiveDirectory root = ArchiveDirectory('$ownerPath!', ''); for (a.ArchiveFile file in archive.files) { if (file.size > 0) root._add(file, file.name.split('/')); @@ -623,13 +623,13 @@ class InMemoryFile extends IoNode implements File { if (bytes.isEmpty) return null; switch (identifyFile(fullName, () => bytes)) { - case FileType.binary: return new InMemoryFile(fullName, bytes); break; - case FileType.zip: return new InMemoryZipFile(fullName, bytes); break; - case FileType.tar: return new InMemoryTarFile(fullName, bytes); break; - case FileType.gz: return new InMemoryGZipFile(fullName, bytes); break; - case FileType.bzip2: return new InMemoryBZip2File(fullName, bytes); break; - case FileType.text: return new InMemoryUTF8TextFile(fullName, bytes); break; - case FileType.latin1Text: return new InMemoryLatin1TextFile(fullName, bytes); break; + case FileType.binary: return InMemoryFile(fullName, bytes); break; + case FileType.zip: return InMemoryZipFile(fullName, bytes); break; + case FileType.tar: return InMemoryTarFile(fullName, bytes); break; + case FileType.gz: return InMemoryGZipFile(fullName, bytes); break; + case FileType.bzip2: return InMemoryBZip2File(fullName, bytes); break; + case FileType.text: return InMemoryUTF8TextFile(fullName, bytes); break; + case FileType.latin1Text: return InMemoryLatin1TextFile(fullName, bytes); break; case FileType.metadata: break; // ignore this file } assert(false); diff --git a/engine/src/flutter/tools/licenses/lib/licenses.dart b/engine/src/flutter/tools/licenses/lib/licenses.dart index 091480ad77..0b82829993 100644 --- a/engine/src/flutter/tools/licenses/lib/licenses.dart +++ b/engine/src/flutter/tools/licenses/lib/licenses.dart @@ -109,7 +109,7 @@ abstract class License implements Comparable { factory License.unique(String body, LicenseType type, { bool reformatted: false, String origin, bool yesWeKnowWhatItLooksLikeButItIsNot: false }) { if (!reformatted) body = _reformat(body); - License result = _registry.putIfAbsent(body, () => new UniqueLicense._(body, type, origin: origin, yesWeKnowWhatItLooksLikeButItIsNot: yesWeKnowWhatItLooksLikeButItIsNot)); + License result = _registry.putIfAbsent(body, () => UniqueLicense._(body, type, origin: origin, yesWeKnowWhatItLooksLikeButItIsNot: yesWeKnowWhatItLooksLikeButItIsNot)); assert(() { 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}'; @@ -121,7 +121,7 @@ abstract class License implements Comparable { factory License.template(String body, LicenseType type, { bool reformatted: false, String origin }) { if (!reformatted) body = _reformat(body); - License result = _registry.putIfAbsent(body, () => new TemplateLicense._(body, type, origin: origin)); + License result = _registry.putIfAbsent(body, () => TemplateLicense._(body, type, origin: origin)); assert(() { 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}'; @@ -133,7 +133,7 @@ abstract class License implements Comparable { factory License.message(String body, LicenseType type, { bool reformatted: false, String origin }) { if (!reformatted) body = _reformat(body); - License result = _registry.putIfAbsent(body, () => new MessageLicense._(body, type, origin: origin)); + License result = _registry.putIfAbsent(body, () => MessageLicense._(body, type, origin: origin)); assert(() { 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}'; @@ -143,7 +143,7 @@ abstract class License implements Comparable { } factory License.blank(String body, LicenseType type, { String origin }) { - License result = _registry.putIfAbsent(body, () => new BlankLicense._(_reformat(body), type, origin: origin)); + License result = _registry.putIfAbsent(body, () => BlankLicense._(_reformat(body), type, origin: origin)); assert(() { 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}'; @@ -154,7 +154,7 @@ abstract class License implements Comparable { factory License.fromMultipleBlocks(List bodies, LicenseType type) { final String body = bodies.map((String s) => _reformat(s)).join('\n\n'); - return _registry.putIfAbsent(body, () => new UniqueLicense._(body, type)); + return _registry.putIfAbsent(body, () => UniqueLicense._(body, type)); } factory License.fromBodyAndType(String body, LicenseType type, { bool reformatted: false, String origin }) { @@ -166,10 +166,10 @@ abstract class License implements Comparable { case LicenseType.mit: case LicenseType.zlib: case LicenseType.icu: - return new TemplateLicense._(body, type, origin: origin); + return TemplateLicense._(body, type, origin: origin); case LicenseType.unknown: case LicenseType.apacheNotice: - return new UniqueLicense._(body, type, origin: origin); + return UniqueLicense._(body, type, origin: origin); case LicenseType.afl: case LicenseType.mpl: case LicenseType.gpl: @@ -179,11 +179,11 @@ abstract class License implements Comparable { case LicenseType.eclipse: case LicenseType.ijg: case LicenseType.apsl: - return new MessageLicense._(body, type, origin: origin); + return MessageLicense._(body, type, origin: origin); case LicenseType.openssl: - return new MultiLicense._(body, type, origin: origin); + return MultiLicense._(body, type, origin: origin); case LicenseType.libpng: - return new BlankLicense._(body, type, origin: origin); + return BlankLicense._(body, type, origin: origin); } }); assert(result.type == type); @@ -195,18 +195,18 @@ abstract class License implements Comparable { LicenseType type = convertLicenseNameToType(name); if (type == LicenseType.unknown) type = convertBodyToType(body); - return new License.fromBodyAndType(body, type, origin: origin); + return License.fromBodyAndType(body, type, origin: origin); } factory License.fromBody(String body, { String origin }) { body = _reformat(body); LicenseType type = convertBodyToType(body); - return new License.fromBodyAndType(body, type, reformatted: true, origin: origin); + return License.fromBodyAndType(body, type, reformatted: true, origin: origin); } factory License.fromCopyrightAndLicense(String copyright, String template, LicenseType type, { String origin }) { String body = '$copyright\n\n$template'; - return _registry.putIfAbsent(body, () => new TemplateLicense._(body, type, origin: origin)); + return _registry.putIfAbsent(body, () => TemplateLicense._(body, type, origin: origin)); } factory License.fromUrl(String url, { String origin }) { @@ -215,60 +215,60 @@ abstract class License implements Comparable { switch (url) { case 'Apache:2.0': case 'http://www.apache.org/licenses/LICENSE-2.0': - body = new system.File('data/apache-license-2.0').readAsStringSync(); + body = system.File('data/apache-license-2.0').readAsStringSync(); type = LicenseType.apache; break; case 'https://developers.google.com/open-source/licenses/bsd': - body = new system.File('data/google-bsd').readAsStringSync(); + body = system.File('data/google-bsd').readAsStringSync(); type = LicenseType.bsd; break; case 'http://polymer.github.io/LICENSE.txt': - body = new system.File('data/polymer-bsd').readAsStringSync(); + body = system.File('data/polymer-bsd').readAsStringSync(); type = LicenseType.bsd; break; case 'http://www.eclipse.org/legal/epl-v10.html': - body = new system.File('data/eclipse-1.0').readAsStringSync(); + body = system.File('data/eclipse-1.0').readAsStringSync(); type = LicenseType.eclipse; break; case 'COPYING3:3': - body = new system.File('data/gpl-3.0').readAsStringSync(); + body = system.File('data/gpl-3.0').readAsStringSync(); type = LicenseType.gpl; break; case 'COPYING.LIB:2': case 'COPYING.LIother.m_:2': // blame hyatt - body = new system.File('data/library-gpl-2.0').readAsStringSync(); + body = system.File('data/library-gpl-2.0').readAsStringSync(); type = LicenseType.lgpl; break; case 'GNU Lesser:2': // there has never been such a license, but the authors said they meant the LGPL2.1 case 'GNU Lesser:2.1': - body = new system.File('data/lesser-gpl-2.1').readAsStringSync(); + body = system.File('data/lesser-gpl-2.1').readAsStringSync(); type = LicenseType.lgpl; break; case 'COPYING.RUNTIME:3.1': case 'GCC Runtime Library Exception:3.1': - body = new system.File('data/gpl-gcc-exception-3.1').readAsStringSync(); + body = system.File('data/gpl-gcc-exception-3.1').readAsStringSync(); break; case 'Academic Free License:3.0': - body = new system.File('data/academic-3.0').readAsStringSync(); + body = system.File('data/academic-3.0').readAsStringSync(); type = LicenseType.afl; break; case 'http://mozilla.org/MPL/2.0/:2.0': - body = new system.File('data/mozilla-2.0').readAsStringSync(); + body = system.File('data/mozilla-2.0').readAsStringSync(); type = LicenseType.mpl; break; case 'http://opensource.org/licenses/MIT': case 'http://opensource->org/licenses/MIT': // i don't even - body = new system.File('data/mit').readAsStringSync(); + body = system.File('data/mit').readAsStringSync(); type = LicenseType.mit; break; case 'http://www.unicode.org/copyright.html': - body = new system.File('data/unicode').readAsStringSync(); + body = system.File('data/unicode').readAsStringSync(); type = LicenseType.icu; break; default: throw 'unknown url $url'; } - return _registry.putIfAbsent(body, () => new License.fromBodyAndType(body, type, origin: origin)); + return _registry.putIfAbsent(body, () => License.fromBodyAndType(body, type, origin: origin)); } License._(String body, this.type, { this.origin, bool yesWeKnowWhatItLooksLikeButItIsNot: false }) : body = body, authors = _readAuthors(body) { @@ -352,7 +352,7 @@ abstract class License implements Comparable { Iterable get licensees => _licensees; List _licensees = []; - Set _libraries = new Set(); + Set _libraries = Set(); bool get isUsed => _licensees.isNotEmpty; @@ -395,7 +395,7 @@ abstract class License implements Comparable { return prefixes.join('\n') + '\n\n' + body; } - static final RegExp _copyrightForAuthors = new RegExp( + static final RegExp _copyrightForAuthors = RegExp( r'Copyright [-0-9 ,(cC)©]+\b(The .+ Authors)\.', caseSensitive: false ); @@ -417,7 +417,7 @@ void clearLicenseRegistry() { _registry.clear(); } -final License missingLicense = new UniqueLicense._('', LicenseType.unknown); +final License missingLicense = UniqueLicense._('', LicenseType.unknown); String _reformat(String body) { // TODO(ianh): ensure that we're stripping the same amount of leading text on each line @@ -491,12 +491,12 @@ Iterable<_LineRange> _walkLinesBackwards(String body, int start) sync* { start -= 1; if (body[start] == '\n') { if (end != null) - yield new _LineRange(start + 1, end, body); + yield _LineRange(start + 1, end, body); end = start; } } if (end != null) - yield new _LineRange(start, end, body); + yield _LineRange(start, end, body); } Iterable<_LineRange> _walkLinesForwards(String body, { int start: 0, int end }) sync* { @@ -506,13 +506,13 @@ Iterable<_LineRange> _walkLinesForwards(String body, { int start: 0, int end }) while (endIndex < end) { if (body[endIndex] == '\n') { if (startIndex != null) - yield new _LineRange(startIndex, endIndex, body); + yield _LineRange(startIndex, endIndex, body); startIndex = endIndex + 1; } endIndex += 1; } if (startIndex != null) - yield new _LineRange(startIndex, endIndex, body); + yield _LineRange(startIndex, endIndex, body); } class _SplitLicense { @@ -586,7 +586,7 @@ _SplitLicense _splitLicense(String body, { bool verifyResults: true }) { } if (verifyResults && 'Copyright ('.allMatches(body, end).isNotEmpty && !body.startsWith('If you modify libpng')) throw 'the license seems to contain a copyright:\n===copyright===\n${body.substring(0, end)}\n===license===\n${body.substring(end)}\n========='; - return new _SplitLicense(body, end); + return _SplitLicense(body, end); } class _PartialLicenseMatch { @@ -703,7 +703,7 @@ Iterable<_PartialLicenseMatch> _findLicenseBlocks(String body, RegExp pattern, i assert(body[match.start - 1] == '\n'); split = match.start - 1; } - yield new _PartialLicenseMatch(body, start, split, match.end, match, hasCopyrights: foundAny); + yield _PartialLicenseMatch(body, start, split, match.end, match, hasCopyrights: foundAny); } } @@ -721,9 +721,9 @@ Iterable<_LicenseMatch> _expand(License template, String copyright, String body, List results = template.expandTemplate(_reformat(copyright), body, origin: origin).toList(); if (results.isEmpty) throw 'license could not be expanded'; - yield new _LicenseMatch(results.first, start, end, debug: 'expanding template for $debug'); + yield _LicenseMatch(results.first, start, end, debug: 'expanding template for $debug'); if (results.length > 1) - yield* results.skip(1).map((License license) => new _LicenseMatch(license, start, end, isDuplicate: true, debug: 'expanding subsequent template for $debug')); + yield* results.skip(1).map((License license) => _LicenseMatch(license, start, end, isDuplicate: true, debug: 'expanding subsequent template for $debug')); } Iterable<_LicenseMatch> _tryNone(String body, String filename, RegExp pattern, LicenseSource parentDirectory) sync* { @@ -732,16 +732,16 @@ Iterable<_LicenseMatch> _tryNone(String body, String filename, RegExp pattern, L if (results == null || results.isEmpty) throw 'no default license file found'; // TODO(ianh): use _expand if the license asks for the copyright to be included (e.g. BSD) - yield new _LicenseMatch(results.first, match.start, match.end, debug: '_tryNone'); + yield _LicenseMatch(results.first, match.start, match.end, debug: '_tryNone'); if (results.length > 1) - yield* results.skip(1).map((License license) => new _LicenseMatch(license, match.start, match.end, isDuplicate: true, debug: 'subsequent _tryNone')); + yield* results.skip(1).map((License license) => _LicenseMatch(license, match.start, match.end, isDuplicate: true, debug: 'subsequent _tryNone')); } } Iterable<_LicenseMatch> _tryAttribution(String body, RegExp pattern, { String origin }) sync* { for (Match match in pattern.allMatches(body)) { assert(match.groupCount == 2); - yield new _LicenseMatch(new License.unique('Thanks to ${match.group(2)}.', LicenseType.unknown, origin: origin), match.start, match.end, debug: '_tryAttribution'); + yield _LicenseMatch(License.unique('Thanks to ${match.group(2)}.', LicenseType.unknown, origin: origin), match.start, match.end, debug: '_tryAttribution'); } } @@ -771,7 +771,7 @@ Iterable<_LicenseMatch> _tryReferenceByFilename(String body, LicenseFileReferenc 'block:\n---\n${match.getEntireLicense()}\n---'; } if (match.getCopyrights() == '') { - yield new _LicenseMatch(template, match.start, match.end, debug: '_tryReferenceByFilename (with failed copyright search) looking for $filename'); + yield _LicenseMatch(template, match.start, match.end, debug: '_tryReferenceByFilename (with failed copyright search) looking for $filename'); } else { yield* _expand(template, match.getCopyrights(), match.getEntireLicense(), match.start, match.end, debug: '_tryReferenceByFilename (with successful copyright search) looking for $filename', origin: origin); } @@ -793,7 +793,7 @@ Iterable<_LicenseMatch> _tryReferenceByType(String body, RegExp pattern, License if (needsCopyright) yield* _expand(template, match.getCopyrights(), match.getEntireLicense(), match.start, match.end, debug: '_tryReferenceByType', origin: origin); else - yield new _LicenseMatch(template, match.start, match.end, debug: '_tryReferenceByType (without copyrights) for type $type'); + yield _LicenseMatch(template, match.start, match.end, debug: '_tryReferenceByType (without copyrights) for type $type'); } } @@ -803,7 +803,7 @@ License _dereferenceLicense(int groupIndex, String group(int index), MultipleVer String suffix = ''; if (pattern.versionIndicies != null && pattern.versionIndicies.containsKey(groupIndex)) suffix = ':${group(pattern.versionIndicies[groupIndex])}'; - result = new License.fromUrl('${group(groupIndex)}$suffix', origin: origin); + result = License.fromUrl('${group(groupIndex)}$suffix', origin: origin); } return result; } @@ -813,7 +813,7 @@ Iterable<_LicenseMatch> _tryReferenceByUrl(String body, MultipleVersionedLicense bool isDuplicate = false; for (int index in pattern.licenseIndices) { final License result = _dereferenceLicense(index, match.group, pattern, parentDirectory, origin: origin); - yield new _LicenseMatch(result, match.start, match.end, isDuplicate: isDuplicate, debug: '_tryReferenceByUrl'); + yield _LicenseMatch(result, match.start, match.end, isDuplicate: isDuplicate, debug: '_tryReferenceByUrl'); isDuplicate = true; } } @@ -826,7 +826,7 @@ Iterable<_LicenseMatch> _tryInline(String body, RegExp pattern, { bool needsCopy // "missingCopyrights: true" if our own "needsCopyright" argument is true. // We use a template license here (not unique) because it's not uncommon for files // to reference license blocks in other files, but with their own copyrights. - yield new _LicenseMatch(new License.fromBody(match.getEntireLicense(), origin: origin), match.start, match.end, debug: '_tryInline', missingCopyrights: needsCopyright && !match.hasCopyrights); + yield _LicenseMatch(License.fromBody(match.getEntireLicense(), origin: origin), match.start, match.end, debug: '_tryInline', missingCopyrights: needsCopyright && !match.hasCopyrights); } } @@ -947,7 +947,7 @@ class TemplateLicense extends License { @override Iterable expandTemplate(String copyright, String licenseBody, { String origin }) sync* { _conditions ??= _splitLicense(body).getConditions(); - yield new License.fromCopyrightAndLicense(copyright, _conditions, type, origin: '$origin + ${this.origin}'); + yield License.fromCopyrightAndLicense(copyright, _conditions, type, origin: '$origin + ${this.origin}'); } } @@ -957,8 +957,8 @@ class MultiLicense extends License { @override Iterable expandTemplate(String copyright, String licenseBody, { String origin }) sync* { - yield new License.fromBody(body, origin: '$origin + ${this.origin}'); - yield new License.fromBody(licenseBody, origin: '$origin + ${this.origin}'); + yield License.fromBody(body, origin: '$origin + ${this.origin}'); + yield License.fromBody(licenseBody, origin: '$origin + ${this.origin}'); } } diff --git a/engine/src/flutter/tools/licenses/lib/main.dart b/engine/src/flutter/tools/licenses/lib/main.dart index e70e2cb6cb..182ca676ef 100644 --- a/engine/src/flutter/tools/licenses/lib/main.dart +++ b/engine/src/flutter/tools/licenses/lib/main.dart @@ -51,11 +51,11 @@ abstract class _RepositoryLicensedFile extends _RepositoryFile { _RepositoryLicensedFile(_RepositoryDirectory parent, fs.File io) : super(parent, io); // file names that we are confident won't be included in the final build product - static final RegExp _readmeNamePattern = new RegExp(r'\b_*(?:readme|contributing|patents)_*\b', caseSensitive: false); - static final RegExp _buildTimePattern = new 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)$', caseSensitive: false); - static final RegExp _docsPattern = new RegExp(r'^(?:INSTALL|NEWS|OWNERS|AUTHORS|ChangeLog(?:\.rst|\.[0-9]+)?|.+\.txt|.+\.md|.+\.log|.+\.css|.+\.1|doxygen\.config|.+\.spec(?:\.in)?)$', caseSensitive: false); - static final RegExp _devPattern = new RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|\.gitattributes|\.landmines|\.DS_Store|\.travis\.yml|\.cirrus\.yml)$', caseSensitive: false); - static final RegExp _testsPattern = new RegExp(r'^(?:tj(?:bench|example)test\.(?:java\.)?in|example\.c)$', caseSensitive: false); + 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)$', caseSensitive: false); + static final RegExp _docsPattern = RegExp(r'^(?:INSTALL|NEWS|OWNERS|AUTHORS|ChangeLog(?:\.rst|\.[0-9]+)?|.+\.txt|.+\.md|.+\.log|.+\.css|.+\.1|doxygen\.config|.+\.spec(?:\.in)?)$', caseSensitive: false); + static final RegExp _devPattern = RegExp(r'^(?:codereview\.settings|.+\.~|.+\.~[0-9]+~|\.clang-format|\.gitattributes|\.landmines|\.DS_Store|\.travis\.yml|\.cirrus\.yml)$', caseSensitive: false); + static final RegExp _testsPattern = RegExp(r'^(?:tj(?:bench|example)test\.(?:java\.)?in|example\.c)$', caseSensitive: false); bool get isIncludedInBuildProducts { return !io.name.contains(_readmeNamePattern) @@ -75,7 +75,7 @@ class _RepositorySourceFile extends _RepositoryLicensedFile { @override fs.TextFile get io => super.io; - static final RegExp _hashBangPattern = new RegExp(r'^#! *(?:/bin/sh|/bin/bash|/usr/bin/env +(?:python|bash))\b'); + static final RegExp _hashBangPattern = RegExp(r'^#! *(?:/bin/sh|/bin/bash|/usr/bin/env +(?:python|bash))\b'); @override bool get isShellScript { @@ -170,7 +170,7 @@ abstract class _RepositorySingleLicenseFile extends _RepositoryLicenseFile { class _RepositoryGeneralSingleLicenseFile extends _RepositorySingleLicenseFile { _RepositoryGeneralSingleLicenseFile(_RepositoryDirectory parent, fs.TextFile io) - : super(parent, io, new License.fromBodyAndName(io.readString(), io.name, origin: io.fullName)); + : super(parent, io, License.fromBodyAndName(io.readString(), io.name, origin: io.fullName)); _RepositoryGeneralSingleLicenseFile.fromLicense(_RepositoryDirectory parent, fs.TextFile io, License license) : super(parent, io, license); @@ -190,7 +190,7 @@ class _RepositoryApache4DNoticeFile extends _RepositorySingleLicenseFile { @override License licenseOfType(LicenseType type) => null; - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'^(// ------------------------------------------------------------------\n' r'// NOTICE file corresponding to the section 4d of The Apache License,\n' r'// Version 2\.0, in this case for (?:.+)\n' @@ -207,7 +207,7 @@ class _RepositoryApache4DNoticeFile extends _RepositorySingleLicenseFile { static License _parseLicense(fs.TextFile io) { final Match match = _pattern.allMatches(io.readString()).single; assert(match.groupCount == 2); - return new License.unique(match.group(2), LicenseType.apacheNotice, origin: io.fullName); + return License.unique(match.group(2), LicenseType.apacheNotice, origin: io.fullName); } } @@ -226,7 +226,7 @@ class _RepositoryLicenseRedirectFile extends _RepositorySingleLicenseFile { String contents = io.readString(); License license = interpretAsRedirectLicense(contents, parent, origin: io.fullName); if (license != null) - return new _RepositoryLicenseRedirectFile(parent, io, license); + return _RepositoryLicenseRedirectFile(parent, io, license); return null; } } @@ -243,7 +243,7 @@ class _RepositoryLicenseFileWithLeader extends _RepositorySingleLicenseFile { final Match match = leader.firstMatch(body); if (match == null) throw 'failed to strip leader from $io\nleader: /$leader/\nbody:\n---\n$body\n---'; - return new License.fromBodyAndName(body.substring(match.end), io.name, origin: io.fullName); + return License.fromBodyAndName(body.substring(match.end), io.name, origin: io.fullName); } } @@ -251,7 +251,7 @@ class _RepositoryReadmeIjgFile extends _RepositorySingleLicenseFile { _RepositoryReadmeIjgFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'Permission is hereby granted to use, copy, modify, and distribute this\n' r'software \(or portions thereof\) for any purpose, without fee, subject to these\n' r'conditions:\n' @@ -272,7 +272,7 @@ class _RepositoryReadmeIjgFile extends _RepositorySingleLicenseFile { String body = io.readString(); if (!body.contains(_pattern)) throw 'unexpected contents in IJG README'; - return new License.message(body, LicenseType.ijg, origin: io.fullName); + return License.message(body, LicenseType.ijg, origin: io.fullName); } @override @@ -292,7 +292,7 @@ class _RepositoryDartLicenseFile extends _RepositorySingleLicenseFile { _RepositoryDartLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'^This license applies to all parts of Dart that are not externally\n' r'maintained libraries\. The external maintained libraries used by\n' r'Dart are:\n' @@ -310,7 +310,7 @@ class _RepositoryDartLicenseFile extends _RepositorySingleLicenseFile { final Match match = _pattern.firstMatch(io.readString()); if (match == null || match.groupCount != 1) throw 'unexpected Dart license file contents'; - return new License.template(match.group(1), LicenseType.bsd, origin: io.fullName); + return License.template(match.group(1), LicenseType.bsd, origin: io.fullName); } @override @@ -321,7 +321,7 @@ class _RepositoryDartLicenseFile extends _RepositorySingleLicenseFile { class _RepositoryLibPngLicenseFile extends _RepositorySingleLicenseFile { _RepositoryLibPngLicenseFile(_RepositoryDirectory parent, fs.TextFile io) - : super(parent, io, new License.blank(io.readString(), LicenseType.libpng, origin: io.fullName)) { + : super(parent, io, License.blank(io.readString(), LicenseType.libpng, origin: io.fullName)) { _verifyLicense(io); } @@ -343,7 +343,7 @@ class _RepositoryLibPngLicenseFile extends _RepositorySingleLicenseFile { class _RepositoryBlankLicenseFile extends _RepositorySingleLicenseFile { _RepositoryBlankLicenseFile(_RepositoryDirectory parent, fs.TextFile io, String sanityCheck) - : super(parent, io, new License.blank(io.readString(), LicenseType.unknown)) { + : super(parent, io, License.blank(io.readString(), LicenseType.unknown)) { _verifyLicense(io, sanityCheck); } @@ -361,7 +361,7 @@ class _RepositoryCatapultApiClientLicenseFile extends _RepositorySingleLicenseFi _RepositoryCatapultApiClientLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r' *Licensed under the Apache License, Version 2\.0 \(the "License"\);\n' r' *you may not use this file except in compliance with the License\.\n' r' *You may obtain a copy of the License at\n' @@ -381,7 +381,7 @@ class _RepositoryCatapultApiClientLicenseFile extends _RepositorySingleLicenseFi final Match match = _pattern.firstMatch(io.readString()); if (match == null || match.groupCount != 1) throw 'unexpected apiclient license file contents'; - return new License.fromUrl(match.group(1), origin: io.fullName); + return License.fromUrl(match.group(1), origin: io.fullName); } @override @@ -394,7 +394,7 @@ class _RepositoryCatapultCoverageLicenseFile extends _RepositorySingleLicenseFil _RepositoryCatapultCoverageLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, _parseLicense(io)); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r' *Except where noted otherwise, this software is licensed under the Apache\n' r' *License, Version 2.0 \(the "License"\); you may not use this work except in\n' r' *compliance with the License\. You may obtain a copy of the License at\n' @@ -414,7 +414,7 @@ class _RepositoryCatapultCoverageLicenseFile extends _RepositorySingleLicenseFil final Match match = _pattern.firstMatch(io.readString()); if (match == null || match.groupCount != 1) throw 'unexpected coverage license file contents'; - return new License.fromUrl(match.group(1), origin: io.fullName); + return License.fromUrl(match.group(1), origin: io.fullName); } @override @@ -429,7 +429,7 @@ class _RepositoryLibJpegTurboLicense extends _RepositoryLicenseFile { _parseLicense(io); } - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'libjpeg-turbo is covered by three compatible BSD-style open source licenses:\n' r'\n' r'- The IJG \(Independent JPEG Group\) License, which is listed in\n' @@ -495,7 +495,7 @@ class _RepositoryFreetypeLicenseFile extends _RepositoryLicenseFile { _RepositoryFreetypeLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _target = _parseLicense(io), super(parent, io); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r"The FreeType 2 font engine is copyrighted work and cannot be used\n" r"legally without a software license\. In order to make this project\n" r"usable to a vast majority of developers, we distribute it under two\n" @@ -581,7 +581,7 @@ class _RepositoryIcuLicenseFile extends _RepositoryLicenseFile { final List _licenses; - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'^COPYRIGHT AND PERMISSION NOTICE \(ICU 58 and later\)\n+' r'( *Copyright (?:.|\n)+?)\n+' // 1 r'Third-Party Software Licenses\n+' @@ -653,8 +653,8 @@ class _RepositoryIcuLicenseFile extends _RepositoryLicenseFile { caseSensitive: false ); - static final RegExp _unexpectedHash = new RegExp(r'^.+ #', multiLine: true); - static final RegExp _newlineHash = new RegExp(r' # ?'); + static final RegExp _unexpectedHash = RegExp(r'^.+ #', multiLine: true); + static final RegExp _newlineHash = RegExp(r' # ?'); static String _dewrap(String s) { if (!s.startsWith(' # ')) @@ -674,16 +674,16 @@ class _RepositoryIcuLicenseFile extends _RepositoryLicenseFile { if (match.group(10).contains(copyrightMentionPattern) || match.group(11).contains('7.')) throw 'unexpected copyright in ICU license file'; final List result = [ - new License.fromBodyAndType(_dewrap(match.group(1)), LicenseType.unknown, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(2)), LicenseType.icu, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(3)), LicenseType.bsd, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(4)), LicenseType.bsd, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(5)), LicenseType.bsd, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(6)), LicenseType.unknown, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(7)), LicenseType.unknown, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(8)), LicenseType.bsd, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(9)), LicenseType.bsd, origin: io.fullName), - new License.fromBodyAndType(_dewrap(match.group(11)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(1)), LicenseType.unknown, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(2)), LicenseType.icu, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(3)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(4)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(5)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(6)), LicenseType.unknown, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(7)), LicenseType.unknown, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(8)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(9)), LicenseType.bsd, origin: io.fullName), + License.fromBodyAndType(_dewrap(match.group(11)), LicenseType.bsd, origin: io.fullName), ]; return result; } @@ -771,7 +771,7 @@ class _RepositoryMultiLicenseNoticesForFilesFile extends _RepositoryLicenseFile } on FormatException { bodyText = latin1.decode(bodyBytes); } - License license = new License.unique(bodyText, LicenseType.unknown, origin: io.fullName); + License license = License.unique(bodyText, LicenseType.unknown, origin: io.fullName); for (String name in names) { if (result[name] != null) throw 'conflicting license information for $name in ${io.fullName}'; @@ -813,7 +813,7 @@ class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { _RepositoryCxxStlDualLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : _licenses = _parseLicenses(io), super(parent, io); - static final RegExp _pattern = new RegExp( + static final RegExp _pattern = RegExp( r'^' r'==============================================================================\n' r'.+ License\n' @@ -838,8 +838,8 @@ class _RepositoryCxxStlDualLicenseFile extends _RepositoryLicenseFile { if (match == null || match.groupCount != 2) throw 'unexpected dual license file contents'; return [ - new License.fromBodyAndType(match.group(1), LicenseType.bsd), - new License.fromBodyAndType(match.group(2), LicenseType.mit), + License.fromBodyAndType(match.group(1), LicenseType.bsd), + License.fromBodyAndType(match.group(2), LicenseType.mit), ]; } @@ -887,7 +887,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { final Map _childrenByName = {}; // the bit at the beginning excludes files like "license.py". - static final RegExp _licenseNamePattern = new RegExp(r'^(?!.*\.py$)(?!.*(?:no|update)-copyright)(?!.*mh-bsd-gcc).*\b_*(?:license(?!\.html)|copying|copyright|notice|l?gpl|bsd|mpl?|ftl\.txt)_*\b', caseSensitive: false); + static final RegExp _licenseNamePattern = RegExp(r'^(?!.*\.py$)(?!.*(?:no|update)-copyright)(?!.*mh-bsd-gcc).*\b_*(?:license(?!\.html)|copying|copyright|notice|l?gpl|bsd|mpl?|ftl\.txt)_*\b', caseSensitive: false); void crawl() { for (fs.IoNode entry in io.walk) { @@ -943,14 +943,14 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryGenericThirdPartyDirectory(this, entry); - return new _RepositoryDirectory(this, entry); + return _RepositoryGenericThirdPartyDirectory(this, entry); + return _RepositoryDirectory(this, entry); } _RepositoryFile createFile(fs.IoNode entry) { if (entry is fs.TextFile) { if (_RepositoryApache4DNoticeFile.consider(entry)) { - return new _RepositoryApache4DNoticeFile(this, entry); + return _RepositoryApache4DNoticeFile(this, entry); } else { _RepositoryFile result; if (entry.name == 'NOTICE') @@ -958,17 +958,17 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { if (result != null) { return result; } else if (entry.name.contains(_licenseNamePattern)) { - return new _RepositoryGeneralSingleLicenseFile(this, entry); + return _RepositoryGeneralSingleLicenseFile(this, entry); } else if (entry.name == 'README.ijg') { - return new _RepositoryReadmeIjgFile(this, entry); + return _RepositoryReadmeIjgFile(this, entry); } else { - return new _RepositorySourceFile(this, entry); + return _RepositorySourceFile(this, entry); } } } else if (entry.name == 'NOTICE.txt') { - return new _RepositoryMultiLicenseNoticesForFilesFile(this, entry); + return _RepositoryMultiLicenseNoticesForFilesFile(this, entry); } else { - return new _RepositoryBinaryFile(this, entry); + return _RepositoryBinaryFile(this, entry); } } @@ -1145,7 +1145,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { if (ignoreCase) { // we get here if we're trying a last-ditch effort at finding a file. // so this should happen only rarely. - map = new HashMap( + map = HashMap( equals: (String n1, String n2) => n1.toLowerCase() == n2.toLowerCase(), hashCode: (String n) => n.toLowerCase().hashCode ) @@ -1175,7 +1175,7 @@ class _RepositoryDirectory extends _RepositoryEntry implements LicenseSource { } Set getLicenses(_Progress progress) { - Set result = new Set(); + Set result = Set(); for (_RepositoryDirectory directory in _subdirectories) result.addAll(directory.getLicenses(progress)); for (_RepositoryLicensedFile file in _files) { @@ -1281,7 +1281,7 @@ class _RepositoryReachOutDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (reachOutFilenames.contains(entry.name)) - return new _RepositoryReachOutFile(this, entry, offset); + return _RepositoryReachOutFile(this, entry, offset); return super.createFile(entry); } } @@ -1302,7 +1302,7 @@ class _RepositoryExcludeSubpathDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == paths[index] && (index < paths.length - 1)) - return new _RepositoryExcludeSubpathDirectory(this, entry, paths, index + 1); + return _RepositoryExcludeSubpathDirectory(this, entry, paths, index + 1); return super.createSubdirectory(entry); } } @@ -1338,7 +1338,7 @@ class _RepositoryFreetypeDocsDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.TXT') - return new _RepositoryFreetypeLicenseFile(this, entry); + return _RepositoryFreetypeLicenseFile(this, entry); return super.createFile(entry); } @@ -1350,7 +1350,7 @@ class _RepositoryFreetypeDocsDirectory extends _RepositoryDirectory { // We don't ship anything in this directory so don't bother looking for licenses there. // However, there are licenses in this directory referenced from elsewhere, so we do // want to crawl it and expose them. - return new Set(); + return Set(); } } @@ -1386,7 +1386,7 @@ class _RepositoryFreetypeSrcDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'gzip') - return new _RepositoryFreetypeSrcGZipDirectory(this, entry); + return _RepositoryFreetypeSrcGZipDirectory(this, entry); return super.createSubdirectory(entry); } @@ -1431,9 +1431,9 @@ class _RepositoryFreetypeDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new _RepositoryFreetypeSrcDirectory(this, entry); + return _RepositoryFreetypeSrcDirectory(this, entry); if (entry.name == 'docs') - return new _RepositoryFreetypeDocsDirectory(this, entry); + return _RepositoryFreetypeDocsDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1450,7 +1450,7 @@ class _RepositoryIcuDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new _RepositoryIcuLicenseFile(this, entry); + return _RepositoryIcuLicenseFile(this, entry); return super.createFile(entry); } } @@ -1471,7 +1471,7 @@ class _RepositoryJSR305Directory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new _RepositoryJSR305SrcDirectory(this, entry); + return _RepositoryJSR305SrcDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1499,14 +1499,14 @@ class _RepositoryLibcxxDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new _RepositoryLibcxxSrcDirectory(this, entry); + return _RepositoryLibcxxSrcDirectory(this, entry); return super.createSubdirectory(entry); } @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.TXT') - return new _RepositoryCxxStlDualLicenseFile(this, entry); + return _RepositoryCxxStlDualLicenseFile(this, entry); return super.createFile(entry); } } @@ -1517,7 +1517,7 @@ class _RepositoryLibcxxSrcDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'support') - return new _RepositoryLibcxxSrcSupportDirectory(this, entry); + return _RepositoryLibcxxSrcSupportDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1538,7 +1538,7 @@ class _RepositoryLibcxxabiDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.TXT') - return new _RepositoryCxxStlDualLicenseFile(this, entry); + return _RepositoryCxxStlDualLicenseFile(this, entry); return super.createFile(entry); } } @@ -1549,9 +1549,9 @@ class _RepositoryLibJpegDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'README') - return new _RepositoryReadmeIjgFile(this, entry); + return _RepositoryReadmeIjgFile(this, entry); if (entry.name == 'LICENSE') - return new _RepositoryLicenseFileWithLeader(this, entry, new RegExp(r'^\(Copied from the README\.\)\n+-+\n+')); + return _RepositoryLicenseFileWithLeader(this, entry, RegExp(r'^\(Copied from the README\.\)\n+-+\n+')); return super.createFile(entry); } } @@ -1562,7 +1562,7 @@ class _RepositoryLibJpegTurboDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE.md') - return new _RepositoryLibJpegTurboLicense(this, entry); + return _RepositoryLibJpegTurboLicense(this, entry); return super.createFile(entry); } @@ -1581,7 +1581,7 @@ class _RepositoryLibPngDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE' || entry.name == 'png.h') - return new _RepositoryLibPngLicenseFile(this, entry); + return _RepositoryLibPngLicenseFile(this, entry); return super.createFile(entry); } } @@ -1604,7 +1604,7 @@ class _RepositoryPkgDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'when') - return new _RepositoryPkgWhenDirectory(this, entry); + return _RepositoryPkgWhenDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1625,7 +1625,7 @@ class _RepositorySkiaLibWebPDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'webp') - return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['config.h']), 3); + return _RepositoryReachOutDirectory(this, entry, Set.from(const ['config.h']), 3); return super.createSubdirectory(entry); } } @@ -1656,13 +1656,13 @@ class _RepositorySkiaThirdPartyDirectory extends _RepositoryGenericThirdPartyDir @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'ktx') - return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['ktx.h', 'ktx.cpp']), 2); + return _RepositoryReachOutDirectory(this, entry, Set.from(const ['ktx.h', 'ktx.cpp']), 2); if (entry.name == 'libmicrohttpd') - return new _RepositoryReachOutDirectory(this, entry, new Set.from(const ['MHD_config.h']), 2); + return _RepositoryReachOutDirectory(this, entry, Set.from(const ['MHD_config.h']), 2); if (entry.name == 'libwebp') - return new _RepositorySkiaLibWebPDirectory(this, entry); + return _RepositorySkiaLibWebPDirectory(this, entry); if (entry.name == 'libsdl') - return new _RepositorySkiaLibSdlDirectory(this, entry); + return _RepositorySkiaLibSdlDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1681,7 +1681,7 @@ class _RepositorySkiaDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositorySkiaThirdPartyDirectory(this, entry); + return _RepositorySkiaThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1699,7 +1699,7 @@ class _RepositoryVulkanDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new _RepositoryExcludeSubpathDirectory(this, entry, const ['spec']); + return _RepositoryExcludeSubpathDirectory(this, entry, const ['spec']); return super.createSubdirectory(entry); } } @@ -1735,41 +1735,41 @@ class _RepositoryRootThirdPartyDirectory extends _RepositoryGenericThirdPartyDir @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'android_platform') - return new _RepositoryAndroidPlatformDirectory(this, entry); + return _RepositoryAndroidPlatformDirectory(this, entry); if (entry.name == 'boringssl') - return new _RepositoryBoringSSLDirectory(this, entry); + return _RepositoryBoringSSLDirectory(this, entry); if (entry.name == 'catapult') - return new _RepositoryCatapultDirectory(this, entry); + return _RepositoryCatapultDirectory(this, entry); if (entry.name == 'dart') - return new _RepositoryDartDirectory(this, entry); + return _RepositoryDartDirectory(this, entry); if (entry.name == 'expat') - return new _RepositoryExpatDirectory(this, entry); + return _RepositoryExpatDirectory(this, entry); if (entry.name == 'freetype-android') throw '//third_party/freetype-android is no longer part of this client: remove it'; if (entry.name == 'freetype2') - return new _RepositoryFreetypeDirectory(this, entry); + return _RepositoryFreetypeDirectory(this, entry); if (entry.name == 'harfbuzz') - return new _RepositoryHarfbuzzDirectory(this, entry); + return _RepositoryHarfbuzzDirectory(this, entry); if (entry.name == 'icu') - return new _RepositoryIcuDirectory(this, entry); + return _RepositoryIcuDirectory(this, entry); if (entry.name == 'jsr-305') - return new _RepositoryJSR305Directory(this, entry); + return _RepositoryJSR305Directory(this, entry); if (entry.name == 'libcxx') - return new _RepositoryLibcxxDirectory(this, entry); + return _RepositoryLibcxxDirectory(this, entry); if (entry.name == 'libcxxabi') - return new _RepositoryLibcxxabiDirectory(this, entry); + return _RepositoryLibcxxabiDirectory(this, entry); if (entry.name == 'libjpeg') - return new _RepositoryLibJpegDirectory(this, entry); + return _RepositoryLibJpegDirectory(this, entry); if (entry.name == 'libjpeg_turbo' || entry.name == 'libjpeg-turbo') - return new _RepositoryLibJpegTurboDirectory(this, entry); + return _RepositoryLibJpegTurboDirectory(this, entry); if (entry.name == 'libpng') - return new _RepositoryLibPngDirectory(this, entry); + return _RepositoryLibPngDirectory(this, entry); if (entry.name == 'libwebp') - return new _RepositoryLibWebpDirectory(this, entry); + return _RepositoryLibWebpDirectory(this, entry); if (entry.name == 'pkg') - return new _RepositoryPkgDirectory(this, entry); + return _RepositoryPkgDirectory(this, entry); if (entry.name == 'vulkan') - return new _RepositoryVulkanDirectory(this, entry); + return _RepositoryVulkanDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1802,14 +1802,14 @@ class _RepositoryBoringSSLSourceDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new _RepositoryOpenSSLLicenseFile(this, entry); + return _RepositoryOpenSSLLicenseFile(this, entry); return super.createFile(entry); } @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryBoringSSLThirdPartyDirectory(this, entry); + return _RepositoryBoringSSLThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1824,7 +1824,7 @@ class _RepositoryBoringSSLSourceDirectory extends _RepositoryDirectory { class _RepositoryOpenSSLLicenseFile extends _RepositorySingleLicenseFile { _RepositoryOpenSSLLicenseFile(_RepositoryDirectory parent, fs.TextFile io) : super(parent, io, - new License.fromBodyAndType( + License.fromBodyAndType( LineSplitter.split(io.readString()) .skip(23) .takeWhile((String s) => !s.startsWith('BoringSSL uses the Chromium test infrastructure to run a continuous build,')) @@ -1854,14 +1854,14 @@ class _RepositoryBoringSSLDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'README') - return new _RepositoryBlankLicenseFile(this, entry, 'This repository contains the files generated by boringssl for its build.'); + return _RepositoryBlankLicenseFile(this, entry, 'This repository contains the files generated by boringssl for its build.'); return super.createFile(entry); } @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'src') - return new _RepositoryBoringSSLSourceDirectory(this, entry); + return _RepositoryBoringSSLSourceDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1872,7 +1872,7 @@ class _RepositoryCatapultThirdPartyApiClientDirectory extends _RepositoryDirecto @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new _RepositoryCatapultApiClientLicenseFile(this, entry); + return _RepositoryCatapultApiClientLicenseFile(this, entry); return super.createFile(entry); } } @@ -1883,7 +1883,7 @@ class _RepositoryCatapultThirdPartyCoverageDirectory extends _RepositoryDirector @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'NOTICE.txt') - return new _RepositoryCatapultCoverageLicenseFile(this, entry); + return _RepositoryCatapultCoverageLicenseFile(this, entry); return super.createFile(entry); } } @@ -1894,9 +1894,9 @@ class _RepositoryCatapultThirdPartyDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'apiclient') - return new _RepositoryCatapultThirdPartyApiClientDirectory(this, entry); + return _RepositoryCatapultThirdPartyApiClientDirectory(this, entry); if (entry.name == 'coverage') - return new _RepositoryCatapultThirdPartyCoverageDirectory(this, entry); + return _RepositoryCatapultThirdPartyCoverageDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1907,7 +1907,7 @@ class _RepositoryCatapultDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryCatapultThirdPartyDirectory(this, entry); + return _RepositoryCatapultThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1940,7 +1940,7 @@ class _RepositoryDartThirdPartyDirectory extends _RepositoryGenericThirdPartyDir @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'boringssl') - return new _RepositoryBoringSSLDirectory(this, entry); + return _RepositoryBoringSSLDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1951,7 +1951,7 @@ class _RepositoryDartRuntimeDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryDartRuntimeThirdPartyDirectory(this, entry); + return _RepositoryDartRuntimeThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -1965,7 +1965,7 @@ class _RepositoryDartDirectory extends _RepositoryDirectory { @override _RepositoryFile createFile(fs.IoNode entry) { if (entry.name == 'LICENSE') - return new _RepositoryDartLicenseFile(this, entry); + return _RepositoryDartLicenseFile(this, entry); return super.createFile(entry); } @@ -1983,9 +1983,9 @@ class _RepositoryDartDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryDartThirdPartyDirectory(this, entry); + return _RepositoryDartThirdPartyDirectory(this, entry); if (entry.name == 'runtime') - return new _RepositoryDartRuntimeDirectory(this, entry); + return _RepositoryDartRuntimeDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -2014,9 +2014,9 @@ class _RepositoryFlutterDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'sky') - return new _RepositoryExcludeSubpathDirectory(this, entry, const ['packages', 'sky_engine', 'LICENSE']); // that's the output of this script! + return _RepositoryExcludeSubpathDirectory(this, entry, const ['packages', 'sky_engine', 'LICENSE']); // that's the output of this script! if (entry.name == 'third_party') - return new _RepositoryFlutterThirdPartyDirectory(this, entry); + return _RepositoryFlutterThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -2030,7 +2030,7 @@ class _RepositoryFlutterThirdPartyDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'txt') - return new _RepositoryFlutterTxtDirectory(this, entry); + return _RepositoryFlutterTxtDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -2041,7 +2041,7 @@ class _RepositoryFlutterTxtDirectory extends _RepositoryDirectory { @override _RepositoryDirectory createSubdirectory(fs.Directory entry) { if (entry.name == 'third_party') - return new _RepositoryFlutterTxtThirdPartyDirectory(this, entry); + return _RepositoryFlutterTxtThirdPartyDirectory(this, entry); return super.createSubdirectory(entry); } } @@ -2103,9 +2103,9 @@ class _RepositoryRoot extends _RepositoryDirectory { if (entry.name == 'base') throw '//base is no longer part of this client: remove it'; if (entry.name == 'third_party') - return new _RepositoryRootThirdPartyDirectory(this, entry); + return _RepositoryRootThirdPartyDirectory(this, entry); if (entry.name == 'flutter') - return new _RepositoryFlutterDirectory(this, entry); + return _RepositoryFlutterDirectory(this, entry); return super.createSubdirectory(entry); } @@ -2115,7 +2115,7 @@ class _RepositoryRoot extends _RepositoryDirectory { // is therefore represented as a separate top-level component. fs.Directory thirdPartyNode = io.walk.firstWhere((fs.IoNode node) => node.name == 'third_party'); fs.IoNode skiaNode = thirdPartyNode.walk.firstWhere((fs.IoNode node) => node.name == 'skia'); - return <_RepositoryDirectory>[new _RepositorySkiaDirectory(this, skiaNode)]; + return <_RepositoryDirectory>[_RepositorySkiaDirectory(this, skiaNode)]; } } @@ -2125,7 +2125,7 @@ class _Progress { // This may happen when a git client contains left-over empty component // directories after DEPS file changes. if (max <= 0) - throw new ArgumentError('Progress.max must be > 0 but was: $max'); + throw ArgumentError('Progress.max must be > 0 but was: $max'); } final int max; @@ -2154,7 +2154,7 @@ class _Progress { Stopwatch _lastUpdate; void update({bool flush = false}) { if (_lastUpdate == null || _lastUpdate.elapsedMilliseconds > 90 || flush) { - _lastUpdate ??= new Stopwatch(); + _lastUpdate ??= Stopwatch(); final String line = toString(); system.stderr.write('\r$line'); if (_lastLength > line.length) @@ -2176,10 +2176,10 @@ class _Progress { /// Reads the signature from a golden file. Future _readSignature(String goldenPath) async { try { - system.File goldenFile = new system.File(goldenPath); + system.File goldenFile = system.File(goldenPath); String goldenSignature = await goldenFile.openRead() - .transform(utf8.decoder).transform(new LineSplitter()).first; - final RegExp signaturePattern = new RegExp(r'Signature: (\w+)'); + .transform(utf8.decoder).transform(LineSplitter()).first; + final RegExp signaturePattern = RegExp(r'Signature: (\w+)'); Match goldenMatch = signaturePattern.matchAsPrefix(goldenSignature); if (goldenMatch != null) return goldenMatch.group(1); @@ -2204,10 +2204,10 @@ Future _computeLicenseToolChanges(_RepositoryDirectory root, {String golde final fs.Directory flutterNode = root.io.walk.firstWhere((fs.IoNode node) => node.name == 'flutter'); final fs.Directory toolsNode = flutterNode.walk.firstWhere((fs.IoNode node) => node.name == 'tools'); final fs.Directory licenseNode = toolsNode.walk.firstWhere((fs.IoNode node) => node.name == 'licenses'); - final _RepositoryFlutterLicenseToolDirectory licenseToolDirectory = new _RepositoryFlutterLicenseToolDirectory(licenseNode); + final _RepositoryFlutterLicenseToolDirectory licenseToolDirectory = _RepositoryFlutterLicenseToolDirectory(licenseNode); final String toolSignature = await licenseToolDirectory.signature; - system.IOSink sink = new system.File(outputSignaturePath).openWrite(); + system.IOSink sink = system.File(outputSignaturePath).openWrite(); _writeSignature(toolSignature, sink); await sink.close(); @@ -2233,14 +2233,14 @@ Future _collectLicensesForComponent(_RepositoryDirectory componentRoot, { return; } - _Progress progress = new _Progress(componentRoot.fileCount); + _Progress progress = _Progress(componentRoot.fileCount); - system.File outFile = new system.File(outputGoldenPath); + system.File outFile = system.File(outputGoldenPath); system.IOSink sink = outFile.openWrite(); if (writeSignature) _writeSignature(signature, sink); - List licenses = new Set.from(componentRoot.getLicenses(progress).toList()).toList(); + List licenses = Set.from(componentRoot.getLicenses(progress).toList()).toList(); sink.writeln('UNUSED LICENSES:\n'); List unusedLicenses = licenses @@ -2268,7 +2268,7 @@ Future _collectLicensesForComponent(_RepositoryDirectory componentRoot, { // MAIN Future main(List arguments) async { - final ArgParser parser = new ArgParser() + final ArgParser parser = ArgParser() ..addOption('src', help: 'The root of the engine source') ..addOption('out', help: 'The directory where output is written') ..addOption('golden', help: 'The directory containing golden results') @@ -2292,20 +2292,20 @@ Future main(List arguments) async { print(parser.usage); system.exit(1); } - system.Directory out = new system.Directory(argResults['out']); + system.Directory out = system.Directory(argResults['out']); if (!out.existsSync()) out.createSync(recursive: true); } try { system.stderr.writeln('Finding files...'); - fs.FileSystemDirectory rootDirectory = new fs.FileSystemDirectory.fromPath(argResults['src']); - final _RepositoryDirectory root = new _RepositoryRoot(rootDirectory); + fs.FileSystemDirectory rootDirectory = fs.FileSystemDirectory.fromPath(argResults['src']); + final _RepositoryDirectory root = _RepositoryRoot(rootDirectory); if (releaseMode) { system.stderr.writeln('Collecting licenses...'); - _Progress progress = new _Progress(root.fileCount); - List licenses = new Set.from(root.getLicenses(progress).toList()).toList(); + _Progress progress = _Progress(root.fileCount); + List licenses = Set.from(root.getLicenses(progress).toList()).toList(); if (progress.hadErrors) throw 'Had failures while collecting licenses.'; progress.label = 'Dumping results...'; @@ -2347,7 +2347,7 @@ Future main(List arguments) async { // For other components, we need a clean repository that does not // contain any state left over from previous components. clearLicenseRegistry(); - componentRoot = new _RepositoryRoot(rootDirectory).subdirectories + componentRoot = _RepositoryRoot(rootDirectory).subdirectories .firstWhere((_RepositoryDirectory dir) => dir.name == component.name); } diff --git a/engine/src/flutter/tools/licenses/lib/patterns.dart b/engine/src/flutter/tools/licenses/lib/patterns.dart index dde04c5438..68a0acc314 100644 --- a/engine/src/flutter/tools/licenses/lib/patterns.dart +++ b/engine/src/flutter/tools/licenses/lib/patterns.dart @@ -6,30 +6,30 @@ const String kIndent = r'^((?:[-;@# copyrightStatementLeadingPatterns = [ - new RegExp(r'^ *(?:Portions(?: are)? )?Copyright .+$', caseSensitive: false), - new RegExp(r'^.*All rights? reserved\.$', caseSensitive: false), - new RegExp(r'^ *\(C\) .+$', caseSensitive: false), - new RegExp(r'^:copyright: .+$', caseSensitive: false), - new RegExp(r'[-_a-zA-Z0-9()]+ function provided freely by .+'), - new RegExp(r'^.+ optimized code \(C\) COPYRIGHT .+$', caseSensitive: false), - new RegExp(r'©'), + RegExp(r'^ *(?:Portions(?: are)? )?Copyright .+$', caseSensitive: false), + RegExp(r'^.*All rights? reserved\.$', caseSensitive: false), + RegExp(r'^ *\(C\) .+$', caseSensitive: false), + RegExp(r'^:copyright: .+$', caseSensitive: false), + RegExp(r'[-_a-zA-Z0-9()]+ function provided freely by .+'), + RegExp(r'^.+ optimized code \(C\) COPYRIGHT .+$', caseSensitive: false), + RegExp(r'©'), // TODO(ianh): I wish there was a way around including the next few lines so many times in the output: - new RegExp(r"^This file (?:is|was) part of the Independent JPEG Group's software[:.]$"), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code$'), - new RegExp(r'^relevant to libjpeg-turbo\.$'), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code relevant$'), - new RegExp(r'^to libjpeg-turbo\.$'), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code and$'), - new RegExp(r'^information relevant to libjpeg-turbo\.$'), + RegExp(r"^This file (?:is|was) part of the Independent JPEG Group's software[:.]$"), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code$'), + RegExp(r'^relevant to libjpeg-turbo\.$'), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code relevant$'), + RegExp(r'^to libjpeg-turbo\.$'), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code and$'), + RegExp(r'^information relevant to libjpeg-turbo\.$'), ]; // copyright blocks end with the last line that matches this, rest is considered license final List copyrightStatementPatterns = [ - new RegExp(r'^ *(?:Portions(?: created by the Initial Developer)?(?: are)? )?Copyright .+$', caseSensitive: false), - new RegExp(r'^\(Version [-0-9.:, ]+ Copyright .+\)$', caseSensitive: false), - new RegExp(r'^.*(?:All )?rights? reserved\.$', caseSensitive: false), - new RegExp(r'^ *\(C\) .+$', caseSensitive: false), - new RegExp(r'^:copyright: .+$', caseSensitive: false), - new RegExp(r'^ *[0-9][0-9][0-9][0-9].+ [<(].+@.+[)>]$'), - new RegExp(r'^ [^ ].* [<(].+@.+[)>]$'), // that's exactly the number of spaces to line up with the X if "Copyright (c) 2011 X" is on the previous line - new RegExp(r'^ *and .+$', caseSensitive: false), - new RegExp(r'^ *others\.?$', caseSensitive: false), - new RegExp(r'^for more details\.$', caseSensitive: false), - new RegExp(r'^ *For more info read ([^ ]+)$', caseSensitive: false), - new RegExp(r'^(?:Google )?Author\(?s?\)?: .+', caseSensitive: false), - new RegExp(r'^Written by .+', caseSensitive: false), - new RegExp(r'^Based on$', caseSensitive: false), - new RegExp(r"^based on (?:code in )?['`][^'`]+['`]$", caseSensitive: false), - new RegExp(r"^Based on .+, written by .+, [0-9]+\.$", caseSensitive: false), - new RegExp(r'^(?:Based on the )?x86 SIMD extension for IJG JPEG library(?: - version [0-9.]+|,)?$'), - new RegExp(r'^This software originally derived from .+\.$'), - new RegExp(r'^Derived from .+, which was$'), - new RegExp(r'^ *This is part of .+, a .+ library\.$'), - new RegExp(r'^This file is part of [^ ]+\.$'), - new RegExp(r'^(?:Modification )?[Dd]eveloped [-0-9]+ by .+\.$', caseSensitive: false), - new RegExp(r'^Modified .+[:.]$', caseSensitive: false), - new RegExp(r'^(?:[^ ]+ )?Modifications:$', caseSensitive: false), - new RegExp(r'^ *Modifications for', caseSensitive: false), - new RegExp(r'^ *Modifications of', caseSensitive: false), - new RegExp(r'^Last changed in .+$', caseSensitive: false), - new RegExp(r'[-_a-zA-Z0-9()]+ function provided freely by .+'), // TODO(ianh): file a bug on analyzer about what happens if you omit this comma - new RegExp(r'^.+ optimized code \(C\) COPYRIGHT .+$', caseSensitive: false), - new RegExp(r'^\(Royal Institute of Technology, Stockholm, Sweden\)\.$'), - new RegExp(r'^\(?https?://[^ ]+$\)?'), + RegExp(r'^ *(?:Portions(?: created by the Initial Developer)?(?: are)? )?Copyright .+$', caseSensitive: false), + RegExp(r'^\(Version [-0-9.:, ]+ Copyright .+\)$', caseSensitive: false), + RegExp(r'^.*(?:All )?rights? reserved\.$', caseSensitive: false), + RegExp(r'^ *\(C\) .+$', caseSensitive: false), + RegExp(r'^:copyright: .+$', caseSensitive: false), + RegExp(r'^ *[0-9][0-9][0-9][0-9].+ [<(].+@.+[)>]$'), + RegExp(r'^ [^ ].* [<(].+@.+[)>]$'), // that's exactly the number of spaces to line up with the X if "Copyright (c) 2011 X" is on the previous line + RegExp(r'^ *and .+$', caseSensitive: false), + RegExp(r'^ *others\.?$', caseSensitive: false), + RegExp(r'^for more details\.$', caseSensitive: false), + RegExp(r'^ *For more info read ([^ ]+)$', caseSensitive: false), + RegExp(r'^(?:Google )?Author\(?s?\)?: .+', caseSensitive: false), + RegExp(r'^Written by .+', caseSensitive: false), + RegExp(r'^Based on$', caseSensitive: false), + RegExp(r"^based on (?:code in )?['`][^'`]+['`]$", caseSensitive: false), + RegExp(r"^Based on .+, written by .+, [0-9]+\.$", caseSensitive: false), + RegExp(r'^(?:Based on the )?x86 SIMD extension for IJG JPEG library(?: - version [0-9.]+|,)?$'), + RegExp(r'^This software originally derived from .+\.$'), + RegExp(r'^Derived from .+, which was$'), + RegExp(r'^ *This is part of .+, a .+ library\.$'), + RegExp(r'^This file is part of [^ ]+\.$'), + RegExp(r'^(?:Modification )?[Dd]eveloped [-0-9]+ by .+\.$', caseSensitive: false), + RegExp(r'^Modified .+[:.]$', caseSensitive: false), + RegExp(r'^(?:[^ ]+ )?Modifications:$', caseSensitive: false), + RegExp(r'^ *Modifications for', caseSensitive: false), + RegExp(r'^ *Modifications of', caseSensitive: false), + RegExp(r'^Last changed in .+$', caseSensitive: false), + RegExp(r'[-_a-zA-Z0-9()]+ function provided freely by .+'), // TODO(ianh): file a bug on analyzer about what happens if you omit this comma + RegExp(r'^.+ optimized code \(C\) COPYRIGHT .+$', caseSensitive: false), + RegExp(r'^\(Royal Institute of Technology, Stockholm, Sweden\)\.$'), + RegExp(r'^\(?https?://[^ ]+$\)?'), - new RegExp(r'^The Original Code is Mozilla Communicator client code, released$'), - new RegExp(r'^March 31, 1998.$'), // mozilla first release date + RegExp(r'^The Original Code is Mozilla Communicator client code, released$'), + RegExp(r'^March 31, 1998.$'), // mozilla first release date - new RegExp(r'^The Elliptic Curve Public-Key Crypto Library \(ECC Code\) included$'), - new RegExp(r'^herein is developed by SUN MICROSYSTEMS, INC\., and is contributed$'), - new RegExp(r'^to the OpenSSL project\.$'), + RegExp(r'^The Elliptic Curve Public-Key Crypto Library \(ECC Code\) included$'), + RegExp(r'^herein is developed by SUN MICROSYSTEMS, INC\., and is contributed$'), + RegExp(r'^to the OpenSSL project\.$'), - new RegExp(r'^This code is derived from software contributed to The NetBSD Foundation$'), - new RegExp(r'^by (?:Atsushi Onoe|Dieter Baron|Klaus Klein|Luke Mewburn|Thomas Klausner|,| |and)*\.$'), + RegExp(r'^This code is derived from software contributed to The NetBSD Foundation$'), + RegExp(r'^by (?:Atsushi Onoe|Dieter Baron|Klaus Klein|Luke Mewburn|Thomas Klausner|,| |and)*\.$'), - new RegExp(r'^FT_Raccess_Get_HeaderInfo\(\) and raccess_guess_darwin_hfsplus\(\) are$'), - new RegExp(r'^derived from ftobjs\.c\.$'), + RegExp(r'^FT_Raccess_Get_HeaderInfo\(\) and raccess_guess_darwin_hfsplus\(\) are$'), + RegExp(r'^derived from ftobjs\.c\.$'), // TODO(ianh): I wish there was a way around including the next few lines so many times in the output: - new RegExp(r"^This file (?:is|was) part of the Independent JPEG Group's software[:.]$"), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code$'), - new RegExp(r'^relevant to libjpeg-turbo\.$'), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code relevant$'), - new RegExp(r'^to libjpeg-turbo\.$'), - new RegExp(r'^It was modified by The libjpeg-turbo Project to include only code and$'), - new RegExp(r'^information relevant to libjpeg-turbo\.$'), + RegExp(r"^This file (?:is|was) part of the Independent JPEG Group's software[:.]$"), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code$'), + RegExp(r'^relevant to libjpeg-turbo\.$'), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code relevant$'), + RegExp(r'^to libjpeg-turbo\.$'), + RegExp(r'^It was modified by The libjpeg-turbo Project to include only code and$'), + RegExp(r'^information relevant to libjpeg-turbo\.$'), - new RegExp(r'^All or some portions of this file are derived from material licensed$'), - new RegExp(r'^to the University of California by American Telephone and Telegraph$'), - new RegExp(r'^Co\. or Unix System Laboratories, Inc\. and are reproduced herein with$'), - new RegExp(r'^the permission of UNIX System Laboratories, Inc.$'), + RegExp(r'^All or some portions of this file are derived from material licensed$'), + RegExp(r'^to the University of California by American Telephone and Telegraph$'), + RegExp(r'^Co\. or Unix System Laboratories, Inc\. and are reproduced herein with$'), + RegExp(r'^the permission of UNIX System Laboratories, Inc.$'), - new RegExp(r'^This software was developed by the Computer Systems Engineering group$'), - new RegExp(r'^at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and$'), - new RegExp(r'^contributed to Berkeley\.$'), + RegExp(r'^This software was developed by the Computer Systems Engineering group$'), + RegExp(r'^at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and$'), + RegExp(r'^contributed to Berkeley\.$'), - new RegExp(r'^This code is derived from software contributed to Berkeley by$'), - new RegExp(r'^Ralph Campbell\. +This file is derived from the MIPS RISC$'), - new RegExp(r'^Architecture book by Gerry Kane\.$'), + RegExp(r'^This code is derived from software contributed to Berkeley by$'), + RegExp(r'^Ralph Campbell\. +This file is derived from the MIPS RISC$'), + RegExp(r'^Architecture book by Gerry Kane\.$'), - new RegExp(r'^All advertising materials mentioning features or use of this software$'), - new RegExp(r'^must display the following acknowledgement:$'), - new RegExp(r'^This product includes software developed by the University of$'), - new RegExp(r'^California, Lawrence Berkeley Laboratory\.$'), + RegExp(r'^All advertising materials mentioning features or use of this software$'), + RegExp(r'^must display the following acknowledgement:$'), + RegExp(r'^This product includes software developed by the University of$'), + RegExp(r'^California, Lawrence Berkeley Laboratory\.$'), - new RegExp(r'^ *Condition of use and distribution are the same than zlib :$'), - new RegExp(r'^The MIT License:$'), + RegExp(r'^ *Condition of use and distribution are the same than zlib :$'), + RegExp(r'^The MIT License:$'), - new RegExp(r'^$'), // TODO(ianh): file an issue on what happens if you omit the close quote + RegExp(r'^$'), // TODO(ianh): file an issue on what happens if you omit the close quote ]; // patterns that indicate we're running into another license final List licenseFragments = [ - new RegExp(r'"as is" without express or implied warranty\.'), - new RegExp(r'version of this file under any of the LGPL, the MPL or the GPL\.'), - new RegExp(r'SUCH DAMAGE\.'), - new RegExp(r'found in the LICENSE file'), - new RegExp(r''), - new RegExp(r'License & terms of use'), + RegExp(r'"as is" without express or implied warranty\.'), + RegExp(r'version of this file under any of the LGPL, the MPL or the GPL\.'), + RegExp(r'SUCH DAMAGE\.'), + RegExp(r'found in the LICENSE file'), + RegExp(r''), + RegExp(r'License & terms of use'), ]; final String _linebreak = r' *(?:(?:\*/ *|[*#])?(?:\n\1 *(?:\*/ *)?)*\n\1\2 *)?'; @@ -166,15 +166,15 @@ final String _linebreakLoose = r' *(?:(?:\*/ *|[*#])?\n(?:-|;|#|<|!|/|\*| |REM)* // LICENSE RECOGNIZERS -final RegExp lrApache = new RegExp(r'^(?: |\r|\n)*Apache License\b'); -final RegExp lrMPL = new RegExp(r'^(?: |\r|\n)*Mozilla Public License Version 2\.0\n'); -final RegExp lrGPL = new RegExp(r'^(?: |\r|\n)*GNU GENERAL PUBLIC LICENSE\n'); -final RegExp lrAPSL = new RegExp(r'^APPLE PUBLIC SOURCE LICENSE Version 2\.0 +- +August 6, 2003'); -final RegExp lrMIT = new RegExp(r'Permission(?: |\n)+is(?: |\n)+hereby(?: |\n)+granted,(?: |\n)+free(?: |\n)+of(?: |\n)+charge,(?: |\n)+to(?: |\n)+any(?: |\n)+person(?: |\n)+obtaining(?: |\n)+a(?: |\n)+copy(?: |\n)+of(?: |\n)+this(?: |\n)+software(?: |\n)+and(?: |\n)+associated(?: |\n)+documentation(?: |\n)+files(?: |\n)+\(the(?: |\n)+"Software"\),(?: |\n)+to(?: |\n)+deal(?: |\n)+in(?: |\n)+the(?: |\n)+Software(?: |\n)+without(?: |\n)+restriction,(?: |\n)+including(?: |\n)+without(?: |\n)+limitation(?: |\n)+the(?: |\n)+rights(?: |\n)+to(?: |\n)+use,(?: |\n)+copy,(?: |\n)+modify,(?: |\n)+merge,(?: |\n)+publish,(?: |\n)+distribute,(?: |\n)+sublicense,(?: |\n)+and/or(?: |\n)+sell(?: |\n)+copies(?: |\n)+of(?: |\n)+the(?: |\n)+Software,(?: |\n)+and(?: |\n)+to(?: |\n)+permit(?: |\n)+persons(?: |\n)+to(?: |\n)+whom(?: |\n)+the(?: |\n)+Software(?: |\n)+is(?: |\n)+furnished(?: |\n)+to(?: |\n)+do(?: |\n)+so,(?: |\n)+subject(?: |\n)+to(?: |\n)+the(?: |\n)+following(?: |\n)+conditions:'); -final RegExp lrOpenSSL = new RegExp(r'Copyright \(c\) 1998-2011 The OpenSSL Project\. All rights reserved\.(.|\n)*Original SSLeay License'); -final RegExp lrBSD = new RegExp(r'Redistribution(?: |\n)+and(?: |\n)+use(?: |\n)+in(?: |\n)+source(?: |\n)+and(?: |\n)+binary(?: |\n)+forms(?:(?: |\n)+of(?: |\n)+the(?: |\n)+software(?: |\n)+as(?: |\n)+well(?: |\n)+as(?: |\n)+documentation)?,(?: |\n)+with(?: |\n)+or(?: |\n)+without(?: |\n)+modification,(?: |\n)+are(?: |\n)+permitted(?: |\n)+provided(?: |\n)+that(?: |\n)+the(?: |\n)+following(?: |\n)+conditions(?: |\n)+are(?: |\n)+met:'); -final RegExp lrZlib = new RegExp(r'Permission(?: |\n)+is(?: |\n)+granted(?: |\n)+to(?: |\n)+anyone(?: |\n)+to(?: |\n)+use(?: |\n)+this(?: |\n)+software(?: |\n)+for(?: |\n)+any(?: |\n)+purpose,(?: |\n)+including(?: |\n)+commercial(?: |\n)+applications,(?: |\n)+and(?: |\n)+to(?: |\n)+alter(?: |\n)+it(?: |\n)+and(?: |\n)+redistribute(?: |\n)+it(?: |\n)+freely,(?: |\n)+subject(?: |\n)+to(?: |\n)+the(?: |\n)+following(?: |\n)+restrictions:'); -final RegExp lrPNG = new RegExp(r'This code is released under the libpng license\.'); +final RegExp lrApache = RegExp(r'^(?: |\r|\n)*Apache License\b'); +final RegExp lrMPL = RegExp(r'^(?: |\r|\n)*Mozilla Public License Version 2\.0\n'); +final RegExp lrGPL = RegExp(r'^(?: |\r|\n)*GNU GENERAL PUBLIC LICENSE\n'); +final RegExp lrAPSL = RegExp(r'^APPLE PUBLIC SOURCE LICENSE Version 2\.0 +- +August 6, 2003'); +final RegExp lrMIT = RegExp(r'Permission(?: |\n)+is(?: |\n)+hereby(?: |\n)+granted,(?: |\n)+free(?: |\n)+of(?: |\n)+charge,(?: |\n)+to(?: |\n)+any(?: |\n)+person(?: |\n)+obtaining(?: |\n)+a(?: |\n)+copy(?: |\n)+of(?: |\n)+this(?: |\n)+software(?: |\n)+and(?: |\n)+associated(?: |\n)+documentation(?: |\n)+files(?: |\n)+\(the(?: |\n)+"Software"\),(?: |\n)+to(?: |\n)+deal(?: |\n)+in(?: |\n)+the(?: |\n)+Software(?: |\n)+without(?: |\n)+restriction,(?: |\n)+including(?: |\n)+without(?: |\n)+limitation(?: |\n)+the(?: |\n)+rights(?: |\n)+to(?: |\n)+use,(?: |\n)+copy,(?: |\n)+modify,(?: |\n)+merge,(?: |\n)+publish,(?: |\n)+distribute,(?: |\n)+sublicense,(?: |\n)+and/or(?: |\n)+sell(?: |\n)+copies(?: |\n)+of(?: |\n)+the(?: |\n)+Software,(?: |\n)+and(?: |\n)+to(?: |\n)+permit(?: |\n)+persons(?: |\n)+to(?: |\n)+whom(?: |\n)+the(?: |\n)+Software(?: |\n)+is(?: |\n)+furnished(?: |\n)+to(?: |\n)+do(?: |\n)+so,(?: |\n)+subject(?: |\n)+to(?: |\n)+the(?: |\n)+following(?: |\n)+conditions:'); +final RegExp lrOpenSSL = RegExp(r'Copyright \(c\) 1998-2011 The OpenSSL Project\. All rights reserved\.(.|\n)*Original SSLeay License'); +final RegExp lrBSD = RegExp(r'Redistribution(?: |\n)+and(?: |\n)+use(?: |\n)+in(?: |\n)+source(?: |\n)+and(?: |\n)+binary(?: |\n)+forms(?:(?: |\n)+of(?: |\n)+the(?: |\n)+software(?: |\n)+as(?: |\n)+well(?: |\n)+as(?: |\n)+documentation)?,(?: |\n)+with(?: |\n)+or(?: |\n)+without(?: |\n)+modification,(?: |\n)+are(?: |\n)+permitted(?: |\n)+provided(?: |\n)+that(?: |\n)+the(?: |\n)+following(?: |\n)+conditions(?: |\n)+are(?: |\n)+met:'); +final RegExp lrZlib = RegExp(r'Permission(?: |\n)+is(?: |\n)+granted(?: |\n)+to(?: |\n)+anyone(?: |\n)+to(?: |\n)+use(?: |\n)+this(?: |\n)+software(?: |\n)+for(?: |\n)+any(?: |\n)+purpose,(?: |\n)+including(?: |\n)+commercial(?: |\n)+applications,(?: |\n)+and(?: |\n)+to(?: |\n)+alter(?: |\n)+it(?: |\n)+and(?: |\n)+redistribute(?: |\n)+it(?: |\n)+freely,(?: |\n)+subject(?: |\n)+to(?: |\n)+the(?: |\n)+following(?: |\n)+restrictions:'); +final RegExp lrPNG = RegExp(r'This code is released under the libpng license\.'); // "NO COPYRIGHT" STATEMENTS @@ -185,14 +185,14 @@ final List csNoCopyrights = [ // groups are ignored // Seen in Expat files - new RegExp( + RegExp( r'^// No copyright notice; this file based on autogenerated header', multiLine: true, caseSensitive: false ), // Seen in Android NDK - new RegExp( + RegExp( r'^[/* ]*This header was automatically generated from a Linux kernel header\n' r'^[/* ]*of the same name, to make information necessary for userspace to\n' r'^[/* ]*call into the kernel available to libc. It contains only constants,\n' @@ -202,7 +202,7 @@ final List csNoCopyrights = [ caseSensitive: false ), - new RegExp( + RegExp( kIndent + r'These constants were taken from version 3 of the DWARF standard, *\n' r'^\1\2which is Copyright \(c\) 2005 Free Standards Group, and *\n' @@ -212,7 +212,7 @@ final List csNoCopyrights = [ ), // Freetype - new RegExp( + RegExp( kIndent + (r'This is a dummy file, used to please the build system\. It is never included by the auto-fitter sources\.'.replaceAll(' ', _linebreak)), multiLine: true, @@ -220,7 +220,7 @@ final List csNoCopyrights = [ ), // Freetype - new RegExp( + RegExp( kIndent + ( r'This software was written by Alexander Peslyak in 2001\. No copyright is ' @@ -248,7 +248,7 @@ final List csAttribution = [ // group 1 is the prefix, group 2 is the attribution // Seen in musl in Android SDK - new RegExp( + RegExp( r'^([/* ]*)This code was written by (.+) in [0-9]+; no copyright is claimed\.\n' r'^\1This code is in the public domain\. +Attribution is appreciated but\n' r'^\1unnecessary\.', @@ -277,12 +277,12 @@ final List csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByFilename = csReferencesByType = [ // groups 1 and 2 are the prefix, group 3 is the license type // Seen in Jinja files, markupsafe files - new RegExp( + RegExp( kIndent + r':license: ([A-Z0-9]+)', multiLine: true, caseSensitive: false ), - new RegExp( + RegExp( kIndent + r'This software is made available under the terms of the (ICU) License -- ICU 1\.\8\.1 and later\.'.replaceAll(' ', _linebreak), multiLine: true, caseSensitive: false ), - new RegExp( + RegExp( kIndent + ( r'(?:@APPLE_LICENSE_HEADER_START@)? ' @@ -557,7 +557,7 @@ final List csReferencesByTypeNoCopyright = [ // used with _tryReferenceByType // groups 1 and 2 are the prefix, group 3 is the license type - new RegExp( + RegExp( kIndent + r'Written by Andy Polyakov for the OpenSSL ' r'project\. The module is, however, dual licensed under (OpenSSL) and ' @@ -585,13 +585,13 @@ final List csReferencesByUrl = [3], versionIndicies: const { 3:4 }, checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Licensed under the (Academic Free License) version (3\.0)', multiLine: true, caseSensitive: false, @@ -600,12 +600,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( r'^(?:[-;# csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Licensed under the Apache License, Version 2\.0 \(the "License"\); *\n' r'^\1\2you may not use this file except in compliance with the License\. *\n' @@ -648,12 +648,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Use of this source code is governed by a BS?D-style *\n' r'^\1\2license that can be found in the LICENSE file or at *\n' @@ -665,12 +665,12 @@ final List csReferencesByUrl = / thing is someone being over-eager with search-and-replace in rapidjson - new MultipleVersionedLicenseReferencePattern( + MultipleVersionedLicenseReferencePattern( firstPrefixIndex: 1, indentPrefixIndex: 2, licenseIndices: const [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Licensed under the MIT License \(the "License"\); you may not use this file except *\n' r'^\1\2in compliance with the License(?:\.|->) You may obtain a copy of the License at *\n' @@ -687,12 +687,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This code may only be used under the BSD style license found at (http://polymer.github.io/LICENSE.txt)$', multiLine: true, @@ -701,13 +701,13 @@ final List csReferencesByUrl = [3], versionIndicies: const {3:4}, checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is dual licensed. +It may be redistributed and/or modified *\n' r'^\1\2under the terms of the (Apache) (2\.0) License OR version 2 of the GNU *\n' @@ -719,12 +719,12 @@ final List csReferencesByUrl = [5, 6], versionIndicies: const {5:3, 6:4}, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is part of the GNU ISO C\+\+ Library\. +This library is free *\n' r'^\1\2software; you can redistribute _?_?it and/or modify _?_?it under the terms *\n' @@ -752,12 +752,12 @@ final List csReferencesByUrl = [5, 6], versionIndicies: const {5:3, 6:4}, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is part of the GNU ISO C\+\+ Library\. +This library is free *\n' r'^\1\2software; you can redistribute it and/or modify it under the *\n' @@ -785,12 +785,12 @@ final List csReferencesByUrl = [6, 4], versionIndicies: const {6:3, 4:5}, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is part of the GNU ISO C\+\+ Library\. +This library is free *\n' r'^\1\2software; you can redistribute it and/or modify it under the *\n' @@ -817,12 +817,12 @@ final List csReferencesByUrl = [5, 6], versionIndicies: const {5:3, 6:4}, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is part of GCC. *\n' r'^(?:(?:\1\2? *)? *\n)*' @@ -851,12 +851,12 @@ final List csReferencesByUrl = [5, 6], versionIndicies: const { 5:3, 6:4 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This file is part of GCC. *\n' r'^(?:(?:\1\2? *)? *\n)*' @@ -885,12 +885,12 @@ final List csReferencesByUrl = [4], versionIndicies: const { 4:3 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This library is free software; you can redistribute it and/or *\n' r'^\1\2modify it under the terms of the GNU Library General Public *\n' @@ -913,12 +913,12 @@ final List csReferencesByUrl = [4], versionIndicies: const { 4:3 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Licensed under the Academic Free License version 2.0 *\n' r'^\1\2Or under the following terms: *\n' @@ -944,12 +944,12 @@ final List csReferencesByUrl = [4], versionIndicies: const { 4:3 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This Source Code Form is subject to the terms of the Mozilla Public *\n' r'^\1\2License, v\. (2.0)\. +If a copy of the MPL was not distributed with this *\n' @@ -961,12 +961,12 @@ final List csReferencesByUrl = [3], versionIndicies: const { 3:4 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'(?:Version: [GMPL/012. ]+ *\n' r'^(?:(?:\1\2? *)? *\n)*' @@ -1015,12 +1015,12 @@ final List csReferencesByUrl = [4], versionIndicies: const { 4:3 }, - pattern: new RegExp( + pattern: RegExp( kIndent + r'This library is free software; you can redistribute it and/or *\n' r'^\1\2modify it under the terms of the GNU Lesser General Public *\n' @@ -1055,12 +1055,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'(?:©|Copyright \(C\)) 20.. and later: Unicode, Inc. and others.[ *]*\n' r'^\1\2License & terms of use: (http://www.unicode.org/copyright.html)', @@ -1070,12 +1070,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'Copyright \(C\) 2016 and later: Unicode, Inc. and others. License & terms of use: (http://www.unicode.org/copyright.html) *\n', multiLine: true, @@ -1084,12 +1084,12 @@ final List csReferencesByUrl = [3], checkLocalFirst: false, - pattern: new RegExp( + pattern: RegExp( kIndent + r'© 2016 and later: Unicode, Inc. and others. *\n' r'^ *License & terms of use: (http://www.unicode.org/copyright.html)#License *\n' @@ -1110,7 +1110,7 @@ final List csLicenses = [ // should have two groups, prefixes 1 and 2 // BoringSSL - new RegExp( + RegExp( kIndent + r'Redistribution and use in source and binary forms, with or without *\n' r'^\1\2modification, are permitted provided that the following conditions *\n' @@ -1159,7 +1159,7 @@ final List csLicenses = [ caseSensitive: false ), - new RegExp( + RegExp( kIndent + r'(?:This package is an SSL implementation written *\n' r'^\1\2by Eric Young \(eay@cryptsoft\.com\)\. *\n' @@ -1217,7 +1217,7 @@ final List csLicenses = [ caseSensitive: false ), - new RegExp( + RegExp( kIndent + ( r'License to copy and use this software is granted provided that it ' @@ -1242,7 +1242,7 @@ final List csLicenses = [ // BSD-DERIVED LICENSES - new RegExp( + RegExp( kIndent + ( 'Redistribution and use in source and binary forms, with or without ' @@ -1380,7 +1380,7 @@ final List csLicenses = [ // Seen in libjpeg-turbo // TODO(ianh): Mark License as not needing to be shown - new RegExp( + RegExp( kIndent + r"This software is provided 'as-is', without any express or implied *\n" r'^\1\2warranty\. +In no event will the authors be held liable for any damages *\n' @@ -1402,7 +1402,7 @@ final List csLicenses = [ ), // seen in GLFW - new RegExp( + RegExp( kIndent + r"This software is provided 'as-is', without any express or implied *\n" r'^\1\2warranty\. +In no event will the authors be held liable for any damages *\n' @@ -1430,7 +1430,7 @@ final List csLicenses = [ // MIT-DERIVED LICENSES // Seen in Mesa - new RegExp( + RegExp( kIndent + ( r'Permission is hereby granted, free of charge, to any person obtaining ' @@ -1503,7 +1503,7 @@ final List csLicenses = [ // OTHER BRIEF LICENSES - new RegExp( + RegExp( kIndent + r'Permission to use, copy, modify, and distribute this software for any *\n' r'^(?:\1\2)?purpose with or without fee is hereby granted, provided that the above *\n' @@ -1525,7 +1525,7 @@ final List csLicenses = [ ), // Seen in the NDK - new RegExp( + RegExp( kIndent + r'Permission to use, copy, modify, and/or distribute this software for any *\n' r'^\1\2purpose with or without fee is hereby granted, provided that the above *\n' @@ -1543,7 +1543,7 @@ final List csLicenses = [ ), // seen in GLFW - new RegExp( + RegExp( kIndent + r'Permission to use, copy, modify, and distribute this software for any *\n' r'^\1\2purpose with or without fee is hereby granted, provided that the above *\n' @@ -1558,7 +1558,7 @@ final List csLicenses = [ ), // seen in GLFW, base - new RegExp( + RegExp( kIndent + r'Permission to use, copy, modify, and distribute this software for any *\n' r'^\1\2purpose without fee is hereby granted, provided that this entire notice *\n' @@ -1575,7 +1575,7 @@ final List csLicenses = [ ), // harfbuzz - new RegExp( + RegExp( kIndent + r'Permission is hereby granted, without written agreement and without *\n' r'^\1\2license or royalty fees, to use, copy, modify, and distribute this *\n' @@ -1599,7 +1599,7 @@ final List csLicenses = [ ), // NDK - new RegExp( + RegExp( kIndent + r'Permission to use, copy, modify and distribute this software and *\n' r'^\1\2its documentation is hereby granted, provided that both the copyright *\n' @@ -1625,7 +1625,7 @@ final List csLicenses = [ ), // seen in Android NDK gnu-libstdc++ - new RegExp( + RegExp( kIndent + ( r'Permission to use, copy, modify, (?:distribute and sell|sell, and distribute) this software ' @@ -1647,7 +1647,7 @@ final List csLicenses = [ ), // Seen in Android NDK - new RegExp( + RegExp( kIndent + r'Developed at (?:SunPro|SunSoft), a Sun Microsystems, Inc. business. *\n' r'^\1\2Permission to use, copy, modify, and distribute this *\n' @@ -1658,7 +1658,7 @@ final List csLicenses = [ ), // Seen in Android NDK (stlport) - new RegExp( + RegExp( kIndent + r'This material is provided "as is", with absolutely no warranty expressed *\n' r'^\1\2or implied\. +Any use is at your own risk\. *\n' @@ -1673,7 +1673,7 @@ final List csLicenses = [ ), // freetype2. - new RegExp( + RegExp( kIndent + ( r'Permission to use, copy, modify, distribute, and sell this software and its ' @@ -1700,7 +1700,7 @@ final List csLicenses = [ // TODO(ianh): File a bug on what happens if you replace the // with a # // ICU - new RegExp( + RegExp( kIndent + r'This file is provided as-is by Unicode, Inc\. \(The Unicode Consortium\)\. ' r'No claims are made as to fitness for any particular purpose\. No ' @@ -1720,7 +1720,7 @@ final List csLicenses = [ ), // OpenSSL - new RegExp( + RegExp( kIndent + r'The portions of the attached software \("Contribution"\) is developed by *\n' r'^\1\2Nokia Corporation and is licensed pursuant to the OpenSSL open source *\n' @@ -1755,7 +1755,7 @@ final List csNotices = [ // used with _tryInline, with needsCopyright: false // should have two groups, prefixes 1 and 2 - new RegExp( + RegExp( kIndent + r'The Graphics Interchange Format\(c\) is the copyright property of CompuServe *\n' r'^\1\2Incorporated\. +Only CompuServe Incorporated is authorized to define, redefine, *\n' @@ -1783,7 +1783,7 @@ final List csNotices = [ // NSPR // (Showing the entire block instead of the LGPL for this file is based // on advice specifically regarding the prtime.cc file.) - new RegExp( + RegExp( r'()()/\* Portions are Copyright \(C\) 2011 Google Inc \*/\n' r'/\* \*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*\n' r' \* Version: MPL 1\.1/GPL 2\.0/LGPL 2\.1\n' @@ -1823,7 +1823,7 @@ final List csNotices = [ ), // Advice for this was "text verbatim". - new RegExp( + RegExp( kIndent + r'Copyright \(c\) 2015-2016 Khronos Group\. This work is licensed under a\n' r'\1\2Creative Commons Attribution 4\.0 International License; see\n' @@ -1834,7 +1834,7 @@ final List csNotices = [ // by analogy to the above one // seen in jsr305 - new RegExp( + RegExp( kIndent + r'Copyright .+\n' r'\1\2Released under the Creative Commons Attribution License\n' @@ -1845,7 +1845,7 @@ final List csNotices = [ ), // Advice for this was "Just display its text as a politeness. Nothing else required". - new RegExp( + RegExp( r'()()/\* mdXhl\.c \* ----------------------------------------------------------------------------\n' r' \* "THE BEER-WARE LICENSE" \(Revision 42\):\n' r' \* wrote this file\. +As long as you retain this notice you\n' @@ -1885,10 +1885,10 @@ final List csForwardReferenceLicenses = csForwardReferenceLicenses =