diff options
Diffstat (limited to 'scripts/generate-doc.sh')
| -rwxr-xr-x | scripts/generate-doc.sh | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/scripts/generate-doc.sh b/scripts/generate-doc.sh new file mode 100755 index 0000000..90205ee --- /dev/null +++ b/scripts/generate-doc.sh | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | help() | ||
| 4 | { | ||
| 5 | echo "Generate and add eclipse help from yocto's documentation" | ||
| 6 | echo "Usage: [DOC_GIT=url_of_repo] $0 BRANCH_NAME PLUGIN_FOLDER" | ||
| 7 | echo " [DOC_GIT=url_of_repo] $0 -t TAG_NAME PLUGIN_FOLDER" | ||
| 8 | echo "" | ||
| 9 | echo "Options:" | ||
| 10 | echo "-h - display this help and exit" | ||
| 11 | echo "-t TAG_NAME - tag to build the documentation upon" | ||
| 12 | echo "BRANCH_NAME - branch to build the documentation upon" | ||
| 13 | echo "PLUGIN_FOLDER - root folder of the eclipse-poky project" | ||
| 14 | echo "DOC_GIT - use this repo for documentation. Defaults to git://git.pokylinux.org/yocto-docs.git if not set" | ||
| 15 | exit 1 | ||
| 16 | } | ||
| 17 | |||
| 18 | fail () | ||
| 19 | { | ||
| 20 | local retval=$1 | ||
| 21 | shift $1 | ||
| 22 | echo "[Fail $retval]: $*" | ||
| 23 | echo "BUILD_TOP=${BUILD_TOP}" | ||
| 24 | cd ${TOP} | ||
| 25 | exit ${retval} | ||
| 26 | } | ||
| 27 | |||
| 28 | CHECKOUT_TAG=0 | ||
| 29 | while getopts ":ht" opt; do | ||
| 30 | case $opt in | ||
| 31 | h) | ||
| 32 | help | ||
| 33 | ;; | ||
| 34 | t) | ||
| 35 | CHECKOUT_TAG=1 | ||
| 36 | ;; | ||
| 37 | esac | ||
| 38 | done | ||
| 39 | shift $(($OPTIND - 1)) | ||
| 40 | |||
| 41 | if [ $# -ne 2 ]; then | ||
| 42 | help | ||
| 43 | fi | ||
| 44 | |||
| 45 | if [ $CHECKOUT_TAG -eq 0 ]; then | ||
| 46 | REFERENCE=origin/$1 | ||
| 47 | else | ||
| 48 | REFERENCE=$1 | ||
| 49 | fi | ||
| 50 | PLUGIN_FOLDER=`readlink -f $2` | ||
| 51 | |||
| 52 | TOP=`pwd` | ||
| 53 | |||
| 54 | DOC_DIR=${PLUGIN_FOLDER}/docs | ||
| 55 | rm -rf ${DOC_DIR} | ||
| 56 | DOC_PLUGIN_DIR=${PLUGIN_FOLDER}/plugins/org.yocto.doc.user | ||
| 57 | DOC_HTML_DIR=${DOC_PLUGIN_DIR}/html/ | ||
| 58 | |||
| 59 | # git clone | ||
| 60 | DOC_GIT=${DOC_GIT:-git://git.yoctoproject.org/yocto-docs.git} | ||
| 61 | |||
| 62 | git clone ${DOC_GIT} ${DOC_DIR} || fail $? "git clone ${DOC_GIT}" | ||
| 63 | cd ${DOC_DIR} | ||
| 64 | git checkout ${REFERENCE} || fail $? "git checkout ${REFERENCE}" | ||
| 65 | COMMIT_ID=`git rev-parse HEAD` | ||
| 66 | |||
| 67 | # build and copy | ||
| 68 | DOCS="yocto-project-qs adt-manual kernel-dev \ | ||
| 69 | bsp-guide ref-manual dev-manual profile-manual" | ||
| 70 | |||
| 71 | cd documentation | ||
| 72 | ECLIPSE_TARGET_AVAILABLE=`make -q eclipse &> /dev/null; echo $?` | ||
| 73 | if [ ${ECLIPSE_TARGET_AVAILABLE} -ne 1 ]; then | ||
| 74 | echo "WARNING:" | ||
| 75 | echo "This version does not support generating eclipse help" | ||
| 76 | echo "Documentation will not be available in eclipse" | ||
| 77 | exit 1 | ||
| 78 | fi | ||
| 79 | |||
| 80 | for DOC in ${DOCS}; do | ||
| 81 | make DOC=${DOC} eclipse | ||
| 82 | cp -rf ${DOC}/eclipse/html/* ${DOC_HTML_DIR} | ||
| 83 | cp -f ${DOC}/eclipse/${DOC}-toc.xml ${DOC_HTML_DIR} | ||
| 84 | done | ||
| 85 | |||
| 86 | sed -e "s/@.*@/${COMMIT_ID}/" < ${DOC_PLUGIN_DIR}/about.html.in > ${DOC_PLUGIN_DIR}/about.html | ||
| 87 | |||
| 88 | cd ${TOP} | ||
