Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tools/BUILD.bazel
blob: fbe960aaa5f961ccc07a93cb33d18c09405d7f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright (c) 2026 Progmasoft.
# SPDX-License-Identifier: MPL-2.0 WITH AdditionRef-Progmasoft-Exception-2.0
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")

# The tools of this repository. They work on the checkout:
#
#     bazelisk run //tools:<tool>
#     bazelisk run //tools:<tool> -- <arguments>
CPP17 = select({
    "@platforms//os:windows": ["/std:c++17"],
    "//conditions:default": ["-std=c++17"],
})

cc_library(
    name = "library",
    srcs = [
        "Amalgamation.cpp",
        "Checks.cpp",
        "Repository.cpp",
        "RepositoryReport.cpp",
        "Versions.cpp",
    ],
    hdrs = [
        "Amalgamation.hpp",
        "Checks.hpp",
        "Repository.hpp",
        "RepositoryReport.hpp",
        "Versions.hpp",
    ],
    copts = CPP17,
    deps = ["//third_party/yyjson"],
)

cc_binary(
    name = "amalgamate",
    srcs = ["AmalgamateMain.cpp"],
    copts = CPP17,
    deps = [":library"],
)

cc_binary(
    name = "check",
    srcs = ["CheckMain.cpp"],
    copts = CPP17,
    deps = [":library"],
)

cc_binary(
    name = "release_notes",
    srcs = ["ReleaseNotesMain.cpp"],
    copts = CPP17,
    deps = [":library"],
)

cc_binary(
    name = "repo_info",
    srcs = ["RepoInfoMain.cpp"],
    copts = CPP17,
    deps = [":library"],
)

cc_binary(
    name = "version",
    srcs = ["VersionMain.cpp"],
    copts = CPP17,
    deps = [":library"],
)

cc_binary(
    name = "third_party",
    srcs = ["ThirdPartyMain.cpp"],
    args = [
        "third_party/yyjson/yyjson.c=$(rlocationpath @yyjson_archive//:src/yyjson.c)",
        "third_party/yyjson/yyjson.h=$(rlocationpath @yyjson_archive//:src/yyjson.h)",
        "third_party/pugixml/pugiconfig.hpp=$(rlocationpath @pugixml_archive//:src/pugiconfig.hpp)",
        "third_party/pugixml/pugixml.cpp=$(rlocationpath @pugixml_archive//:src/pugixml.cpp)",
        "third_party/pugixml/pugixml.hpp=$(rlocationpath @pugixml_archive//:src/pugixml.hpp)",
    ],
    copts = CPP17,
    data = [
        "@pugixml_archive//:src/pugiconfig.hpp",
        "@pugixml_archive//:src/pugixml.cpp",
        "@pugixml_archive//:src/pugixml.hpp",
        "@yyjson_archive//:src/yyjson.c",
        "@yyjson_archive//:src/yyjson.h",
    ],
    deps = [
        ":library",
        "@rules_cc//cc/runfiles",
    ],
)

cc_test(
    name = "tools_tests",
    srcs = ["Tools.tests.cpp"],
    copts = CPP17,
    deps = [
        ":library",
        "//:catch3_main",
    ],
)