[llvm] fe7fe6d - build-docs: Add option to disable doxygen/sphinx docs (#66928)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 01:41:37 PDT 2023


Author: Tobias Hieta
Date: 2023-09-22T10:41:33+02:00
New Revision: fe7fe6d3437da98017b93c99737e421c35e52b7b

URL: https://github.com/llvm/llvm-project/commit/fe7fe6d3437da98017b93c99737e421c35e52b7b
DIFF: https://github.com/llvm/llvm-project/commit/fe7fe6d3437da98017b93c99737e421c35e52b7b.diff

LOG: build-docs: Add option to disable doxygen/sphinx docs (#66928)

Doxygen documentation takes very long to build, when making releases we
want to get the normal documentation up earlier so that we don't have to
wait for doxygen documentation.

This PR just adds the flag to disable doxygen builds, I will then later
make a PR that changes the actions to first build the normal docs and
another job to build the doxygen docs.

Added: 
    

Modified: 
    llvm/utils/release/build-docs.sh

Removed: 
    


################################################################################
diff  --git a/llvm/utils/release/build-docs.sh b/llvm/utils/release/build-docs.sh
index ef3784959b4f3aa..1ab7561da9c0148 100755
--- a/llvm/utils/release/build-docs.sh
+++ b/llvm/utils/release/build-docs.sh
@@ -20,7 +20,7 @@
 #   * pip install sphinx-markdown-tables
 #===------------------------------------------------------------------------===#
 
-set -ex
+set -e
 
 builddir=docs-build
 srcdir=$(readlink -f $(dirname "$(readlink -f "$0")")/../..)
@@ -34,6 +34,8 @@ usage() {
   echo "                documentation from that source."
   echo " -srcdir  <dir> Path to llvm source directory with CMakeLists.txt"
   echo "                (optional) default: $srcdir"
+  echo " -no-doxygen    Don't build Doxygen docs"
+  echo " -no-sphinx     Don't build Spinx docs"
 }
 
 package_doxygen() {
@@ -57,6 +59,12 @@ while [ $# -gt 0 ]; do
       shift
       custom_srcdir=$1
       ;;
+    -no-doxygen )
+      no_doxygen="yes"
+      ;;
+    -no-sphinx )
+      no_sphinx="yes"
+      ;;
     * )
       echo "unknown option: $1"
       usage
@@ -89,28 +97,35 @@ if [ -n "$release" ]; then
   srcdir="./llvm-project/llvm"
 fi
 
+if [ "$no_doxygen" == "yes" ] && [ "$no_sphinx" == "yes" ]; then
+  echo "You can't specify both -no-doxygen and -no-sphinx, we have nothing to build then!"
+  exit 1
+fi
+
+if [ "$no_sphinx" != "yes" ]; then
+  echo "Sphinx: enabled"
+  sphinx_targets="docs-clang-html docs-clang-tools-html docs-flang-html docs-lld-html docs-llvm-html docs-polly-html"
+  sphinx_flag=" -DLLVM_ENABLE_SPHINX=ON -DSPHINX_WARNINGS_AS_ERRORS=OFF"
+else
+  echo "Sphinx: disabled"
+fi
+
+if [ "$no_doxygen" != "yes" ]; then
+  echo "Doxygen: enabled"
+  doxygen_targets="$docs_target doxygen-clang doxygen-clang-tools doxygen-flang doxygen-llvm doxygen-mlir doxygen-polly"
+  doxygen_flag=" -DLLVM_ENABLE_DOXYGEN=ON -DLLVM_DOXYGEN_SVG=ON"
+else
+   echo "Doxygen: disabled"
+fi
+
 cmake -G Ninja $srcdir -B $builddir \
                -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;polly;flang" \
                -DCMAKE_BUILD_TYPE=Release \
-               -DLLVM_ENABLE_DOXYGEN=ON \
-               -DLLVM_ENABLE_SPHINX=ON \
                -DLLVM_BUILD_DOCS=ON \
-               -DLLVM_DOXYGEN_SVG=ON \
-               -DSPHINX_WARNINGS_AS_ERRORS=OFF
+               $sphinx_flag \
+               $doxygen_flag
 
-ninja -C $builddir \
-               docs-clang-html \
-               docs-clang-tools-html \
-               docs-flang-html \
-               docs-lld-html \
-               docs-llvm-html \
-               docs-polly-html \
-               doxygen-clang \
-               doxygen-clang-tools \
-               doxygen-flang \
-               doxygen-llvm \
-               doxygen-mlir \
-               doxygen-polly
+ninja -C $builddir $sphinx_targets $doxygen_targets
 
 cmake -G Ninja $srcdir/../runtimes -B $builddir/runtimes-doc \
                -DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
@@ -120,10 +135,16 @@ cmake -G Ninja $srcdir/../runtimes -B $builddir/runtimes-doc \
 ninja -C $builddir/runtimes-doc \
                docs-libcxx-html \
 
-package_doxygen llvm .
-package_doxygen clang tools/clang
-package_doxygen clang-tools-extra tools/clang/tools/extra
-package_doxygen flang tools/flang
+if [ "$no_doxygen" != "yes" ]; then
+  package_doxygen llvm .
+  package_doxygen clang tools/clang
+  package_doxygen clang-tools-extra tools/clang/tools/extra
+  package_doxygen flang tools/flang
+fi
+
+if [ "$no_sphinx" == "yes" ]; then
+  exit 0
+fi
 
 html_dir=$builddir/html-export/
 


        


More information about the llvm-commits mailing list