| # Copyright lowRISC contributors. |
| # Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| # SPDX-License-Identifier: Apache-2.0 |
| |
| load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier") |
| load("//rules:quality.bzl", "clang_format_check", "html_coverage_report") |
| load("//rules:cargo.bzl", "cargo_raze") |
| load("@lowrisc_lint//rules:rules.bzl", "licence_check") |
| load("@rules_rust//rust:defs.bzl", "rust_analyzer") |
| |
| package(default_visibility = ["//visibility:public"]) |
| |
| exports_files(["python-requirements.txt"]) |
| |
| unbuildify = [ |
| "./WORKSPACE", # Prevent Buildifier from inserting unnecessary newlines. |
| "./**/vendor/**", |
| "./util/lowrisc_misc-linters/**", |
| "./build/**", |
| ] |
| |
| buildifier( |
| name = "buildifier_fix", |
| exclude_patterns = unbuildify, |
| ) |
| |
| buildifier( |
| name = "buildifier_check", |
| diff_command = "diff -u", |
| exclude_patterns = unbuildify, |
| mode = "diff", |
| ) |
| |
| licence_check( |
| name = "license_check", |
| exclude_patterns = [".style.yapf"], |
| licence = """ |
| Copyright lowRISC contributors. |
| Licensed under the Apache License, Version 2.0, see LICENSE for details. |
| SPDX-License-Identifier: Apache-2.0 |
| """, |
| ) |
| |
| clang_format_exclude = [ |
| # Vendored source code dirs |
| "./**/vendor/**", |
| # Rust cargo build dirs |
| "./**/target/**", |
| # Directories used exclusively to store build artifacts are still copied into. |
| "./build-out/**", |
| "./build-bin/**", |
| # fusesoc build dir |
| "./build/**", |
| ] |
| |
| clang_format_check( |
| name = "clang_format_check", |
| exclude_patterns = clang_format_exclude, |
| mode = "diff", |
| ) |
| |
| clang_format_check( |
| name = "clang_format_fix", |
| exclude_patterns = clang_format_exclude, |
| mode = "fix", |
| ) |
| |
| html_coverage_report( |
| name = "html_coverage_report", |
| ) |
| |
| filegroup( |
| name = "cores", |
| srcs = [ |
| "check_tool_requirements.core", |
| "topgen.core", |
| "topgen-reg-only.core", |
| ], |
| ) |
| |
| alias( |
| name = "gen_rust_project", |
| actual = "@rules_rust//tools/rust_analyzer:gen_rust_project", |
| ) |
| |
| # Do not use directly, run `:gen_rust_project` instead. |
| rust_analyzer( |
| name = "rust_analyzer", |
| targets = [ |
| "//sw/host/opentitanlib:opentitanlib", |
| "//sw/host/opentitansession:opentitansession", |
| "//sw/host/opentitantool:opentitantool", |
| ], |
| ) |
| |
| cargo_raze( |
| name = "cargo_raze", |
| cargo = [ |
| "third_party/rust/crates/Cargo.toml", |
| ], |
| ) |