blob: 09219b2e5c7218f3296f9108ec7f229e9207356d [file] [log] [blame]
# Copyright 2023 The Fuchsia 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("//build/licenses/generated_licenses_spdx.gni")
import("//build/licenses/license.gni")
import("//build/testing/golden_files.gni")
license("license_1") {
public_package_name = "License 1"
license_files = [ "text1.txt" ]
}
license("license_2") {
public_package_name = "License 2"
license_files = [ "text2.txt" ]
}
license("license_3") {
public_package_name = "License 3"
license_files = [ "text3.txt" ]
}
license("license_4") {
public_package_name = "License 4"
license_files = [ "text4.txt" ]
}
license("spdx_license") {
public_package_name = "sub-package"
license_files = [ "sub_package.spdx.json" ]
}
group("foo") {
applicable_licenses = [
":license_1",
":spdx_license",
]
deps = []
}
group("bar") {
applicable_licenses = [ ":license_2" ]
deps = [ ":foo" ]
}
applicable_licenses = [ ":license_3" ]
group("baz") {
deps = [ ":bar" ]
}
group("qax") {
deps = [ ":baz" ]
# No license - would default to the Fuchsia license
applicable_licenses = []
}
generated_licenses_spdx("actual_spdx") {
target = ":qax"
spdx_root_package_name = "Example"
debug_hints = false
output = "${target_out_dir}/actual.spdx.json"
include_host_tools = true
additional_licenses = [ ":license_4" ]
generate_stub = false
}
# Run via:
# `fx set ... --with-test //build/licenses/tests:golden_test`
# `fx build //build/licenses/tests:golden_test`
golden_files("golden_test") {
testonly = true
deps = [ ":actual_spdx" ]
comparisons = [
{
golden = "golden.spdx.json"
candidate = "${target_out_dir}/actual.spdx.json"
},
]
}