|
| 1 | +# ******************************************************************************* |
| 2 | +# Copyright (c) 2026 Contributors to the Eclipse Foundation |
| 3 | +# |
| 4 | +# See the NOTICE file(s) distributed with this work for additional |
| 5 | +# information regarding copyright ownership. |
| 6 | +# |
| 7 | +# This program and the accompanying materials are made available under the |
| 8 | +# terms of the Apache License Version 2.0 which is available at |
| 9 | +# https://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# SPDX-License-Identifier: Apache-2.0 |
| 12 | +# ******************************************************************************* |
| 13 | +load("@ref_int_scripts_env//:requirements.bzl", "all_requirements") |
| 14 | +load("@rules_python//python:defs.bzl", "py_binary", "py_library") |
| 15 | +load("@rules_python//python:pip.bzl", "compile_pip_requirements") |
| 16 | +load("@score_tooling//python_basics:defs.bzl", "score_py_pytest") |
| 17 | + |
| 18 | +# In order to update the requirements, change the `requirements.in` file and run: |
| 19 | +# `bazel run //src:requirements.update`. |
| 20 | +# This will update the `requirements.txt` file. |
| 21 | +# To upgrade all dependencies to their latest versions, run: |
| 22 | +# `bazel run //src:requirements.update -- --upgrade`. |
| 23 | +compile_pip_requirements( |
| 24 | + name = "requirements", |
| 25 | + srcs = [ |
| 26 | + "requirements.in", |
| 27 | + "@score_tooling//python_basics:requirements.txt", |
| 28 | + ], |
| 29 | + requirements_txt = "requirements.txt", |
| 30 | + tags = [ |
| 31 | + "manual", |
| 32 | + ], |
| 33 | +) |
| 34 | + |
| 35 | +# Library target |
| 36 | +py_library( |
| 37 | + name = "lib", |
| 38 | + srcs = glob(["lib/**/*.py"]), |
| 39 | + visibility = ["//visibility:public"], |
| 40 | +) |
| 41 | + |
| 42 | +# CLI library target (shared between binary and tests) |
| 43 | +py_library( |
| 44 | + name = "cli", |
| 45 | + srcs = glob(["cli/**/*.py"]), |
| 46 | + data = [ |
| 47 | + ":cli/misc/assets/report_template.html", |
| 48 | + ], |
| 49 | + deps = [":lib"] + all_requirements, |
| 50 | +) |
| 51 | + |
| 52 | +# CLI binary target |
| 53 | +py_binary( |
| 54 | + name = "tooling", |
| 55 | + srcs = ["cli/main.py"], |
| 56 | + main = "cli/main.py", |
| 57 | + visibility = ["//visibility:public"], |
| 58 | + deps = [":cli"], |
| 59 | +) |
| 60 | + |
| 61 | +# Tests target |
| 62 | +score_py_pytest( |
| 63 | + name = "tooling_tests", |
| 64 | + srcs = glob(["tests/**/*.py"]), |
| 65 | + data = [ |
| 66 | + ":cli/misc/assets/report_template.html", |
| 67 | + ], |
| 68 | + pytest_config = "//:pyproject.toml", |
| 69 | + deps = [ |
| 70 | + ":cli", |
| 71 | + ":lib", |
| 72 | + ] + all_requirements, |
| 73 | +) |
0 commit comments