Skip to content

Commit 8933eb3

Browse files
committed
build_antora.sh: fix base-url patch, use mrdocs generated tagfile
1 parent b8da0a1 commit 8933eb3

File tree

7 files changed

+256
-1334
lines changed

7 files changed

+256
-1334
lines changed

doc/antora.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ ext:
2121
cpp-reference:
2222
config: doc/mrdocs.yml
2323
cpp-tagfiles:
24-
files:
25-
- file: ./doc/tagfiles/boost-openmethod-doxygen.tag.xml
26-
base_url: 'xref:reference:'
27-
- file: ./doc/tagfiles/boost-openmethod-macros-doxygen.tag.xml
28-
base_url: 'xref:reference:'
2924
using-namespaces:
3025
- boost::openmethod
3126
- boost::openmethod::policies

doc/build_antora.sh

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@
66
# Distributed under the Boost Software License, Version 1.0. (See accompanying
77
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
88
#
9-
# Official repository: https://github.com/boostorg/openmethod
9+
# Official REPOSITORY: https://github.com/boostorg/openmethod
1010
#
1111

1212
set -e
1313

14-
1514
if [ $# -eq 0 ]
1615
then
1716
echo "No playbook supplied, using default playbook"
@@ -23,22 +22,50 @@ fi
2322
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
2423
cd "$SCRIPT_DIR"
2524

26-
if [ -n "${CIRCLE_REPOSITORY_URL:-}" ]; then
27-
account="${CIRCLE_REPOSITORY_URL#*:}"
28-
account="${account%%/*}"
29-
lib=$(basename "$(git rev-parse --show-toplevel)")
30-
repository="${account}/$lib"
31-
sha=${CIRCLE_SHA1}
32-
elif [ -n "${GITHUB_REPOSITORY:-}" ]; then
33-
repository="${GITHUB_REPOSITORY}"
34-
sha=${GITHUB_SHA}
25+
if [ -z "${BOOST_SRC_DIR:-}" ]; then
26+
CANDIDATE=$( cd "$SCRIPT_DIR/../../.." 2>/dev/null && pwd )
27+
if [ -n "$CANDIDATE" ]; then
28+
BOOST_SRC_DIR_IS_VALID=ON
29+
for F in "CMakeLists.txt" "Jamroot" "boost-build.jam" "bootstrap.sh" "libs"; do
30+
if [ ! -e "$CANDIDATE/$F" ]; then
31+
BOOST_SRC_DIR_IS_VALID=OFF
32+
break
33+
fi
34+
done
35+
if [ "$BOOST_SRC_DIR_IS_VALID" = "ON" ]; then
36+
export BOOST_SRC_DIR="$CANDIDATE"
37+
echo "Using BOOST_SRC_DIR=$BOOST_SRC_DIR"
38+
fi
39+
fi
3540
fi
3641

37-
if [ -n "${repository}" ] && [ -n "${sha}" ]; then
38-
base_url="https://github.com/${repository}/blob/${sha}"
42+
if [ -n "${BOOST_SRC_DIR:-}" ]; then
43+
if [ -n "${CIRCLE_REPOSITORY_URL:-}" ]; then
44+
if [[ "$CIRCLE_REPOSITORY_URL" =~ boostorg/boost(\.git)?$ ]]; then
45+
LIB="$(basename "$(dirname "$SCRIPT_DIR")")"
46+
REPOSITORY="boostorg/${LIB}"
47+
else
48+
ACCOUNT="${CIRCLE_REPOSITORY_URL#*:}"
49+
ACCOUNT="${ACCOUNT%%/*}"
50+
LIB=$(basename "$(git rev-parse --show-toplevel)")
51+
REPOSITORY="${ACCOUNT}/${LIB}"
52+
fi
53+
SHA=$(git -C "$BOOST_SRC_DIR/libs" ls-tree HEAD | grep -w openmethod | awk '{print $3}')
54+
elif [ -n "${GITHUB_REPOSITORY:-}" ]; then
55+
REPOSITORY="${GITHUB_REPOSITORY}"
56+
SHA="${GITHUB_SHA}"
57+
fi
58+
fi
59+
60+
cd "$SCRIPT_DIR"
61+
62+
if [ -n "${REPOSITORY}" ] && [ -n "${SHA}" ]; then
63+
base_url="https://github.com/${REPOSITORY}/blob/${SHA}"
3964
echo "Setting base-url to $base_url"
4065
cp mrdocs.yml mrdocs.yml.bak
4166
perl -i -pe 's{^\s*base-url:.*$}{base-url: '"$base_url/"'}' mrdocs.yml
67+
else
68+
echo "REPOSITORY or SHA not set; skipping base-url modification"
4269
fi
4370

4471
echo "Building documentation with Antora..."
@@ -48,7 +75,7 @@ npm ci
4875
echo "Building docs in custom dir..."
4976
PATH="$(pwd)/node_modules/.bin:${PATH}"
5077
export PATH
51-
npx antora --clean --fetch "$PLAYBOOK" --stacktrace --log-level all
78+
npx antora --clean --fetch "$PLAYBOOK" --stacktrace # --log-level all
5279

5380
echo "Fixing links to non-mrdocs URIs..."
5481

doc/mrdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ inaccessible-bases: never
2222
# implementation-defined:
2323
# - 'boost::openmethod::detail::**'
2424
exclude-symbols:
25+
- 'boost::openmethod::registry::compiler'
2526
- 'boost::openmethod::registry::initialize'
2627
- 'boost::openmethod::registry::finalize'
2728
- 'boost::openmethod::boost_openmethod_bases'
@@ -38,7 +39,7 @@ auto-function-metadata: false
3839

3940
# Generator
4041
generate: adoc
41-
base-url: https://www.github.com/boostorg/openmethod/blob/develop/
42+
base-url: https://www.github.com/boostorg/openmethod/blob/master/
4243

4344
# Style
4445
verbose: true

0 commit comments

Comments
 (0)