From 9acf399075c01fe4fe94179993daff734176b405 Mon Sep 17 00:00:00 2001 From: Bhargava Vadlamani Date: Sun, 17 Aug 2025 00:22:20 -0700 Subject: [PATCH] feat_enable_version_specific_docs --- docs/Makefile | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/Makefile b/docs/Makefile index 6bce19911d..feaee791cc 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -19,20 +19,25 @@ # Minimal makefile for Sphinx documentation # -# You can set these variables from the command line, and also -# from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = source BUILDDIR = build -# Put it first so that "make" without argument is like "make help". +# Extract version from Cargo.toml (default) +PROJECT_VERSION := $(shell grep '^version' ../native/Cargo.toml | head -1 | cut -d '"' -f2) + help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -.PHONY: help Makefile +html: + @echo "Building docs for version $(PROJECT_VERSION)" + @PROJECT_VERSION=$(PROJECT_VERSION) $(SPHINXBUILD) -b html "$(SOURCEDIR)" "$(BUILDDIR)/html" -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) +# Build docs and copy into versioned dir (like Spark does) +publish: html + @mkdir -p site/docs/$(PROJECT_VERSION) + @cp -r $(BUILDDIR)/html/* site/docs/$(PROJECT_VERSION)/ + @rm -rf site/docs/latest + @ln -s $(PROJECT_VERSION) site/docs/latest + @echo "Docs published under site/docs/$(PROJECT_VERSION) and site/docs/latest" \ No newline at end of file