blob: fe554c513d7686b06e01badd7bf10a60631e1b1d [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/python/python_binary.gni")
import("//build/python/python_host_test.gni")
import("//build/python/python_library.gni")
if (is_host) {
# Attempting to put these in a shared `python_library` target
# confuses IDEs and python3 command line usage.
common_sources = [
"collector.py",
"file_access.py",
"gn_label.py",
"gn_license_metadata.py",
"readme_fuchsia.py",
"spdx_comparator.py",
"spdx_writer.py",
]
python_binary("generated_licenses_spdx_tool") {
main_source = "generated_licenses_spdx_tool.py"
sources = common_sources
}
# The following tests can be run conveniently also via:
# `python3 -m unittest discover -s build/licenses/python -p '*_test.py'`
# or individually:
# `python3 build/licenses/python/[name].py`
#
# Alternatively, run via:
# `fx test --host [name]`
# but may require `fx set ... --with-host //build/licenses:tests`
# on user/userdebug builds.
host_test_deps = []
foreach(test_name,
[
"gn_label_test",
"gn_license_metadata_test",
"spdx_writer_test",
"file_access_test",
"readme_fuchsia_test",
"collector_test",
]) {
python_host_test(test_name) {
main_source = "${test_name}.py"
sources = common_sources
}
host_test_deps += [ ":${test_name}" ]
}
group("host_tests") {
testonly = true
deps = host_test_deps
}
}