diff --git a/ci/licenses_golden/excluded_files b/ci/licenses_golden/excluded_files index 88babb795dcb8..610d517ed482a 100644 --- a/ci/licenses_golden/excluded_files +++ b/ci/licenses_golden/excluded_files @@ -202,7 +202,6 @@ ../../../flutter/impeller/tessellator/tessellator_unittests.cc ../../../flutter/impeller/toolkit/android/README.md ../../../flutter/impeller/toolkit/android/toolkit_android_unittests.cc -../../../flutter/impeller/tools/check_licenses.py ../../../flutter/impeller/tools/malioc_cores.py ../../../flutter/impeller/tools/malioc_diff.py ../../../flutter/impeller/tools/metal_library.py diff --git a/impeller/tools/check_licenses.py b/impeller/tools/check_licenses.py deleted file mode 100644 index 58e6ef0d2b379..0000000000000 --- a/impeller/tools/check_licenses.py +++ /dev/null @@ -1,76 +0,0 @@ -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os - - -def contains_license_block(source_file): - # This check is somewhat easier than in the engine because all sources need to - # have the same license. - py_license = """# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file.""" - c_license = py_license.replace('#', '//') - - # Make sure we don't read the entire file into memory. - read_size = (max(len(py_license), len(c_license))) - - for lic in [c_license, py_license]: - with open(source_file) as source: - if source.read(read_size).startswith(lic): - return True - - return False - - -def is_source_file(path): - known_extensions = [ - '.cc', - '.cpp', - '.c', - '.h', - '.hpp', - '.py', - '.sh', - '.gn', - '.gni', - '.glsl', - '.sl.h', - '.vert', - '.frag', - '.tesc', - '.tese', - '.yaml', - '.dart', - ] - for extension in known_extensions: - if os.path.basename(path).endswith(extension): - return True - return False - - -# Checks that all source files have the same license preamble. -def main(): - parser = argparse.ArgumentParser() - parser.add_argument('--source-root', type=str, required=True, help='The source root.') - args = parser.parse_args() - - assert os.path.exists(args.source_root) - - source_files = set() - - for root, _, files in os.walk(os.path.abspath(args.source_root)): - for file in files: - file_path = os.path.join(root, file) - if is_source_file(file_path): - source_files.add(file_path) - - for source_file in source_files: - if not contains_license_block(source_file): - raise Exception('Could not find valid license block in source ', source_file) - - -if __name__ == '__main__': - main()