diff --git a/engine/src/flutter/impeller/fixtures/sample.vert b/engine/src/flutter/impeller/fixtures/sample.vert index ba455ccb866..2c1e03a481d 100644 --- a/engine/src/flutter/impeller/fixtures/sample.vert +++ b/engine/src/flutter/impeller/fixtures/sample.vert @@ -1,3 +1,7 @@ +// 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. + #include "types.h" uniform UniformBufferObject { diff --git a/engine/src/flutter/impeller/geometry/BUILD.gn b/engine/src/flutter/impeller/geometry/BUILD.gn index becb1677f99..cc3bad32b8b 100644 --- a/engine/src/flutter/impeller/geometry/BUILD.gn +++ b/engine/src/flutter/impeller/geometry/BUILD.gn @@ -8,6 +8,8 @@ impeller_component("geometry") { sources = [ "color.cc", "color.h", + "constants.cc", + "constants.h", "matrix.cc", "matrix.h", "matrix_decomposition.cc", diff --git a/engine/src/flutter/impeller/geometry/constants.cc b/engine/src/flutter/impeller/geometry/constants.cc index e69de29bb2d..115a24da4a3 100644 --- a/engine/src/flutter/impeller/geometry/constants.cc +++ b/engine/src/flutter/impeller/geometry/constants.cc @@ -0,0 +1,11 @@ +// 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. + +#include "impeller/geometry/constants.h" + +namespace impeller { + +// + +} // namespace impeller diff --git a/engine/src/flutter/impeller/playground/imgui/BUILD.gn b/engine/src/flutter/impeller/playground/imgui/BUILD.gn index 9f1e0d3b89d..c56377f7301 100644 --- a/engine/src/flutter/impeller/playground/imgui/BUILD.gn +++ b/engine/src/flutter/impeller/playground/imgui/BUILD.gn @@ -1,3 +1,7 @@ +# 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("//flutter/impeller/tools/impeller.gni") impeller_shaders("imgui_shaders") { diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc index 0d898b151a2..245397fc0f4 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.cc @@ -1,3 +1,7 @@ +// 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. + #include "imgui_impl_impeller.h" #include diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h index ffdaaa072d5..585e8b2f2df 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h +++ b/engine/src/flutter/impeller/playground/imgui/imgui_impl_impeller.h @@ -1,3 +1,7 @@ +// 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. + #pragma once #include @@ -5,8 +9,10 @@ #include "third_party/imgui/imgui.h" namespace impeller { + class Context; class RenderPass; + } // namespace impeller IMGUI_IMPL_API bool ImGui_ImplImpeller_Init( diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_raster.frag b/engine/src/flutter/impeller/playground/imgui/imgui_raster.frag index 890a7842458..f159e20d698 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_raster.frag +++ b/engine/src/flutter/impeller/playground/imgui/imgui_raster.frag @@ -1,3 +1,7 @@ +// 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. + in vec2 frag_texture_coordinates; in vec4 frag_vertex_color; diff --git a/engine/src/flutter/impeller/playground/imgui/imgui_raster.vert b/engine/src/flutter/impeller/playground/imgui/imgui_raster.vert index 391c14eb3d0..1afd7900225 100644 --- a/engine/src/flutter/impeller/playground/imgui/imgui_raster.vert +++ b/engine/src/flutter/impeller/playground/imgui/imgui_raster.vert @@ -1,3 +1,7 @@ +// 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. + uniform UniformBuffer { mat4 mvp; } diff --git a/engine/src/flutter/impeller/tools/check_licenses.py b/engine/src/flutter/impeller/tools/check_licenses.py new file mode 100644 index 00000000000..50dc9210122 --- /dev/null +++ b/engine/src/flutter/impeller/tools/check_licenses.py @@ -0,0 +1,77 @@ +# 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 ContainsLicenseBlock(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 license in [c_license, py_license]: + with open(source_file) as source: + if source.read(read_size).startswith(license): + return True + + return False + + +def IsSourceFile(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, dirs, files in os.walk(os.path.abspath(args.source_root)): + for file in files: + file_path = os.path.join(root, file) + if IsSourceFile(file_path): + source_files.add(file_path) + + for source_file in source_files: + if not ContainsLicenseBlock(source_file): + raise Exception("Could not find valid license block in source ", source_file) + +if __name__ == '__main__': + Main()