|
6 | 6 | # Distributed under the Boost Software License, Version 1.0. (See accompanying |
7 | 7 | # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
8 | 8 | # |
9 | | -# Official repository: https://github.com/boostorg/openmethod |
| 9 | +# Official REPOSITORY: https://github.com/boostorg/openmethod |
10 | 10 | # |
11 | 11 |
|
12 | 12 | set -e |
13 | 13 |
|
14 | | - |
15 | 14 | if [ $# -eq 0 ] |
16 | 15 | then |
17 | 16 | echo "No playbook supplied, using default playbook" |
|
23 | 22 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
24 | 23 | cd "$SCRIPT_DIR" |
25 | 24 |
|
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 |
35 | 40 | fi |
36 | 41 |
|
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}" |
39 | 64 | echo "Setting base-url to $base_url" |
40 | 65 | cp mrdocs.yml mrdocs.yml.bak |
41 | 66 | 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" |
42 | 69 | fi |
43 | 70 |
|
44 | 71 | echo "Building documentation with Antora..." |
|
48 | 75 | echo "Building docs in custom dir..." |
49 | 76 | PATH="$(pwd)/node_modules/.bin:${PATH}" |
50 | 77 | export PATH |
51 | | -npx antora --clean --fetch "$PLAYBOOK" --stacktrace --log-level all |
| 78 | +npx antora --clean --fetch "$PLAYBOOK" --stacktrace # --log-level all |
52 | 79 |
|
53 | 80 | echo "Fixing links to non-mrdocs URIs..." |
54 | 81 |
|
|
0 commit comments