2023-03-30 07:58:50 -05:00
|
|
|
include ../tools.mk
|
2022-11-13 12:30:36 -06:00
|
|
|
|
|
|
|
OUTPUT_DIR := "$(TMPDIR)/rustdoc"
|
|
|
|
TMP_OUTPUT_DIR := "$(TMPDIR)/tmp-rustdoc"
|
|
|
|
|
|
|
|
all:
|
|
|
|
# Generate html docs
|
|
|
|
$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
|
|
|
|
|
|
|
|
# Copy first output for to check if it's exactly same after second compilation
|
|
|
|
cp -R $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
|
|
|
|
|
|
|
|
# Generate html docs once again on same output
|
|
|
|
$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR)
|
|
|
|
|
|
|
|
# Check if everything exactly same
|
2023-03-11 17:50:39 -06:00
|
|
|
$(DIFF) -r $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
|
2022-11-13 12:30:36 -06:00
|
|
|
|
|
|
|
# Generate json doc on the same output
|
|
|
|
$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json
|
|
|
|
|
|
|
|
# Check if expected json file is generated
|
|
|
|
[ -e $(OUTPUT_DIR)/foobar.json ]
|
|
|
|
|
2023-03-01 15:53:02 -06:00
|
|
|
# Copy first json output to check if it's exactly same after second compilation
|
|
|
|
cp -R $(OUTPUT_DIR)/foobar.json $(TMP_OUTPUT_DIR)/foobar.json
|
2022-11-13 12:30:36 -06:00
|
|
|
|
2023-03-01 15:53:02 -06:00
|
|
|
# Generate json doc on the same output
|
|
|
|
$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --out-dir $(OUTPUT_DIR) -Z unstable-options --output-format json
|
2022-11-13 12:30:36 -06:00
|
|
|
|
2023-03-01 15:53:02 -06:00
|
|
|
# Check if all docs(including both json and html formats) are still the same after multiple compilations
|
2023-03-11 17:50:39 -06:00
|
|
|
$(DIFF) -r $(OUTPUT_DIR) $(TMP_OUTPUT_DIR)
|