Skip to content

Commit 1964f77

Browse files
authored
chore: docs without compiling protoc (#1063)
* refactor: use pre-built stardoc jar Avoids transitive dep on protoc cc_binary which is slow and spammy * chore: update CI * chore: fix delta * chore: remove unneeded tag
1 parent e873c46 commit 1964f77

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+373
-89
lines changed

.bazelignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
# nested modules
2+
docs/
13
e2e/

.github/workflows/ci.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ jobs:
9898
os: macos
9999
- folder: .
100100
os: windows
101+
include:
102+
- folder: docs
103+
bzlmod: 1
104+
os: ubuntu
105+
bazel-version:
106+
major: 8
107+
version: 8.1.1
101108
steps:
102109
- uses: actions/checkout@v4
103110
- name: Mount bazel caches

MODULE.bazel

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ module(
1111
bazel_dep(name = "bazel_features", version = "1.9.0")
1212
bazel_dep(name = "bazel_skylib", version = "1.5.0")
1313
bazel_dep(name = "platforms", version = "0.0.10")
14-
15-
# 0.5.4 is the first version with bzlmod support
16-
bazel_dep(name = "stardoc", version = "0.6.2", repo_name = "io_bazel_stardoc")
14+
bazel_dep(name = "stardoc", version = "0.6.2")
1715

1816
bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
1917
bazel_lib_toolchains.copy_directory()

docs/.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Never Compile protoc Again
2+
# Don't build protoc from the cc_binary, it's slow and spammy when cache miss
3+
common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
4+
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
5+
common --java_runtime_version=remotejdk_11

docs/.bazelversion

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.1.1

docs/BUILD.bazel

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,166 +1,165 @@
1-
load("//lib:docs.bzl", "stardoc_with_diff_test", "update_docs")
1+
load("@aspect_bazel_lib//lib:docs.bzl", "update_docs")
2+
load(":defs.bzl", "stardoc_with_diff_test")
23

34
stardoc_with_diff_test(
45
name = "copy_file",
5-
bzl_library_target = "//lib:copy_file",
6+
bzl_library_target = "@aspect_bazel_lib//lib:copy_file",
67
)
78

89
stardoc_with_diff_test(
910
name = "copy_directory",
10-
bzl_library_target = "//lib:copy_directory",
11+
bzl_library_target = "@aspect_bazel_lib//lib:copy_directory",
1112
)
1213

1314
stardoc_with_diff_test(
1415
name = "copy_to_directory",
15-
bzl_library_target = "//lib:copy_to_directory",
16+
bzl_library_target = "@aspect_bazel_lib//lib:copy_to_directory",
1617
)
1718

1819
stardoc_with_diff_test(
1920
name = "copy_to_bin",
20-
bzl_library_target = "//lib:copy_to_bin",
21+
bzl_library_target = "@aspect_bazel_lib//lib:copy_to_bin",
2122
)
2223

2324
stardoc_with_diff_test(
2425
name = "docs",
25-
bzl_library_target = "//lib:docs",
26+
bzl_library_target = "@aspect_bazel_lib//lib:docs",
2627
tags = ["some_random_tag_for_testing_pr746_regression"],
2728
)
2829

2930
stardoc_with_diff_test(
3031
name = "diff_test",
31-
bzl_library_target = "//lib:diff_test",
32+
bzl_library_target = "@aspect_bazel_lib//lib:diff_test",
3233
)
3334

3435
stardoc_with_diff_test(
3536
name = "expand_make_vars",
36-
bzl_library_target = "//lib:expand_make_vars",
37+
bzl_library_target = "@aspect_bazel_lib//lib:expand_make_vars",
3738
)
3839

3940
stardoc_with_diff_test(
4041
name = "expand_template",
41-
bzl_library_target = "//lib:expand_template",
42+
bzl_library_target = "@aspect_bazel_lib//lib:expand_template",
4243
)
4344

4445
stardoc_with_diff_test(
4546
name = "params_file",
46-
bzl_library_target = "//lib:params_file",
47+
bzl_library_target = "@aspect_bazel_lib//lib:params_file",
4748
)
4849

4950
stardoc_with_diff_test(
5051
name = "paths",
51-
bzl_library_target = "//lib:paths",
52+
bzl_library_target = "@aspect_bazel_lib//lib:paths",
5253
)
5354

5455
stardoc_with_diff_test(
5556
name = "lists",
56-
bzl_library_target = "//lib:lists",
57+
bzl_library_target = "@aspect_bazel_lib//lib:lists",
5758
)
5859

5960
stardoc_with_diff_test(
6061
name = "tar",
61-
bzl_library_target = "//lib:tar",
62+
bzl_library_target = "@aspect_bazel_lib//lib:tar",
6263
)
6364

6465
stardoc_with_diff_test(
6566
name = "utils",
66-
bzl_library_target = "//lib:utils",
67+
bzl_library_target = "@aspect_bazel_lib//lib:utils",
6768
)
6869

6970
stardoc_with_diff_test(
7071
name = "jq",
71-
bzl_library_target = "//lib:jq",
72+
bzl_library_target = "@aspect_bazel_lib//lib:jq",
7273
)
7374

7475
stardoc_with_diff_test(
7576
name = "write_source_files",
76-
bzl_library_target = "//lib:write_source_files",
77+
bzl_library_target = "@aspect_bazel_lib//lib:write_source_files",
7778
)
7879

7980
stardoc_with_diff_test(
8081
name = "directory_path",
81-
bzl_library_target = "//lib:directory_path",
82+
bzl_library_target = "@aspect_bazel_lib//lib:directory_path",
8283
)
8384

8485
stardoc_with_diff_test(
8586
name = "output_files",
86-
bzl_library_target = "//lib:output_files",
87+
bzl_library_target = "@aspect_bazel_lib//lib:output_files",
8788
)
8889

8990
stardoc_with_diff_test(
9091
name = "run_binary",
91-
bzl_library_target = "//lib:run_binary",
92+
bzl_library_target = "@aspect_bazel_lib//lib:run_binary",
9293
)
9394

9495
stardoc_with_diff_test(
9596
name = "transitions",
96-
bzl_library_target = "//lib:transitions",
97+
bzl_library_target = "@aspect_bazel_lib//lib:transitions",
9798
)
9899

99100
stardoc_with_diff_test(
100101
name = "repo_utils",
101-
bzl_library_target = "//lib:repo_utils",
102+
bzl_library_target = "@aspect_bazel_lib//lib:repo_utils",
102103
)
103104

104105
stardoc_with_diff_test(
105106
name = "yq",
106-
bzl_library_target = "//lib:yq",
107+
bzl_library_target = "@aspect_bazel_lib//lib:yq",
107108
)
108109

109110
stardoc_with_diff_test(
110111
name = "glob_match",
111-
bzl_library_target = "//lib:glob_match",
112+
bzl_library_target = "@aspect_bazel_lib//lib:glob_match",
112113
)
113114

114115
stardoc_with_diff_test(
115116
name = "host_repo",
116-
bzl_library_target = "//lib:host_repo",
117+
bzl_library_target = "@aspect_bazel_lib//lib:host_repo",
117118
)
118119

119120
stardoc_with_diff_test(
120121
name = "platform_utils",
121-
bzl_library_target = "//lib:platform_utils",
122+
bzl_library_target = "@aspect_bazel_lib//lib:platform_utils",
122123
)
123124

124125
stardoc_with_diff_test(
125126
name = "stamping",
126-
bzl_library_target = "//lib:stamping",
127+
bzl_library_target = "@aspect_bazel_lib//lib:stamping",
127128
)
128129

129130
stardoc_with_diff_test(
130131
name = "testing",
131-
bzl_library_target = "//lib:testing",
132+
bzl_library_target = "@aspect_bazel_lib//lib:testing",
132133
)
133134

134135
stardoc_with_diff_test(
135136
name = "base64",
136-
bzl_library_target = "//lib:base64",
137+
bzl_library_target = "@aspect_bazel_lib//lib:base64",
137138
)
138139

139140
stardoc_with_diff_test(
140141
name = "repositories",
141-
bzl_library_target = "//lib:repositories",
142+
bzl_library_target = "@aspect_bazel_lib//lib:repositories",
142143
)
143144

144145
stardoc_with_diff_test(
145146
name = "bazelrc_presets",
146-
bzl_library_target = "//lib:bazelrc_presets",
147+
bzl_library_target = "@aspect_bazel_lib//lib:bazelrc_presets",
147148
)
148149

149150
stardoc_with_diff_test(
150151
name = "strings",
151-
bzl_library_target = "//lib:strings",
152+
bzl_library_target = "@aspect_bazel_lib//lib:strings",
152153
)
153154

154155
stardoc_with_diff_test(
155156
name = "bats",
156-
bzl_library_target = "//lib:bats",
157+
bzl_library_target = "@aspect_bazel_lib//lib:bats",
157158
)
158159

159160
stardoc_with_diff_test(
160161
name = "resource_sets",
161-
bzl_library_target = "//lib:resource_sets",
162+
bzl_library_target = "@aspect_bazel_lib//lib:resource_sets",
162163
)
163164

164-
update_docs(
165-
tags = ["skip-on-bazel6"],
166-
)
165+
update_docs(name = "update")

docs/MODULE.bazel

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"Dependencies for building docs with stardoc"
2+
3+
bazel_dep(name = "aspect_bazel_lib", version = "0.0.0")
4+
bazel_dep(name = "rules_java", version = "8.11.0")
5+
bazel_dep(name = "platforms", version = "0.0.11")
6+
bazel_dep(name = "stardoc", version = "0.7.1")
7+
8+
local_path_override(
9+
module_name = "aspect_bazel_lib",
10+
path = "..",
11+
)
12+
13+
http_jar = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_jar")
14+
15+
http_jar(
16+
name = "stardoc-prebuilt",
17+
integrity = "sha256-jDi5ITmziwwiHCsfd8v0UOoraWXIAfICIll+wbpg/vE=",
18+
# NB: version matches the stardoc load above
19+
urls = ["https://github.com/alexeagle/stardoc-prebuilt/releases/download/v0.7.1/renderer_deploy.jar"],
20+
)

docs/base64.md

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/bats.md

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/bazelrc_presets.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)