-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathBUILD.bazel
128 lines (115 loc) · 3.11 KB
/
BUILD.bazel
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load(
"@cgrindel_bazel_starlib//bazeldoc:defs.bzl",
"doc_for_provs",
"write_header",
doc_providers = "providers",
)
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg")
load("@cgrindel_bazel_starlib//markdown:defs.bzl", "markdown_pkg")
load(":doc_infos.bzl", "doc_infos")
bzlformat_pkg(name = "bzlformat")
markdown_pkg(name = "markdown")
# MARK: - Documentation Declarations
_DOC_INFOS = [
doc_infos.new(
name = "internal_rules_and_macros",
label = "//swiftpkg:build_defs",
symbols = [
"generate_modulemap",
"resource_bundle_accessor",
"resource_bundle_infoplist",
],
),
doc_infos.new(
name = "repository_rules",
label = "//swiftpkg:defs",
symbols = [
"local_swift_package",
"swift_package",
"registry_swift_package",
],
),
doc_infos.new(
name = "rules_and_macros",
label = "//swiftpkg:defs",
symbols = [
"swift_deps_index",
],
),
doc_infos.new(
name = "bzlmod_extensions",
label = "//:extensions",
symbols = [
"swift_deps",
],
),
]
_DOC_WITH_SYMBOLS = {
di.name: di
for di in _DOC_INFOS
}
_ALL_DOC_PROVIDERS = [
doc_providers.create(
name = di.name + "_overview",
stardoc_input = "{}.bzl".format(di.label),
symbols = di.symbols,
deps = [di.label],
)
for di in _DOC_INFOS
]
# MARK: - Headers
write_header(
name = "repository_rules_overview_header",
header_content = [
"# Repository Rules",
"",
"""
The rules described below are used to build Swift packages and make their
products and targets available as Bazel targets.
""",
],
symbols = _DOC_WITH_SYMBOLS["repository_rules"].symbols,
)
write_header(
name = "rules_and_macros_overview_header",
header_content = [
"# Rules and Macros",
"",
"""
The rules and macros described below are used to define Gazelle targets to aid \
in the generation and maintenance of Swift package dependencies.
""",
],
symbols = _DOC_WITH_SYMBOLS["rules_and_macros"].symbols,
)
write_header(
name = "internal_rules_and_macros_overview_header",
header_content = [
"# Internal Rules and Macros",
"",
"""
The rules and macros described below are used by `rules_swift_package_manager` to build the \
external Swift packages.
""",
],
symbols = _DOC_WITH_SYMBOLS["internal_rules_and_macros"].symbols,
)
write_header(
name = "bzlmod_extensions_overview_header",
header_content = [
"# Bazel Modules (bzlmod) Extensions",
"",
"""
The bzlmod extensions described below are used by `rules_swift_package_manager` \
to customize the build of the external Swift packages.\
""",
],
symbols = _DOC_WITH_SYMBOLS["bzlmod_extensions"].symbols,
)
doc_for_provs(doc_provs = _ALL_DOC_PROVIDERS)
bzl_library(
name = "doc_infos",
srcs = ["doc_infos.bzl"],
visibility = ["//visibility:public"],
)