blob: 4ba78c01544b0e24a2116c0c1397e07e94c918af [file] [log] [blame]
Chris Frantz340e6232021-08-25 15:56:28 -07001# Copyright lowRISC contributors.
2# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3# SPDX-License-Identifier: Apache-2.0
4
Drew Macraed3029c72021-09-24 19:24:09 +00005load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
Drew Macrae0b93de02022-04-04 17:36:34 -04006load("//rules:quality.bzl", "clang_format_check", "html_coverage_report")
7load("@lowrisc_lint//rules:rules.bzl", "licence_check")
Drew Macraed3029c72021-09-24 19:24:09 +00008
Chris Frantze7454162021-08-25 14:43:05 -07009package(default_visibility = ["//visibility:public"])
Drew Macraed3029c72021-09-24 19:24:09 +000010
Drew Macrae2c235ba2022-04-04 17:01:44 -040011unbuildify = [
Miguel Young de la Sota98cfa222022-04-06 15:31:06 -040012 "./WORKSPACE", # Prevent Buildifier from inserting unnecessary newlines.
Drew Macrae2c235ba2022-04-04 17:01:44 -040013 "./**/vendor/**",
14 "./util/lowrisc_misc-linters/**",
Drew Macraee3b85492022-04-18 17:23:06 -040015 "./build/**",
Drew Macrae2c235ba2022-04-04 17:01:44 -040016]
17
Drew Macraed3029c72021-09-24 19:24:09 +000018buildifier(
Chris Frantz6fb3f4e2021-11-12 10:56:10 -080019 name = "buildifier_fix",
Drew Macrae2c235ba2022-04-04 17:01:44 -040020 exclude_patterns = unbuildify,
Drew Macraed3029c72021-09-24 19:24:09 +000021)
Chris Frantz3f87fe02021-11-12 09:59:04 -080022
Chris Frantz6fb3f4e2021-11-12 10:56:10 -080023buildifier(
24 name = "buildifier_check",
25 diff_command = "diff -u",
Drew Macrae2c235ba2022-04-04 17:01:44 -040026 exclude_patterns = unbuildify,
Chris Frantz6fb3f4e2021-11-12 10:56:10 -080027 mode = "diff",
28)
29
Drew Macrae0b93de02022-04-04 17:36:34 -040030licence_check(
Chris Frantz3f87fe02021-11-12 09:59:04 -080031 name = "license_check",
Drew Macrae0b93de02022-04-04 17:36:34 -040032 exclude_patterns = [".style.yapf"],
33 licence = """
34 Copyright lowRISC contributors.
35 Licensed under the Apache License, Version 2.0, see LICENSE for details.
36 SPDX-License-Identifier: Apache-2.0
37 """,
Chris Frantz3f87fe02021-11-12 09:59:04 -080038)
Chris Frantz6fb3f4e2021-11-12 10:56:10 -080039
40clang_format_check(
41 name = "clang_format_check",
42 exclude_patterns = [
43 # Vendored source code dirs
44 "./**/vendor/**",
45 # Rust cargo build dirs
46 "./**/target/**",
47 # Meson build dirs
48 "./build-out/**",
49 "./build-bin/**",
50 # fusesoc build dir
51 "./build/**",
52 ],
53 mode = "diff",
54)
55
56clang_format_check(
57 name = "clang_format_fix",
58 exclude_patterns = [
59 # Vendored source code dirs
60 "./**/vendor/**",
61 # Rust cargo build dirs
62 "./**/target/**",
63 # Meson build dirs
64 "./build-out/**",
65 "./build-bin/**",
66 # fusesoc build dir
67 "./build/**",
68 ],
69 mode = "fix",
70)
Chris Frantz6da32ea2021-11-22 13:12:08 -080071
Chris Frantzb231f112021-12-02 15:42:10 -080072html_coverage_report(
73 name = "html_coverage_report",
74)
75
Chris Frantz6da32ea2021-11-22 13:12:08 -080076filegroup(
77 name = "cores",
78 srcs = [
79 "check_tool_requirements.core",
80 "topgen.core",
81 "topgen-reg-only.core",
82 ],
83)
Timothy Trippelb54abfa2022-04-12 18:04:10 -070084
85exports_files(["python-requirements.txt"])