From 31390da3ccddb6affa4dc1807f1ff2a806795b18 Mon Sep 17 00:00:00 2001 From: Wang Date: Sun, 27 Aug 2017 00:59:42 -0700 Subject: [PATCH 1/3] Add script to build doc files for all versions --- docs/build_version_doc/build_all_version.sh | 82 +++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100755 docs/build_version_doc/build_all_version.sh diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh new file mode 100755 index 000000000000..2ceeffa9b834 --- /dev/null +++ b/docs/build_version_doc/build_all_version.sh @@ -0,0 +1,82 @@ +#!/bin/bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# This script is for locally building website for all versions +# Built files are stored in $built +# Version numbers are stored in $tag_list. +# Version numbers are ordered from latest to old and final one is master. +tag_list="0.11.0.rc3 0.11.0.rc2 master" + +mxnet_url="https://github.com/apache/incubator-mxnet.git" +mxnet_folder="apache_mxnet" +built="VersionedWeb" +mkdir $built +mkdir "$built/versions" + +git clone $mxnet_url $mxnet_folder --recursive +cd "$mxnet_folder/docs" +tag_file="tag_list.txt" + +# Wite all version numbers into $tag_file +for tag in $tag_list; do + if [ $tag != 'master' ] + then + echo "$tag" >> "$tag_file" + fi +done + +# Build all versions and use latest version(First version number in $tag_list) as landing page. +version_num=0 +for tag in $tag_list; do + if [ $tag == 'master' ] + then + git checkout master + else + git checkout "tags/$tag" + fi + + git submodule update || exit 1 + cd .. + make clean + cd docs + make clean + make html USE_OPENMP=0 || exit 1 + python ../../AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1 + + if [ $tag != 'master' ] + then + python ../../AddPackageLink.py --file_path "_build/html/get_started/install.html" \ + --current_version "$tag" || exit 1 + fi + + if [ $version_num == 0 ] + then + cp -a _build/html/. "../../$built" + else + file_loc="../../$built/versions/$tag" + mkdir "$file_loc" + cp -a _build/html/. "$file_loc" + fi + + ((++version_num)) +done + +mv "$tag_file" "../../$built/tag.txt" +cd ../.. +rm -rf "$mxnet_folder" From ff11757fc63e6e15a2e5d5c1f2f08775041035b0 Mon Sep 17 00:00:00 2001 From: Wang Date: Sun, 27 Aug 2017 01:03:08 -0700 Subject: [PATCH 2/3] Fix --- docs/build_version_doc/build_all_version.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index 2ceeffa9b834..dfa81d1b2d54 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -21,7 +21,7 @@ # Built files are stored in $built # Version numbers are stored in $tag_list. # Version numbers are ordered from latest to old and final one is master. -tag_list="0.11.0.rc3 0.11.0.rc2 master" +tag_list="0.11.0.rc3 master" mxnet_url="https://github.com/apache/incubator-mxnet.git" mxnet_folder="apache_mxnet" @@ -33,7 +33,7 @@ git clone $mxnet_url $mxnet_folder --recursive cd "$mxnet_folder/docs" tag_file="tag_list.txt" -# Wite all version numbers into $tag_file +# Write all version numbers into $tag_file for tag in $tag_list; do if [ $tag != 'master' ] then From db4f9cb1770556966ebef52b498ca23dffd3e704 Mon Sep 17 00:00:00 2001 From: Wang Date: Sun, 27 Aug 2017 01:13:06 -0700 Subject: [PATCH 3/3] Use add versipn script of each different version --- docs/build_version_doc/build_all_version.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index dfa81d1b2d54..140e51a3d3a1 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -57,12 +57,12 @@ for tag in $tag_list; do cd docs make clean make html USE_OPENMP=0 || exit 1 - python ../../AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1 + python build_version_doc/AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1 if [ $tag != 'master' ] then - python ../../AddPackageLink.py --file_path "_build/html/get_started/install.html" \ - --current_version "$tag" || exit 1 + python build_version_doc/AddPackageLink.py --file_path "_build/html/get_started/install.html" \ + --current_version "$tag" || exit 1 fi if [ $version_num == 0 ]