From 56fd33076042f3d8d70353c8134f9dbd6560298d Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Fri, 9 Oct 2020 07:56:51 -0700 Subject: [PATCH] [make] allow updating new website version Summary: `make new-website-version` would fail if run a second time, because it assumes the version is brand new. Now, it will delete previous traces of the new version, which allows one to easily update commits upgrading the website instead of reverting the diff then running `make new-website-version` again. Reviewed By: martintrojer Differential Revision: D24218463 fbshipit-source-id: 61f416677 --- Makefile | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b13a6f754..cf4fe5473 100644 --- a/Makefile +++ b/Makefile @@ -910,7 +910,7 @@ ifeq ($(IS_FACEBOOK_TREE),yes) $(MAKE) -C facebook clean) endif $(QUIET)$(call silent_on_success,Building infer and manuals,\ - $(MAKE) $(INFER_GROFF_MANUALS)) + $(MAKE) IS_FACEBOOK_TREE=no $(INFER_GROFF_MANUALS)) $(QUIET)$(MKDIR_P) "$(WEBSITE_DIR)"/static/man/next "$(WEBSITE_DIR)"/static/odoc/next $(QUIET)$(call silent_on_success,Copying man pages,\ $(REMOVE) "$(WEBSITE_DIR)"/static/man/*; \ @@ -922,19 +922,25 @@ endif $(QUIET)$(call silent_on_success,Copying OCaml modules documentation,\ rsync -a --delete $(BUILD_DIR)/default/_doc/_html/ "$(WEBSITE_DIR)"/static/odoc/next/) $(QUIET)$(call silent_on_success,Building infer,\ - $(MAKE) src_build) + $(MAKE) IS_FACEBOOK_TREE=no src_build) $(QUIET)$(call silent_on_success,Calling 'infer help --write-website',\ $(INFER_BIN) help --write-website "$(WEBSITE_DIR)") .PHONY: new-website-version +# note: deletes already-created new version if already there to make it easier to update new +# versions while preparing a release new-website-version: doc-publish # this will version docs/ appropriately cd $(WEBSITE_DIR) && \ + rm -rf versioned_*/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)* ; \ + sed -i -e '/"$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)"/d' versions.json ; \ yarn run docusaurus docs:version $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH) # copy static versioned resources cd $(WEBSITE_DIR)/static/man && \ + rm -fr $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ ; \ cp -a next/ $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ cd $(WEBSITE_DIR)/static/odoc && \ + rm -fr $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ ; \ cp -a next/ $(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ # adjust intra-doc paths in new doc version cd $(WEBSITE_DIR)/versioned_docs/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ && \ @@ -944,8 +950,10 @@ new-website-version: doc-publish cd $(WEBSITE_DIR)/versioned_docs/version-$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/ && \ find . -type f -not -name versions.md \ -exec sed -i -e 's#/next/#/$(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH)/#g' \{\} \+ -# adjust versions.md, the page where users can navigate to other versions of the docs +# adjust versions.md, the page where users can navigate to other versions of the docs, unless +# it was already changed by an earlier run of this rule cd $(WEBSITE_DIR)/ && \ + grep -q -F 'latest released version ($(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH))' docs/versions.md || \ find docs versioned_docs -name versions.md \ -exec sed -i -e 's#^- \[latest released version (\([^)]*\))\](/docs/getting-started)$$#- [latest released version ($(INFER_MAJOR).$(INFER_MINOR).$(INFER_PATCH))](/docs/getting-started)\n- [previous version (\1)](/docs/\1/getting-started)#' \{\} \+