From 71fce674e35c377f8f16bd58a7c54d01928b5c85 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Wed, 4 Oct 2017 14:45:38 -0700 Subject: [PATCH 1/6] changed url references from dmlc to apache/incubator-mxnet --- docs/community/contribute.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/community/contribute.md b/docs/community/contribute.md index 3a39743af33d..7a38295a5a20 100644 --- a/docs/community/contribute.md +++ b/docs/community/contribute.md @@ -2,7 +2,7 @@ MXNet has been developed and is used by a group of active community members. Please contribute to improve the project. -After your patch has been merged, remember to add your name to [CONTRIBUTORS.md](https://github.com/dmlc/mxnet/blob/master/CONTRIBUTORS.md). +After your patch has been merged, remember to add your name to [CONTRIBUTORS.md](https://github.com/apache/incubator-mxnet/blob/master/CONTRIBUTORS.md). ## Code Contribution @@ -44,8 +44,8 @@ make roxygen. ``` #### R Markdown Vignettes -R Markdown vignettes are located on GitHub in [R-package/vignettes](https://github.com/dmlc/mxnet/tree/master/R-package/vignettes). -These R Markdown files aren't compiled. We host the compiled version on [doc/R-package](https://github.com/dmlc/mxnet/tree/master/R-package/). +R Markdown vignettes are located on GitHub in [R-package/vignettes](https://github.com/apache/incubator-mxnet/tree/master/R-package/vignettes). +These R Markdown files aren't compiled. We host the compiled version on [doc/R-package](https://github.com/apache/incubator-mxnet/tree/master/R-package/). To add a new R Markdown vignettes: @@ -68,12 +68,12 @@ make html ### Test Cases -* All of our tests can be found in the GitHub repo in [this directory](https://github.com/dmlc/mxnet/tree/master/tests). +* All of our tests can be found in the GitHub repo in [this directory](https://github.com/apache/incubator-mxnet/tree/master/tests). * We use Python nose for python test cases, and gtest for C++ unit tests. ### Examples -* Use cases and examples are on GitHub in [examples](https://github.com/dmlc/mxnet/tree/master/example) +* Use cases and examples are on GitHub in [examples](https://github.com/apache/incubator-mxnet/tree/master/example) * If you write a blog post or tutorial about or using MXNet, please tell us by creating an issue in our github repo. We regularly feature high-quality contributed content from the community. @@ -86,7 +86,7 @@ Make sure to add documentation with any code you contribute. Follow these standa * Follow [numpy doc standards](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard) and some changes we made [MXNet doc standards](https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#docstring-standard). * If an API is implemented in Python or has a wrapper defined, the documentation and the examples reside -where the function is defined in `.py` file in [python/mxnet](https://github.com/dmlc/mxnet/tree/master/python/mxnet) folder. Same goes for other languages. +where the function is defined in `.py` file in [python/mxnet](https://github.com/apache/incubator-mxnet/tree/master/python/mxnet) folder. Same goes for other languages. * If the API is dynamically generated from the MXNet backend, the documentation is in the C++ code(.cc file) where the operator is registered in describe method of the `NNVM_REGISTER_OP`. The file and line number for the function is usually printed with the API documentation on mxnet.io. @@ -111,7 +111,7 @@ make lint * Before submitting your contribution, rebase your code on the most recent version of the master: ```bash - git remote add upstream https://github.com/dmlc/mxnet + git remote add upstream https://github.com/apache/incubator-mxnet git fetch upstream git rebase upstream/master ``` @@ -119,7 +119,7 @@ make lint merge them into meaningful groups (use ```git rebase``` then ```squash```). * Send the pull request. * Fix problems reported by automatic checks. -* If you are contributing a new module, consider adding a test case in [tests](https://github.com/dmlc/mxnet/tree/master/tests). +* If you are contributing a new module, consider adding a test case in [tests](https://github.com/apache/incubator-mxnet/tree/master/tests). ### Resolving a Conflict with the Master @@ -127,7 +127,7 @@ make lint ```bash # The first two steps can be skipped after you do it once. - git remote add upstream https://github.com/dmlc/mxnet + git remote add upstream https://github.com/apache/incubator-mxnet git fetch upstream git rebase upstream/master ``` From 84393ef4159222519bcc42c23a13f192e2afe484 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Sat, 24 Feb 2018 16:35:07 +0000 Subject: [PATCH 2/6] refactored build all docs --- docs/build_version_doc/build_all_version.sh | 31 +++------- docs/build_version_doc/setup_docker.sh | 17 ++++++ docs/build_version_doc/setup_docs_ubuntu.sh | 42 +++++++++++++ docs/build_version_doc/update_all_version.sh | 62 ++++++++++++++++++++ 4 files changed, 130 insertions(+), 22 deletions(-) create mode 100755 docs/build_version_doc/setup_docker.sh create mode 100755 docs/build_version_doc/setup_docs_ubuntu.sh create mode 100755 docs/build_version_doc/update_all_version.sh diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index 6a37815fd50e..68154acb408e 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -29,10 +29,16 @@ tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" mxnet_url="https://github.com/apache/incubator-mxnet.git" mxnet_folder="apache_mxnet" built="VersionedWeb" + +if [ ! -d "$mxnet_folder" ]; then + mkdir $mxnet_folder + git clone $mxnet_url $mxnet_folder --recursive +fi + +rm -rf $built mkdir $built mkdir "$built/versions" -git clone $mxnet_url $mxnet_folder --recursive cd "$mxnet_folder/docs" tag_file="tag_list.txt" @@ -59,27 +65,8 @@ for tag in $tag_list; do make clean cd docs make clean - make html USE_OPENMP=0 || exit 1 - python build_version_doc/AddVersion.py --file_path "_build/html/" --current_version "$tag" || exit 1 - - if [ $tag != 'master' ] - then - python build_version_doc/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 + make html USE_OPENMP=1 || exit 1 ((++version_num)) done - -mv "$tag_file" "../../$built/tag.txt" -cd ../.. -rm -rf "$mxnet_folder" + diff --git a/docs/build_version_doc/setup_docker.sh b/docs/build_version_doc/setup_docker.sh new file mode 100755 index 000000000000..1d060ce8d702 --- /dev/null +++ b/docs/build_version_doc/setup_docker.sh @@ -0,0 +1,17 @@ +# Setup Docker +# add docker's GPG key +curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + +# verify it +sudo apt-key fingerprint 0EBFCD88 +# add docker repo +sudo add-apt-repository \ + "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) \ + stable" +sudo apt-get update +sudo apt-get install docker-ce -y +sudo docker run hello-world + +# Cleanup +sudo apt autoremove -y diff --git a/docs/build_version_doc/setup_docs_ubuntu.sh b/docs/build_version_doc/setup_docs_ubuntu.sh new file mode 100755 index 000000000000..5b3127b914e3 --- /dev/null +++ b/docs/build_version_doc/setup_docs_ubuntu.sh @@ -0,0 +1,42 @@ +# If you need to build <= v0.12.0 then use a Python 2 environment +# mxdoc.py - a sphinx extension, was not Python 3 compatible in the old versions +# source activate mxnet_p27 + +# Install dependencies +sudo apt-get update +sudo apt-get install -y \ + apt-transport-https \ + ca-certificates \ + curl \ + doxygen \ + software-properties-common + +pip install --user \ + beautifulsoup4 \ + breathe \ + CommonMark==0.5.4 \ + h5py \ + mock==1.0.1 \ + pypandoc \ + recommonmark==0.4.0 \ + sphinx==1.5.6 + +# Recommonmark/Sphinx errors: https://github.com/sphinx-doc/sphinx/issues/3800 + + +# Setup scala +echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list +sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 +sudo apt-get update +sudo apt-get install -y \ + sbt \ + scala + +# Cleanup +sudo apt autoremove -y + +# Make docs using the manual way +# cd .. && make html USE_OPENMP=0 +# using the docker way +# sudo make docs + diff --git a/docs/build_version_doc/update_all_version.sh b/docs/build_version_doc/update_all_version.sh new file mode 100755 index 000000000000..9d9200dc0299 --- /dev/null +++ b/docs/build_version_doc/update_all_version.sh @@ -0,0 +1,62 @@ +#!/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. +set -e +set -x + +# Chane to your local IP for dev builds +root_url="http://mxnet.incubator.apache.org/" +root_url="http://34.229.119.204/" + +tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" + +mxnet_folder="apache_mxnet" +built="VersionedWeb" +tag_file="tag_list.txt" + +cp "$mxnet_folder/docs/$tag_file" "tag_list.txt" + +# 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 + python AddVersion.py --root_url "$root_url" --file_path "$mxnet_folder/docs/_build/html/" --current_version "$tag" || exit 1 + + if [ $tag != 'master' ] + then + python AddPackageLink.py --file_path "$mxnet_folder/docs/_build/html/install/index.html" \ + --current_version "$tag" || exit 1 + fi + + if [ $version_num == 0 ] + then + cp -a "$mxnet_folder/docs/_build/html/." "$built" + else + file_loc="$built/versions/$tag" + rm -rf "$file_loc" + mkdir "$file_loc" + cp -a $mxnet_folder/docs/_build/html/. "$file_loc" + fi + + ((++version_num)) +done + From a22955fff9e819924fbf89e966050d9c7346c5f8 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Mon, 26 Feb 2018 04:36:03 +0000 Subject: [PATCH 3/6] Created dockerfile and modified scripts to support it. --- docs/build_version_doc/Dockerfile | 44 ++++++++++++++++++++ docs/build_version_doc/build_all_version.sh | 1 + docs/build_version_doc/setup_docker.sh | 17 -------- docs/build_version_doc/setup_docs_ubuntu.sh | 1 + docs/build_version_doc/update_all_version.sh | 4 +- 5 files changed, 49 insertions(+), 18 deletions(-) create mode 100755 docs/build_version_doc/Dockerfile delete mode 100755 docs/build_version_doc/setup_docker.sh diff --git a/docs/build_version_doc/Dockerfile b/docs/build_version_doc/Dockerfile new file mode 100755 index 000000000000..0f167bf5fe68 --- /dev/null +++ b/docs/build_version_doc/Dockerfile @@ -0,0 +1,44 @@ +FROM ubuntu:16.04 +LABEL maintainer="markhama@amazon.com" + +# Install dependencies +RUN apt-get update && apt-get install -y \ + apt-transport-https \ + build-essential \ + ca-certificates \ + curl \ + doxygen \ + git \ + libatlas-base-dev \ + liblapack-dev \ + libopenblas-dev \ + libopencv-dev \ + pandoc \ + python-numpy \ + python-pip \ + software-properties-common \ + unzip \ + wget + +# Setup Scala +RUN echo "deb https://dl.bintray.com/sbt/debian /" | tee -a /etc/apt/sources.list.d/sbt.list +RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 +RUN apt-get update && apt-get install -y \ + sbt \ + scala + +RUN pip install --upgrade pip && pip install \ + beautifulsoup4 \ + breathe \ + CommonMark==0.5.4 \ + h5py \ + mock==1.0.1 \ + pypandoc \ + recommonmark==0.4.0 \ + sphinx==1.5.6 + + +COPY *_all_version.sh / +COPY *.py / +RUN /build_all_version.sh +RUN /update_all_version.sh diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index 68154acb408e..c1bad135fa7f 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -70,3 +70,4 @@ for tag in $tag_list; do ((++version_num)) done +echo "Now you may want to run update_all_version.sh to create the production layout with the versions dropdown and other per-version corrections." diff --git a/docs/build_version_doc/setup_docker.sh b/docs/build_version_doc/setup_docker.sh deleted file mode 100755 index 1d060ce8d702..000000000000 --- a/docs/build_version_doc/setup_docker.sh +++ /dev/null @@ -1,17 +0,0 @@ -# Setup Docker -# add docker's GPG key -curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - - -# verify it -sudo apt-key fingerprint 0EBFCD88 -# add docker repo -sudo add-apt-repository \ - "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ - $(lsb_release -cs) \ - stable" -sudo apt-get update -sudo apt-get install docker-ce -y -sudo docker run hello-world - -# Cleanup -sudo apt autoremove -y diff --git a/docs/build_version_doc/setup_docs_ubuntu.sh b/docs/build_version_doc/setup_docs_ubuntu.sh index 5b3127b914e3..0b987071e990 100755 --- a/docs/build_version_doc/setup_docs_ubuntu.sh +++ b/docs/build_version_doc/setup_docs_ubuntu.sh @@ -1,3 +1,4 @@ +#!/bin/bash # If you need to build <= v0.12.0 then use a Python 2 environment # mxdoc.py - a sphinx extension, was not Python 3 compatible in the old versions # source activate mxnet_p27 diff --git a/docs/build_version_doc/update_all_version.sh b/docs/build_version_doc/update_all_version.sh index 9d9200dc0299..cc6af9987ca4 100755 --- a/docs/build_version_doc/update_all_version.sh +++ b/docs/build_version_doc/update_all_version.sh @@ -24,7 +24,7 @@ set -e set -x -# Chane to your local IP for dev builds +# Change to your local IP for dev builds root_url="http://mxnet.incubator.apache.org/" root_url="http://34.229.119.204/" @@ -60,3 +60,5 @@ for tag in $tag_list; do ((++version_num)) done +echo "The output of this process can be found in the VersionedWeb folder." + From 5d6e09821166bb6d0cbe5e5968f840b17c26df4f Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Mon, 26 Feb 2018 04:38:10 +0000 Subject: [PATCH 4/6] add license header --- docs/build_version_doc/setup_docs_ubuntu.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/build_version_doc/setup_docs_ubuntu.sh b/docs/build_version_doc/setup_docs_ubuntu.sh index 0b987071e990..5ae8d9a1614f 100755 --- a/docs/build_version_doc/setup_docs_ubuntu.sh +++ b/docs/build_version_doc/setup_docs_ubuntu.sh @@ -1,4 +1,22 @@ #!/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. + # If you need to build <= v0.12.0 then use a Python 2 environment # mxdoc.py - a sphinx extension, was not Python 3 compatible in the old versions # source activate mxnet_p27 From 02e09d4e9ea4db4e94788895b0e1148d29c42d73 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Mon, 26 Feb 2018 04:42:53 +0000 Subject: [PATCH 5/6] used license header tool this time --- docs/build_version_doc/setup_docs_ubuntu.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/build_version_doc/setup_docs_ubuntu.sh b/docs/build_version_doc/setup_docs_ubuntu.sh index 5ae8d9a1614f..98b9259c6966 100755 --- a/docs/build_version_doc/setup_docs_ubuntu.sh +++ b/docs/build_version_doc/setup_docs_ubuntu.sh @@ -17,6 +17,7 @@ # specific language governing permissions and limitations # under the License. + # If you need to build <= v0.12.0 then use a Python 2 environment # mxdoc.py - a sphinx extension, was not Python 3 compatible in the old versions # source activate mxnet_p27 @@ -38,8 +39,8 @@ pip install --user \ mock==1.0.1 \ pypandoc \ recommonmark==0.4.0 \ - sphinx==1.5.6 - + sphinx==1.5.6 + # Recommonmark/Sphinx errors: https://github.com/sphinx-doc/sphinx/issues/3800 @@ -57,5 +58,5 @@ sudo apt autoremove -y # Make docs using the manual way # cd .. && make html USE_OPENMP=0 # using the docker way -# sudo make docs +# sudo make docs From f1ed43d2d75d559409b996cd19f1ff78d7718511 Mon Sep 17 00:00:00 2001 From: Aaron Markham Date: Tue, 27 Feb 2018 08:35:39 +0000 Subject: [PATCH 6/6] updated scripts to take arguments for flexible use --- docs/build_version_doc/Dockerfile | 6 +- docs/build_version_doc/build_all_version.sh | 62 +++++++++------- docs/build_version_doc/build_site_tag.sh | 65 +++++++++++++++++ docs/build_version_doc/update_all_version.sh | 76 ++++++++++++++------ 4 files changed, 160 insertions(+), 49 deletions(-) create mode 100755 docs/build_version_doc/build_site_tag.sh diff --git a/docs/build_version_doc/Dockerfile b/docs/build_version_doc/Dockerfile index 0f167bf5fe68..204320e32611 100755 --- a/docs/build_version_doc/Dockerfile +++ b/docs/build_version_doc/Dockerfile @@ -38,7 +38,7 @@ RUN pip install --upgrade pip && pip install \ sphinx==1.5.6 -COPY *_all_version.sh / +COPY *.sh / COPY *.py / -RUN /build_all_version.sh -RUN /update_all_version.sh +RUN /build_all_version.sh "1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" +RUN /update_all_version.sh "1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" 1.1.0 http://mxnet.incubator.apache.org/ diff --git a/docs/build_version_doc/build_all_version.sh b/docs/build_version_doc/build_all_version.sh index c1bad135fa7f..4db9326a4464 100755 --- a/docs/build_version_doc/build_all_version.sh +++ b/docs/build_version_doc/build_all_version.sh @@ -19,12 +19,23 @@ # 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. + +# Takes one argument: +# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master" +# Example Usage: +# ./build_all_version.sh "1.1.0 1.0.0 master" + set -e set -x -tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" +if [ -z "$1" ] + then + echo "Please provide a list of version tags you wish to run." + exit 1 + else + tag_list="$1" + echo "Using these tags: $1" +fi mxnet_url="https://github.com/apache/incubator-mxnet.git" mxnet_folder="apache_mxnet" @@ -35,39 +46,38 @@ if [ ! -d "$mxnet_folder" ]; then git clone $mxnet_url $mxnet_folder --recursive fi -rm -rf $built -mkdir $built -mkdir "$built/versions" - -cd "$mxnet_folder/docs" -tag_file="tag_list.txt" - -# Write all version numbers into $tag_file -for tag in $tag_list; do - if [ $tag != 'master' ] - then - echo "$tag" >> "$tag_file" - fi -done +if [ ! -d "$built" ]; then + mkdir $built + mkdir "$built/versions" +fi # 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 + cd "$mxnet_folder" + git fetch if [ $tag == 'master' ] - then - git checkout master - else - git checkout "tags/$tag" + then + git checkout master + git pull + else + git checkout "tags/$tag" + fi + if [ $tag == '0.11.0' ] + then + git checkout master -- docs/mxdoc.py fi - git submodule update || exit 1 - cd .. make clean cd docs make clean make html USE_OPENMP=1 || exit 1 - - ((++version_num)) + cd ../../ + file_loc="$built/versions/$tag" + if [ -d "$file_loc" ] ; then + rm -rf "$file_loc" + fi + mkdir "$file_loc" + cp -a "$mxnet_folder/docs/_build/html/." "$file_loc" done echo "Now you may want to run update_all_version.sh to create the production layout with the versions dropdown and other per-version corrections." diff --git a/docs/build_version_doc/build_site_tag.sh b/docs/build_version_doc/build_site_tag.sh new file mode 100755 index 000000000000..d453e0cc9734 --- /dev/null +++ b/docs/build_version_doc/build_site_tag.sh @@ -0,0 +1,65 @@ +#!/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. + + +# How this script works: +# 1. Receive tag list +# Looks like: tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" +# 2. Receive default tag (for main website view) +# 3. Receive root URL +# 4. Call build and then update scripts + +# Take user input or check env var for tag list +if [ -z "$1" ] + then + echo "No tag list supplied... trying environment variable $TAG_LIST" + else + tag_list="${TAG_LIST:-"$1"}" + echo "Using these tags: $1" +fi + +if [ -z "$tag_list" ] + then + echo "No tags defined" + exit 1 +fi + +if [ -z "$2" ] + then + echo "Please pick a version to use as a default for the website. Ex: 1.1.0" + exit 1 + else + tag_default=$2 +fi + +if [ -z "$3" ] + then + echo "Please provide the root url for the site. Ex: http://mxnet.incubator.apache.org/" + exit 1 + else + root_url=$3 +fi + +# Pass params to build and update scripts +for tag in $tag_list; do + ./build_all_version.sh $tag || exit 1 +done + +./update_all_version.sh "$tag_list" $tag_default $root_url || exit 1 + diff --git a/docs/build_version_doc/update_all_version.sh b/docs/build_version_doc/update_all_version.sh index cc6af9987ca4..e79b97117c5a 100755 --- a/docs/build_version_doc/update_all_version.sh +++ b/docs/build_version_doc/update_all_version.sh @@ -17,47 +17,83 @@ # 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. +# This script will update the html content from building +# different tags. +# It assumes you have already run build_all_version.sh for +# the tags you want to update. + +# Takes three arguments: +# * tag list - space delimited list of Github tags; Example: "1.1.0 1.0.0 master" +# * default tag - which version should the site default to; Example: 1.0.0 +# * root URL - for the versions dropdown to change to production or dev server; Example: http://mxnet.incubator.apache.org/ + +# Example Usage: +# ./update_all_version.sh "1.1.0 1.0.0 master" 1.0.0 http://mxnet.incubator.apache.org/ + set -e set -x -# Change to your local IP for dev builds -root_url="http://mxnet.incubator.apache.org/" -root_url="http://34.229.119.204/" +if [ -z "$1" ] + then + echo "Please provide a list of version tags you wish to run. Ex : \"1.1.0 1.0.0 master\"" + exit 1 + else + tag_list=$1 +fi -tag_list="1.1.0 1.0.0 0.12.1 0.12.0 0.11.0 master" +if [ -z "$2" ] + then + echo "Please pick a version to use as a default for the website. Ex: 1.1.0" + exit 1 + else + tag_default=$2 +fi + +if [ -z "$3" ] + then + echo "Please provide the root url for the site. Ex: http://mxnet.incubator.apache.org/" + exit 1 + else + root_url=$3 +fi mxnet_folder="apache_mxnet" built="VersionedWeb" tag_file="tag_list.txt" -cp "$mxnet_folder/docs/$tag_file" "tag_list.txt" +if [ -f "$tag_file" ]; then + rm $tag_file +fi -# Build all versions and use latest version(First version number in $tag_list) as landing page. -version_num=0 +# Write all version numbers into $tag_file for AddVersion.py to use later +# Master is added by that script by default for tag in $tag_list; do - python AddVersion.py --root_url "$root_url" --file_path "$mxnet_folder/docs/_build/html/" --current_version "$tag" || exit 1 + if [ $tag != 'master' ] + then + echo "$tag" >> "$tag_file" + fi +done + +# Update the specified tags with the Versions dropdown +for tag in $tag_list; do + # This Python script is expecting the tag_list.txt and it will use that as the entries to populate + python AddVersion.py --root_url "$root_url" --file_path "$built/versions/$tag" --current_version "$tag" || exit 1 if [ $tag != 'master' ] then - python AddPackageLink.py --file_path "$mxnet_folder/docs/_build/html/install/index.html" \ + python AddPackageLink.py --file_path "$built/versions/master/install/index.html" \ --current_version "$tag" || exit 1 fi - if [ $version_num == 0 ] + if [ $tag == $tag_default ] then - cp -a "$mxnet_folder/docs/_build/html/." "$built" + cp -a "$built/versions/$tag/." "$built" else file_loc="$built/versions/$tag" - rm -rf "$file_loc" - mkdir "$file_loc" - cp -a $mxnet_folder/docs/_build/html/. "$file_loc" + #rm -rf "$file_loc" + #mkdir "$file_loc" + #cp -a $mxnet_folder/docs/_build/html/. "$file_loc" fi - - ((++version_num)) done echo "The output of this process can be found in the VersionedWeb folder."