File: export-docu-to-website.sh

package info (click to toggle)
iceoryx 2.0.3%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 11,260 kB
  • sloc: cpp: 94,127; ansic: 1,443; sh: 1,436; python: 1,377; xml: 80; makefile: 61
file content (118 lines) | stat: -rwxr-xr-x 4,031 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/bash

# Copyright (c) 2020 - 2021 by Apex.AI Inc. All rights reserved.
#
# Licensed 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.
#
# SPDX-License-Identifier: Apache-2.0

# Necessary tools:
# mkdocs-awesome-pages-plugin, v2.6.0
# mkdocs-autolinks-plugin, v0.4.0 (with svg patch)
# mkdocs-material, v8.1.3-insiders-4.5.0
# markdown-include, v0.6.0
# mkdocs, v1.2.3
# Doxygen, v1.9.1
# doxybook2, v1.3.3
# mike, v1.0.0

set -e

WORKSPACE=$(git rev-parse --show-toplevel)
BASENAME=$(basename "$WORKSPACE")
WEBREPO="git@github.com:eclipse-iceoryx/iceoryx-web.git"
TYPE=${1:-local} #`local` starts a local webserver to inspect the results, `publish` pushes the generated doc to iceoryx_web
VERSION=$2
BRANCH=$3

if [ "$BASENAME" != "iceoryx" ]; then
    echo "Git folder must be named iceoryx!"
    exit 1
fi

cd "$WORKSPACE"

git checkout "$BRANCH"

# Generate doxygen
cmake -Bbuild -Hiceoryx_meta -DBUILD_DOC=ON
cd "$WORKSPACE"/build
make -j8 doxygen_iceoryx_posh doxygen_iceoryx_hoofs doxygen_iceoryx_binding_c doxygen_iceoryx_dds doxygen_iceoryx_introspection

cd "$WORKSPACE"

PACKAGES="hoofs posh c-binding DDS-gateway introspection"

# Generate doxybook2 config files, to have correct links in doxygen docu
mkdir -p "$WORKSPACE"/tools/website/generated/

for PACKAGE in ${PACKAGES}  ; do
    FILE=$WORKSPACE/tools/website/generated/doxybook2-$PACKAGE.json
    rm -f "$FILE"
    echo "{" >> "$FILE"
    if [ "$TYPE" == "local" ]; then
        echo "\"baseUrl\": \"/API-reference/$PACKAGE/\","  >> "$FILE"
    else
        echo "\"baseUrl\": \"/$VERSION/API-reference/$PACKAGE/\","  >> "$FILE"
    fi
    echo "\"indexInFolders\": false,"  >> "$FILE"
    echo "\"linkSuffix\": \"/\","  >> "$FILE"
    echo "\"mainPageInRoot\": false"  >> "$FILE"
    echo "}"  >> "$FILE"
done

BUILD_FOLDER="$WORKSPACE"/build/doc
DOC_FOLDER="$WORKSPACE"/doc/website/API-reference
CONFIG_FOLDER="$WORKSPACE"/tools/website/generated/

# Generate markdown from doxygen
mkdir -p "$DOC_FOLDER"/hoofs
doxybook2 --input $BUILD_FOLDER/iceoryx_hoofs/xml/ --output $DOC_FOLDER/hoofs --config $CONFIG_FOLDER/doxybook2-hoofs.json

mkdir -p "$DOC_FOLDER"/posh
doxybook2 --input $BUILD_FOLDER/iceoryx_posh/xml/ --output $DOC_FOLDER/posh --config $CONFIG_FOLDER/doxybook2-posh.json

mkdir -p "$DOC_FOLDER"/c-binding
doxybook2 --input $BUILD_FOLDER/iceoryx_binding_c/xml/ --output $DOC_FOLDER/c-binding --config $CONFIG_FOLDER/doxybook2-c-binding.json

mkdir -p "$DOC_FOLDER"/DDS-gateway
doxybook2 --input $BUILD_FOLDER/iceoryx_dds/xml/ --output $DOC_FOLDER/DDS-gateway --config $CONFIG_FOLDER/doxybook2-DDS-gateway.json

mkdir -p "$DOC_FOLDER"/introspection
doxybook2 --input $BUILD_FOLDER/iceoryx_introspection/xml/ --output $DOC_FOLDER/introspection --config $CONFIG_FOLDER/doxybook2-introspection.json

# Remove index files

FILES="index_classes.md index_examples.md index_files.md index_modules.md index_namespaces.md index_pages.md index_groups.md"

for PACKAGE in ${PACKAGES}  ; do
    for FILE in ${FILES}  ; do
        rm -f "$WORKSPACE"/doc/website/API-reference/"$PACKAGE"/"$FILE"
    done
done


if [ "$TYPE" == "local" ]; then
    echo "starting local webserver"
    mkdocs serve --config-file ../iceoryx/mkdocs.yml
fi

if [ "$TYPE" == "publish" ]; then
    # Generate HTML and push to GitHub pages
    if [ ! -d "$WORKSPACE/../iceoryx-web" ]; then
        cd "$WORKSPACE"/../
        git clone $WEBREPO
    fi
    cd "$WORKSPACE"/../iceoryx-web
    mike deploy --branch main --config-file ../iceoryx/mkdocs.yml --push --update-aliases "$VERSION" latest
fi