Skip to content

Commit 992a2db

Browse files
committed
mk: Ensure docs have relative links to each other
When generating documentation, rustdoc has the ability to generate relative links within the current distribution of crates to one another. To do this, it must recognize when a crate's documentation is in the same output directory. The current threshold for "local documentation for crate X being available" is whether the directory "doc/X" exists. This change modifies the build system to have new dependencies for each directory of upstream crates for a rustdoc invocation. This will ensure that when building documentation that all the crates in the standard distribution are guaranteed to have relative links to one another. This change is prompted by guaranteeing that offline docs always work with one another. Before this change, races could mean that some docs were built before others, and hence may have http links when relative links would suffice. Closes #14747
1 parent e55f64f commit 992a2db

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mk/docs.mk

+6-2
Original file line numberDiff line numberDiff line change
@@ -273,14 +273,18 @@ LIB_DOC_DEP_$(1) = \
273273
$$(RSINPUTS_$(1)) \
274274
$$(RUSTDOC_EXE) \
275275
$$(foreach dep,$$(RUST_DEPS_$(1)), \
276-
$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep))
276+
$$(TLIB2_T_$(CFG_BUILD)_H_$(CFG_BUILD))/stamp.$$(dep) \
277+
doc/$$(dep)/)
277278
else
278279
LIB_DOC_DEP_$(1) = $$(CRATEFILE_$(1)) $$(RSINPUTS_$(1))
279280
endif
280281

282+
doc/$(1)/:
283+
$$(Q)mkdir -p $$@
284+
281285
$(2) += doc/$(1)/index.html
282286
doc/$(1)/index.html: CFG_COMPILER_HOST_TRIPLE = $(CFG_TARGET)
283-
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1))
287+
doc/$(1)/index.html: $$(LIB_DOC_DEP_$(1)) doc/$(1)/
284288
@$$(call E, rustdoc $$@)
285289
$$(Q)$$(RUSTDOC) --cfg dox --cfg stage2 $$<
286290
endef

0 commit comments

Comments
 (0)