@@ -52,10 +52,14 @@ const Set<String> _ignoredFullBasenameList = <String>{
52
52
final List <RegExp > _thirdPartyLicenseBlockRegexes = < RegExp > [
53
53
// Third-party code used in url_launcher_web.
54
54
RegExp (
55
- r'^// Copyright 2017 Workiva Inc..*'
56
- '^// Licensed under the Apache License, Version 2.0' ,
55
+ r'^// Copyright 2017 Workiva Inc\ ..*'
56
+ r '^// Licensed under the Apache License, Version 2\ .0' ,
57
57
multiLine: true ,
58
58
dotAll: true ),
59
+ // bsdiff in flutter/packages.
60
+ RegExp (r'// Copyright 2003-2005 Colin Percival\. All rights reserved\.\n'
61
+ r'// Use of this source code is governed by a BSD-style license that can be\n'
62
+ r'// found in the LICENSE file\.\n' ),
59
63
];
60
64
61
65
// The exact format of the BSD license that our license files should contain.
@@ -158,16 +162,19 @@ class LicenseCheckCommand extends PluginCommand {
158
162
_print ('Checking ${file .path }' );
159
163
final String content = await file.readAsString ();
160
164
165
+ final String firstParyLicense =
166
+ firstPartyLicenseBlockByExtension[p.extension (file.path)] ??
167
+ defaultFirstParyLicenseBlock;
161
168
if (_isThirdParty (file)) {
169
+ // Third-party directories allow either known third-party licenses, our
170
+ // the first-party license, as there may be local additions.
162
171
if (! _thirdPartyLicenseBlockRegexes
163
- .any ((RegExp regex) => regex.hasMatch (content))) {
172
+ .any ((RegExp regex) => regex.hasMatch (content)) &&
173
+ ! content.contains (firstParyLicense)) {
164
174
unrecognizedThirdPartyFiles.add (file);
165
175
}
166
176
} else {
167
- final String license =
168
- firstPartyLicenseBlockByExtension[p.extension (file.path)] ??
169
- defaultFirstParyLicenseBlock;
170
- if (! content.contains (license)) {
177
+ if (! content.contains (firstParyLicense)) {
171
178
incorrectFirstPartyFiles.add (file);
172
179
}
173
180
}
0 commit comments