Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions build_docs
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
#!/usr/bin/env bash
set -e

# $scriptname will already be set if build_docs is getting called from build_docs_to_publish.
# Otherwise, we need to set it to the basename of this script.
if [[ -z "${scriptname}" ]]; then
scriptname="${0##*/}"
fi

if [ ! -e doc-builder ]; then
# We're in the doc-builder directory itself
script="./tools/build_docs.py"
script="./tools/${scriptname}.py"
files_to_copy_to_source="conf.py substitutions.py _templates _static"
cp -a ${files_to_copy_to_source} source/
else
# We're in a repo that has doc-builder as a submodule
script="./doc-builder/tools/build_docs.py"
# We're in a repo that *includes* doc-builder
script="./doc-builder/tools/${scriptname}.py"

# Make sure the submodule is checked out. For now, we assume the repo is using git-fleximod to
# manage submodules.
"$(git rev-parse --show-toplevel)"/bin/git-fleximod update doc-builder
# Make sure the doc-builder submodule is checked out. If doc-builder isn't a submodule but is
# instead manually included, we will perform the `else`, which is safe because it's a no-op in
# that situation.
# (Assume that if the repo uses git-fleximod, doc-builder is handled with it.)
git_fleximod_path="$(git rev-parse --show-toplevel)/bin/git-fleximod"
if [[ -e "${git_fleximod_path}" ]]; then
"${git_fleximod_path}" update doc-builder
else
git submodule update --init -- doc-builder
fi
fi

# Check if --verbose or -V was passed
Expand Down
49 changes: 1 addition & 48 deletions build_docs_to_publish
Original file line number Diff line number Diff line change
@@ -1,51 +1,4 @@
#!/usr/bin/env bash
set -e

if [ ! -e doc-builder ]; then
# We're in the doc-builder directory itself
script="./tools/build_docs_to_publish.py"
files_to_copy_to_source="conf.py substitutions.py _templates _static"
cp -a ${files_to_copy_to_source} source/
else
# We're in a repo that has doc-builder as a submodule
script="./doc-builder/tools/build_docs_to_publish.py"

# Make sure the submodule is checked out. For now, we assume the repo is using git-fleximod to
# manage submodules.
"$(git rev-parse --show-toplevel)"/bin/git-fleximod update doc-builder
fi

# Check if --verbose or -V was passed
verbose=false
for arg in "$@"; do
case "$arg" in
--verbose|-V) verbose=true; break ;;
esac
done

cd "${script_dir}"

if $verbose; then
echo "Running: make fetch-images"
make fetch-images
else
make fetch-images > /dev/null 2>&1
fi

if $verbose; then
echo "Running: ${script} $@"
pwd
fi
set +e
${script} "$@"
exit_code=$?
set -e

if [ ! -e doc-builder ]; then
# Clean up these things we copied
for f in ${files_to_copy_to_source}; do
rm -r "source/$f"
done
fi

exit $exit_code
. ./build_docs build_docs_to_publish
3 changes: 1 addition & 2 deletions tools/build_docs_to_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def setup_this_ref(args):
permanent_files.append("doc-builder")

# Check some things about "permanent" files before checkout
print(f"{os.getcwd()=}")
for filename in permanent_files:
check_permanent_file(filename)

Expand Down Expand Up @@ -130,7 +129,7 @@ def checkout_and_build(version, permanent_files, args):
build_args += ["--container-cli-tool", args.container_cli_tool]
if args.verbose:
build_args.append("--verbose")
print(" ".join(build_args))
print(f"build_logs command-line args: {build_args}")
build_docs(build_args)


Expand Down
Loading