include-raw-hicn-docs.sh revision eadf733f
1#!/bin/bash
2set -xe -o pipefail
3
4update_cmake_repo() {
5    cat /etc/resolv.conf
6    echo "nameserver 8.8.8.8" | sudo tee -a /etc/resolv.conf
7    cat /etc/resolv.conf
8
9    CMAKE_INSTALL_SCRIPT_URL="https://cmake.org/files/v3.8/cmake-3.8.0-Linux-x86_64.sh"
10    CMAKE_INSTALL_SCRIPT="/tmp/install_cmake.sh"
11    curl ${CMAKE_INSTALL_SCRIPT_URL} > ${CMAKE_INSTALL_SCRIPT}
12
13    sudo mkdir -p /opt/cmake
14    sudo bash ${CMAKE_INSTALL_SCRIPT} --skip-license --prefix=/opt/cmake
15    export PATH=/opt/cmake/bin:$PATH
16}
17
18[ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site"
19[ "$PROJECT_PATH" ] || PROJECT_PATH="io/fd/hicn"
20[ "$DOC_FILE" ] || DOC_FILE="hicn.docs.zip"
21[ "$DOC_DIR" ] || DOC_DIR="build/lib/doc/html"
22[ "$SITE_DIR" ] || SITE_DIR="build/doc/deploy-site/"
23[ "$RESOURCES_DIR" ] || RESOURCES_DIR=${SITE_DIR}/src/site/resources
24[ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn"
25[ "$VERSION" ] || VERSION=$(git describe --abbrev=0 | egrep -o "([0-9]{1,}\.)+[0-9]{1,}")
26
27echo "Current directory: $(pwd)"
28
29update_cmake_repo
30mkdir -p build
31pushd build
32cmake -DBUILD_HICNPLUGIN=OFF -DBUILD_HICNLIGHT=OFF -DBUILD_LIBTRANSPORT=OFF -DBUILD_UTILS=OFF -DBUILD_APPS=OFF -DBUILD_CTRL=OFF ..
33make doc
34popd
35
36if [[ ${JOB_NAME} == *merge* ]]; then
37  mkdir -p $(dirname ${RESOURCES_DIR})
38  mv -f ${DOC_DIR} ${RESOURCES_DIR}
39  cd ${SITE_DIR}
40  find . -type f '(' -name '*.md5' -o -name '*.dot' -o -name '*.map' ')' -delete
41  cat > pom.xml << EOF
42  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
43    <modelVersion>4.0.0</modelVersion>
44    <groupId>io.fd.hicn</groupId>
45    <artifactId>docs</artifactId>
46    <version>1.0.0</version>
47    <packaging>pom</packaging>
48
49    <properties>
50      <generateReports>false</generateReports>
51    </properties>
52
53    <build>
54      <extensions>
55        <extension>
56          <groupId>org.apache.maven.wagon</groupId>
57           <artifactId>wagon-webdav-jackrabbit</artifactId>
58           <version>2.9</version>
59        </extension>
60      </extensions>
61    </build>
62    <distributionManagement>
63      <site>
64        <id>fdio-site</id>
65        <url>dav:${DOCS_REPO_URL}/${PROJECT_PATH}/${VERSION}</url>
66      </site>
67    </distributionManagement>
68  </project>
69EOF
70  ${MVN} site:site site:deploy -gs "${GLOBAL_SETTINGS_FILE}" -s "${SETTINGS_FILE}" -T 4C
71  cd -
72fi
73