kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From granthe...@apache.org
Subject [kudu] 02/02: [docs] Update the site build to use the release directory
Date Thu, 11 Jul 2019 12:58:28 GMT
This is an automated email from the ASF dual-hosted git repository.

granthenke pushed a commit to branch branch-1.10.x
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit 567782e0377c554433970b66f7a66f62783b8b8d
Author: Grant Henke <granthenke@apache.org>
AuthorDate: Wed Jul 10 12:21:14 2019 -0500

    [docs] Update the site build to use the release directory
    
    Updates the make_site.sh script and make_docs.sh script
    to generate docs in the versioned release directory. This
    matches the new symbolic linking style we have been
    using for the docs and avoids the need to manually copy
    the docs during release.
    
    An additional flag to skip updating the symbolic links (`—no-link`) was added.
    
    Change-Id: I174de2d7041bba20cdc3dcacd3efbb5e736ecb63
    Reviewed-on: http://gerrit.cloudera.org:8080/13835
    Reviewed-by: Andrew Wong <awong@cloudera.com>
    Tested-by: Andrew Wong <awong@cloudera.com>
    (cherry picked from commit 819a85fbb1d836f70a50c136dfcdaebc37faf7a8)
    Reviewed-on: http://gerrit.cloudera.org:8080/13840
    Tested-by: Kudu Jenkins
---
 docs/support/scripts/make_docs.sh | 16 ++++++++++---
 docs/support/scripts/make_site.sh | 49 ++++++++++++++++++++++++++++++++-------
 2 files changed, 54 insertions(+), 11 deletions(-)

diff --git a/docs/support/scripts/make_docs.sh b/docs/support/scripts/make_docs.sh
index b9837ba..1b0b742 100755
--- a/docs/support/scripts/make_docs.sh
+++ b/docs/support/scripts/make_docs.sh
@@ -31,7 +31,7 @@
 set -e
 
 usage() {
-  echo usage: "$0 --build_root <path to build root> [--site <path to gh-pages checkout>]"
+  echo usage: "$0 --build_root <path> --output_subdir <relative path> [--site
<path to gh-pages checkout>]"
 }
 
 while [[ $# > 0 ]] ; do
@@ -60,7 +60,15 @@ while [[ $# > 0 ]] ; do
           exit 1
         fi
         SITE=$(cd $SITE && pwd)
-        OUTPUT_DIR=$SITE/docs
+        ;;
+      --output_subdir|-o)
+        OUTPUT_SUBDIR=$2
+        if [ -z "$OUTPUT_SUBDIR" ]; then
+          usage
+          exit 1
+        fi
+        shift
+        shift
         ;;
       --no-jekyll)
         NO_JEKYLL=1
@@ -78,7 +86,9 @@ if [ -z "$BUILD_ROOT" ]; then
 fi
 
 if [ -z "$SITE" ]; then
-  OUTPUT_DIR=$BUILD_ROOT/docs
+  OUTPUT_DIR=$BUILD_ROOT/$OUTPUT_SUBDIR
+else
+  OUTPUT_DIR=$SITE/$OUTPUT_SUBDIR
 fi
 
 GEN_DOC_DIR=$BUILD_ROOT/gen-docs
diff --git a/docs/support/scripts/make_site.sh b/docs/support/scripts/make_site.sh
index e6cd7f3..0d7d738 100755
--- a/docs/support/scripts/make_site.sh
+++ b/docs/support/scripts/make_site.sh
@@ -24,17 +24,22 @@ set -e
 
 BUILD_TYPE=release
 SOURCE_ROOT=$(cd $(dirname $0)/../../..; pwd)
+VERSION=$(cat $SOURCE_ROOT/version.txt)
 BUILD_ROOT="$SOURCE_ROOT/build/$BUILD_TYPE"
 SITE_OUTPUT_DIR="$BUILD_ROOT/site"
+RELEASE_SUBDIR=releases/$VERSION
+RELEASE_OUTPUT_DIR="$SITE_OUTPUT_DIR/releases/$VERSION"
 
 OPT_DOXYGEN=1 # By default, build doxygen docs.
 OPT_JAVADOC=1 # By default, build javadocs.
+OPT_LINK=1 # By default, update the top level symbolic links.
 OPT_FORCE='' # By default, don't overwrite the destination directory.
 
 usage() {
   echo "Usage: $0 [--no-doxygen] [--no-javadoc] [--force]"
   echo "Specify --no-doxygen to skip generation of the C++ client API docs"
   echo "Specify --no-javadoc to skip generation of the Java API docs"
+  echo "Specify --no-link to skip updating the top level symbolic links"
   echo "Specify --force to overwrite the destination directory, if it exists"
   exit 1
 }
@@ -44,6 +49,7 @@ if [ $# -gt 0 ]; then
     case $arg in
       "--no-doxygen")  OPT_DOXYGEN='' ;;
       "--no-javadoc")  OPT_JAVADOC='' ;;
+      "--no-link")     OPT_LINK='' ;;
       "--force")       OPT_FORCE=1 ;;
       "--help")        usage ;;
       "-h")            usage ;;
@@ -96,16 +102,27 @@ if [ -d "$SITE_OUTPUT_DIR" -a -n "$OPT_FORCE" ]; then
 fi
 git clone -q "$GIT_REMOTE" --reference "$SOURCE_ROOT" -b gh-pages --depth 1 "$SITE_OUTPUT_DIR"
 
+# Make the RELEASE_OUTPUT_DIR in case it doesn't exist.
+mkdir -p "$RELEASE_OUTPUT_DIR"
+
 # Build the docs using the styles from the Jekyll site
-rm -Rf "$SITE_OUTPUT_DIR/docs"
-$SOURCE_ROOT/docs/support/scripts/make_docs.sh --build_root $BUILD_ROOT --site "$SITE_OUTPUT_DIR"
-if [ -f "$SITE_OUTPUT_DIR/docs/index.html" ]; then
+DOC_SUBDIR="docs"
+rm -Rf "$RELEASE_OUTPUT_DIR/$DOC_SUBDIR"
+$SOURCE_ROOT/docs/support/scripts/make_docs.sh --build_root $BUILD_ROOT --site "$SITE_OUTPUT_DIR"
\
+                                               --output_subdir "$RELEASE_SUBDIR/$DOC_SUBDIR"
+if [ -f "$RELEASE_OUTPUT_DIR/docs/index.html" ]; then
   echo "Successfully built docs."
 else
   echo "Docs failed to build."
   exit 1
 fi
 
+if [ -n "$OPT_LINK" ]; then
+  # Update the top level docs symbolic link.
+  rm "$SITE_OUTPUT_DIR/$DOC_SUBDIR"
+  ln -s "$RELEASE_SUBDIR/$DOC_SUBDIR" "$SITE_OUTPUT_DIR/$DOC_SUBDIR"
+fi
+
 if [ -n "$OPT_JAVADOC" ]; then
   JAVADOC_SUBDIR="apidocs"
   cd "$SOURCE_ROOT/java"
@@ -122,14 +139,26 @@ if [ -n "$OPT_JAVADOC" ]; then
     exit 1
   fi
 
-  rm -Rf "$SITE_OUTPUT_DIR/$JAVADOC_SUBDIR"
-  cp -a "$SOURCE_ROOT/java/build/docs/javadoc/." "$SITE_OUTPUT_DIR/$JAVADOC_SUBDIR"
+  rm -Rf "$RELEASE_OUTPUT_DIR/$JAVADOC_SUBDIR"
+  cp -a "$SOURCE_ROOT/java/build/docs/javadoc/." "$RELEASE_OUTPUT_DIR/$JAVADOC_SUBDIR"
+
+  if [ -n "$OPT_LINK" ]; then
+    # Update the top level javadoc symbolic link.
+    rm "$SITE_OUTPUT_DIR/$JAVADOC_SUBDIR"
+    ln -s "$RELEASE_SUBDIR/$JAVADOC_SUBDIR" "$SITE_OUTPUT_DIR/$JAVADOC_SUBDIR"
+  fi
 fi
 
 if [ -n "$OPT_DOXYGEN" ]; then
   CPP_CLIENT_API_SUBDIR="cpp-client-api"
-  rm -Rf "$SITE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
-  cp -a "$BUILD_ROOT/docs/doxygen/client_api/html" "$SITE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
+  rm -Rf "$RELEASE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
+  cp -a "$BUILD_ROOT/docs/doxygen/client_api/html" "$RELEASE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
+
+  if [ -n "$OPT_LINK" ]; then
+    # Update the top level cpp-client-api symbolic link.
+    rm "$SITE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
+    ln -s "$RELEASE_SUBDIR/$CPP_CLIENT_API_SUBDIR" "$SITE_OUTPUT_DIR/$CPP_CLIENT_API_SUBDIR"
+  fi
 fi
 
 SITE_SUBDIRS="docs"
@@ -142,9 +171,13 @@ fi
 
 cd "$SITE_OUTPUT_DIR"
 SITE_ARCHIVE="$SITE_OUTPUT_DIR/website_archive.zip"
-zip -rq "$SITE_ARCHIVE" $SITE_SUBDIRS
+zip -rq "$SITE_ARCHIVE" "$RELEASE_OUTPUT_DIR"
 
 set +x
 echo "Generated web site at $SITE_OUTPUT_DIR"
+echo "Release documentation generated at $RELEASE_OUTPUT_DIR"
+if [ -n "$OPT_LINK" ]; then
+  echo "Top level symbolic links were updated"
+fi
 echo "Docs zip generated at $SITE_ARCHIVE"
 echo "To view live site locally, run: (cd $SITE_OUTPUT_DIR && ./site_tool jekyll
serve)"


Mime
View raw message