未验证 提交 b6f76e07 编写于 作者: M Michael Goderbauer 提交者: GitHub

Delete unused license goldens and add check (#6784)

上级 70a1106b
此差异已折叠。
Signature: c6853c1bbc8db501fa71fb05acb5f2ba
UNUSED LICENSES:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
USED LICENSES:
====================================================================================================
LIBRARY: lib
ORIGIN: ../../../garnet/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../lib/tonic/dart_list.cc
FILE: ../../../lib/tonic/dart_list.h
----------------------------------------------------------------------------------------------------
Copyright 2017 The Fuchsia Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
====================================================================================================
LIBRARY: lib
ORIGIN: ../../../lib/tonic/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../lib/tonic/converter/dart_converter.cc
FILE: ../../../lib/tonic/converter/dart_converter.h
FILE: ../../../lib/tonic/dart_message_handler.cc
FILE: ../../../lib/tonic/dart_message_handler.h
FILE: ../../../lib/tonic/dart_microtask_queue.cc
FILE: ../../../lib/tonic/dart_microtask_queue.h
FILE: ../../../lib/tonic/dart_sticky_error.cc
FILE: ../../../lib/tonic/dart_sticky_error.h
FILE: ../../../lib/tonic/debugger/dart_debugger.cc
FILE: ../../../lib/tonic/debugger/dart_debugger.h
FILE: ../../../lib/tonic/file_loader/file_loader.cc
FILE: ../../../lib/tonic/file_loader/file_loader.h
FILE: ../../../lib/tonic/logging/dart_error.cc
FILE: ../../../lib/tonic/logging/dart_error.h
FILE: ../../../lib/tonic/logging/dart_invoke.cc
FILE: ../../../lib/tonic/logging/dart_invoke.h
FILE: ../../../lib/tonic/parsers/packages_map.cc
FILE: ../../../lib/tonic/parsers/packages_map.h
FILE: ../../../lib/tonic/scopes/dart_api_scope.h
FILE: ../../../lib/tonic/scopes/dart_isolate_scope.cc
FILE: ../../../lib/tonic/scopes/dart_isolate_scope.h
FILE: ../../../lib/tonic/typed_data/dart_byte_data.h
FILE: ../../../lib/tonic/typed_data/int32_list.h
FILE: ../../../lib/tonic/typed_data/uint8_list.h
----------------------------------------------------------------------------------------------------
Copyright 2016 The Fuchsia Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
====================================================================================================
LIBRARY: lib
ORIGIN: ../../../lib/tonic/typed_data/dart_byte_data.cc + ../../../lib/tonic/LICENSE
TYPE: LicenseType.bsd
FILE: ../../../lib/tonic/dart_args.h
FILE: ../../../lib/tonic/dart_binding_macros.h
FILE: ../../../lib/tonic/dart_class_library.cc
FILE: ../../../lib/tonic/dart_class_library.h
FILE: ../../../lib/tonic/dart_class_provider.cc
FILE: ../../../lib/tonic/dart_class_provider.h
FILE: ../../../lib/tonic/dart_library_natives.cc
FILE: ../../../lib/tonic/dart_library_natives.h
FILE: ../../../lib/tonic/dart_persistent_value.cc
FILE: ../../../lib/tonic/dart_persistent_value.h
FILE: ../../../lib/tonic/dart_state.cc
FILE: ../../../lib/tonic/dart_state.h
FILE: ../../../lib/tonic/dart_wrappable.cc
FILE: ../../../lib/tonic/dart_wrappable.h
FILE: ../../../lib/tonic/dart_wrapper_info.h
FILE: ../../../lib/tonic/typed_data/dart_byte_data.cc
FILE: ../../../lib/tonic/typed_data/float32_list.cc
FILE: ../../../lib/tonic/typed_data/float32_list.h
FILE: ../../../lib/tonic/typed_data/float64_list.cc
FILE: ../../../lib/tonic/typed_data/float64_list.h
FILE: ../../../lib/tonic/typed_data/int32_list.cc
FILE: ../../../lib/tonic/typed_data/uint8_list.cc
----------------------------------------------------------------------------------------------------
Copyright 2015 The Fuchsia Authors. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
====================================================================================================
Total license count: 3
......@@ -2423,6 +2423,7 @@ Future<Null> main(List<String> arguments) async {
} else {
RegExp signaturePattern = new RegExp(r'Signature: (\w+)');
final List<String> usedGoldens = <String>[];
bool isFirstComponent = true;
for (RepositoryDirectory component in root.subdirectories) {
system.stderr.writeln('Collecting licenses for ${component.io.name}');
......@@ -2441,10 +2442,11 @@ Future<Null> main(List<String> arguments) async {
// Check whether the golden file matches the signature of the current contents
// of this directory.
try {
system.File goldenFile = new system.File(
path.join(argResults['golden'], 'licenses_${component.io.name}'));
final String goldenFileName = 'licenses_${component.io.name}';
system.File goldenFile = new system.File(path.join(argResults['golden'], goldenFileName));
String goldenSignature = await goldenFile.openRead()
.transform(utf8.decoder).transform(new LineSplitter()).first;
usedGoldens.add(goldenFileName);
Match goldenMatch = signaturePattern.matchAsPrefix(goldenSignature);
if (goldenMatch != null && goldenMatch.group(1) == signature) {
system.stderr.writeln(' Skipping this component - no change in signature');
......@@ -2500,6 +2502,14 @@ Future<Null> main(List<String> arguments) async {
progress.flush();
system.stderr.writeln('');
}
final Set<String> unusedGoldens = system.Directory(argResults['golden']).listSync().map((system.FileSystemEntity file) => path.basename(file.path)).toSet()
..removeAll(usedGoldens);
if (unusedGoldens.isNotEmpty) {
system.stderr.writeln('The following golden files in ${argResults['golden']} are unused and need to be deleted:');
unusedGoldens.map((String s) => ' * $s').forEach(system.stderr.writeln);
system.exit(1);
}
}
} catch (e, stack) {
system.stderr.writeln('failure: $e\n$stack');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册