1 include ../../run-make-fulldeps/tools.mk
3 OUTPUT_DIR := "$(TMPDIR)/rustdoc"
4 TMP_OUTPUT_DIR := "$(TMPDIR)/tmp-rustdoc"
8 $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
10 # Copy first output for to check if it's exactly same after second compilation
11 cp -R $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
13 # Generate html docs once again on same output
14 $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
16 # Check if everything exactly same
17 $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
19 # Generate json doc on the same output
20 $(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json
22 # Check if expected json file is generated
23 [ -e $(OUTPUT_DIR)/foobar.json ]
26 # We should re-generate json doc once again and compare the diff with previously
27 # generated one. Because layout of json docs changes in each compilation, we can't
30 # See https://github.com/rust-lang/rust/issues/103785#issuecomment-1307425590 for details.
32 # remove generated json doc
33 rm $(OUTPUT_DIR)/foobar.json
35 # Check if json doc compilation broke any of the html files generated previously
36 $(DIFF) -r -q $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)