include-raw-cicn-libparc-docs.sh revision fe54ca8c
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
18cd libparc
19
20[ "$DOCS_REPO_URL" ] || DOCS_REPO_URL="https://nexus.fd.io/content/sites/site"
21[ "$PROJECT_PATH" ] || PROJECT_PATH="io/fd/cicn/libparc"
22[ "$DOC_FILE" ] || DOC_FILE="cicn.libparc.docs.zip"
23[ "$DOC_DIR" ] || DOC_DIR="build/documentation/generated-documentation/html"
24[ "$SITE_DIR" ] || SITE_DIR="build/documentation/deploy-site/"
25[ "$RESOURCES_DIR" ] || RESOURCES_DIR=${SITE_DIR}/src/site/resources
26[ "$MVN" ] || MVN="/opt/apache/maven/bin/mvn"
27[ "$VERSION" ] || VERSION=$(bash scripts/version rpm-version)
28
29echo "Current directory: $(pwd)"
30
31update_cmake_repo
32mkdir -p build
33pushd build
34cmake -DDOC_ONLY=ON ..
35make documentation
36popd
37
38if [[ ${JOB_NAME} == *merge* ]]; then
39  mkdir -p $(dirname ${RESOURCES_DIR})
40  mv -f ${DOC_DIR} ${RESOURCES_DIR}
41  cd ${SITE_DIR}
42  find . -type f '(' -name '*.md5' -o -name '*.dot' -o -name '*.map' ')' -delete
43  cat > pom.xml << EOF
44  <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">
45    <modelVersion>4.0.0</modelVersion>
46    <groupId>io.fd.vpp</groupId>
47    <artifactId>docs</artifactId>
48    <version>1.0.0</version>
49    <packaging>pom</packaging>
50
51    <properties>
52      <generateReports>false</generateReports>
53    </properties>
54
55    <build>
56      <extensions>
57        <extension>
58          <groupId>org.apache.maven.wagon</groupId>
59           <artifactId>wagon-webdav-jackrabbit</artifactId>
60           <version>2.9</version>
61        </extension>
62      </extensions>
63    </build>
64    <distributionManagement>
65      <site>
66        <id>fdio-site</id>
67        <url>dav:${DOCS_REPO_URL}/${PROJECT_PATH}/${VERSION}</url>
68      </site>
69    </distributionManagement>
70  </project>
71EOF
72  ${MVN} site:site site:deploy -gs "${GLOBAL_SETTINGS_FILE}" -s "${SETTINGS_FILE}" -T 4C
73  cd -
74fi
75