forked from firka/flutter
Embed a license readme in every zip archive (flutter/engine#43974)
fixes https://github.com/flutter/flutter/issues/130682 This patch makes all zip files created via the zip_bundle rule have an embedded LICENSE that points to a permalink to the LICENSE for that SDK commit hash. Previously we only did this for a few tools, but it was pointed out that some of the zip files we generate that are meant for consumption in the tool are otherwise missing a stand-alone license file (the tool downloads the full license file separately from the individual zips, as it would be costly to include it with each and every one).
This commit is contained in:
@@ -26,12 +26,10 @@ if (build_engine_artifacts && !is_android) {
|
||||
deps = [
|
||||
"//flutter/flutter_frontend_server:frontend_server",
|
||||
"//flutter/impeller/compiler:impellerc",
|
||||
"//flutter/impeller/compiler:impellerc_license",
|
||||
"//flutter/impeller/tessellator:tessellator_shared",
|
||||
"//flutter/lib/snapshot:generate_snapshot_bin",
|
||||
"//flutter/shell/testing:testing",
|
||||
"//flutter/tools/path_ops:path_ops",
|
||||
"//flutter/tools/path_ops:path_ops_license",
|
||||
"//third_party/dart/runtime/bin:gen_snapshot",
|
||||
]
|
||||
if (is_mac) {
|
||||
@@ -81,16 +79,6 @@ if (build_engine_artifacts && !is_android) {
|
||||
source = "$root_out_dir/flutter_tester$exe"
|
||||
destination = "flutter_tester$exe"
|
||||
},
|
||||
{
|
||||
source =
|
||||
"$root_out_dir/gen/flutter/impeller/compiler/LICENSE.impellerc.md"
|
||||
destination = "LICENSE.impellerc.md"
|
||||
},
|
||||
{
|
||||
source =
|
||||
"$root_out_dir/gen/flutter/tools/path_ops/LICENSE.path_ops.md"
|
||||
destination = "LICENSE.path_ops.md"
|
||||
},
|
||||
{
|
||||
source = "$root_out_dir/impellerc$exe"
|
||||
destination = "impellerc$exe"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//flutter/common/config.gni")
|
||||
import("//flutter/shell/version/version.gni")
|
||||
|
||||
if (flutter_runtime_mode == "jit_release") {
|
||||
android_zip_archive_dir = "android-$target_cpu-jit-release"
|
||||
@@ -38,16 +39,41 @@ if (flutter_runtime_mode == "jit_release") {
|
||||
template("zip_bundle") {
|
||||
assert(defined(invoker.output), "output must be defined")
|
||||
assert(defined(invoker.files), "files must be defined as a list of scopes")
|
||||
|
||||
license_readme = "$target_gen_dir/LICENSE.$target_name.md"
|
||||
license_target = "_${target_name}_license_md"
|
||||
|
||||
generated_file(license_target) {
|
||||
source_path = rebase_path(".", "//flutter")
|
||||
license_path =
|
||||
rebase_path("//flutter/sky/packages/sky_engine/LICENSE", "//flutter")
|
||||
git_url = "https://github.com/flutter/engine/tree/$engine_version"
|
||||
sky_engine_url = "https://storage.googleapis.com/flutter_infra_release/flutter/$engine_version/sky_engine.zip"
|
||||
outputs = [ license_readme ]
|
||||
contents = [
|
||||
"# $target_name",
|
||||
"",
|
||||
"This bundle is part of the the Flutter SDK.",
|
||||
"",
|
||||
"The source code is hosted at [flutter/engine/$source_path]($git_url/$source_path).",
|
||||
"The license for this bundle is hosted at [flutter/engine/sky/packages/sky_engine/LICENSE]($git_url/$license_path) ",
|
||||
"and [sky_engine.zip]($sky_engine_url).",
|
||||
]
|
||||
}
|
||||
|
||||
action(target_name) {
|
||||
script = "//flutter/build/zip.py"
|
||||
outputs = [ "$root_build_dir/zip_archives/${invoker.output}" ]
|
||||
sources = []
|
||||
sources = [ license_readme ]
|
||||
forward_variables_from(invoker, [ "visibility" ])
|
||||
deps = invoker.deps
|
||||
deps = [ ":$license_target" ] + invoker.deps
|
||||
|
||||
args = [
|
||||
"-o",
|
||||
rebase_path(outputs[0]),
|
||||
"-i",
|
||||
rebase_path(license_readme),
|
||||
"LICENSE.$target_name.md",
|
||||
]
|
||||
foreach(input, invoker.files) {
|
||||
args += [
|
||||
|
||||
@@ -72,26 +72,6 @@ impeller_component("compiler_lib") {
|
||||
]
|
||||
}
|
||||
|
||||
generated_file("impellerc_license") {
|
||||
source_path = rebase_path(".", "//flutter")
|
||||
git_url = "https://github.com/flutter/engine/tree/$engine_version"
|
||||
outputs = [ "$target_gen_dir/LICENSE.impellerc.md" ]
|
||||
contents = [
|
||||
"# impellerc",
|
||||
"",
|
||||
"This tool is used by the Flutter SDK to compile shaders.",
|
||||
"",
|
||||
"Source code for this tool: [flutter/engine/$source_path]($git_url/$source_path).",
|
||||
"",
|
||||
"## Licenses",
|
||||
"",
|
||||
"### impellerc",
|
||||
"",
|
||||
read_file("//flutter/sky/packages/sky_engine/LICENSE", "string"),
|
||||
"",
|
||||
]
|
||||
}
|
||||
|
||||
impeller_component("impellerc") {
|
||||
target_type = "executable"
|
||||
|
||||
@@ -108,10 +88,7 @@ impeller_component("impellerc") {
|
||||
}
|
||||
|
||||
group("compiler") {
|
||||
deps = [
|
||||
":impellerc",
|
||||
":impellerc_license",
|
||||
]
|
||||
deps = [ ":impellerc" ]
|
||||
}
|
||||
|
||||
impeller_component("compiler_unittests") {
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//flutter/build/zip_bundle.gni")
|
||||
import("//flutter/shell/version/version.gni")
|
||||
|
||||
executable("_font-subset") {
|
||||
output_name = "font-subset"
|
||||
@@ -28,22 +27,6 @@ executable("_font-subset") {
|
||||
}
|
||||
}
|
||||
|
||||
generated_file("_font-subset-license") {
|
||||
source_path = rebase_path(".", "//flutter")
|
||||
license_path =
|
||||
rebase_path("//flutter/sky/packages/sky_engine/LICENSE", "//flutter")
|
||||
git_url = "https://github.com/flutter/engine/tree/$engine_version"
|
||||
outputs = [ "$target_gen_dir/LICENSE.font-subset.md" ]
|
||||
contents = [
|
||||
"# font-subset",
|
||||
"",
|
||||
"This tool is used by the Flutter SDK to tree shake icon fonts.",
|
||||
"",
|
||||
"Source code for this tool: [flutter/engine/$source_path]($git_url/$source_path).",
|
||||
"License for this tool: [flutter/engine/sky/packages/sky_engine/LICENSE]($git_url/$license_path).",
|
||||
]
|
||||
}
|
||||
|
||||
generated_file("font_entitlement_config") {
|
||||
outputs = [ "$target_gen_dir/font_subset_without_entitlements.txt" ]
|
||||
|
||||
@@ -75,15 +58,10 @@ zip_bundle("font-subset") {
|
||||
source = "$root_gen_dir/const_finder.dart.snapshot"
|
||||
destination = "const_finder.dart.snapshot"
|
||||
},
|
||||
{
|
||||
source = "$target_gen_dir/LICENSE.font-subset.md"
|
||||
destination = "LICENSE.font-subset.md"
|
||||
},
|
||||
]
|
||||
|
||||
deps = [
|
||||
":_font-subset",
|
||||
":_font-subset-license",
|
||||
"//flutter/tools/const_finder",
|
||||
]
|
||||
if (is_mac) {
|
||||
|
||||
@@ -4,38 +4,12 @@
|
||||
|
||||
import("//flutter/shell/version/version.gni")
|
||||
|
||||
generated_file("path_ops_license") {
|
||||
source_path = rebase_path(".", "//flutter")
|
||||
git_url = "https://github.com/flutter/engine/tree/$engine_version"
|
||||
outputs = [ "$target_gen_dir/LICENSE.path_ops.md" ]
|
||||
contents = [
|
||||
"# path_ops",
|
||||
"",
|
||||
"This tool is used by the vector_graphics library to calculate path intersections.",
|
||||
"",
|
||||
"Source code for this tool: [flutter/engine/$source_path]($git_url/$source_path).",
|
||||
"",
|
||||
"## Licenses",
|
||||
"",
|
||||
read_file("//flutter/sky/packages/sky_engine/LICENSE", "string"),
|
||||
"",
|
||||
"## Additional open source licenses",
|
||||
"",
|
||||
"### Skia",
|
||||
"",
|
||||
read_file("//third_party/skia/LICENSE", "string"),
|
||||
]
|
||||
}
|
||||
|
||||
shared_library("path_ops") {
|
||||
sources = [
|
||||
"path_ops.cc",
|
||||
"path_ops.h",
|
||||
]
|
||||
deps = [
|
||||
":path_ops_license",
|
||||
"//third_party/skia",
|
||||
]
|
||||
deps = [ "//third_party/skia" ]
|
||||
|
||||
metadata = {
|
||||
entitlement_file_path = [ "libpath_ops.dylib" ]
|
||||
|
||||
Reference in New Issue
Block a user