Skip to content

Commit

Permalink
Fix build_gh_pages script (#616)
Browse files Browse the repository at this point in the history
After #613 there is now a single Cargo workspace, so the script needs to
be changed to deal with that.

Note that this now also generates docs for example crates.

Ref. #534
  • Loading branch information
tiziano88 authored Feb 18, 2020
1 parent 07ad2a4 commit 35d77d0
Showing 1 changed file with 11 additions and 23 deletions.
34 changes: 11 additions & 23 deletions scripts/build_gh_pages
Original file line number Diff line number Diff line change
Expand Up @@ -28,35 +28,23 @@ git clone git@github.com:project-oak/oak.git --branch=gh-pages --depth=1 "${TARG
# everything within that directory.
rm --recursive --force "${TARGET_DIR:?}"/*

readonly SRC_SUBDIRS=(sdk/rust oak/server/rust)
readonly DOC_SUBDIRS=(sdk server)

doc_gen() {
local srcdir=$1
local docdir=$2
(
cd "${srcdir}" || exit
# Remove previously generated artifacts, since `cargo doc` only regenerates new or modified
# files, but does not remove artifacts generated from now-removed files.
rm --recursive --force ./target/doc
cargo doc --no-deps
cargo deadlinks
cp --recursive ./target/doc "${TARGET_DIR}/${docdir}"
)
}

for ii in "${!SRC_SUBDIRS[@]}"; do
doc_gen "${SRC_SUBDIRS[$ii]}" "${DOC_SUBDIRS[$ii]}"
done

# Remove previously generated artifacts, since `cargo doc` only regenerates new or modified
# files, but does not remove artifacts generated from now-removed files.
rm --recursive --force ./target/doc
cargo doc --no-deps
cargo deadlinks
cp --recursive ./target/doc "${TARGET_DIR}"

# The docs generated from the Cargo workspace do not include a workspace-level index, so we generate
# one here and redirect to the Oak SDK documentation.
cat <<-END > "${TARGET_DIR}/index.html"
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Refresh" content="0; url=./sdk/oak/index.html" />
<meta http-equiv="Refresh" content="0; url=./doc/oak/index.html" />
</head>
<body>
<p><a href="./sdk/oak/index.html">Oak SDK main page</a></p>
<p><a href="./doc/oak/index.html">Oak SDK main page</a></p>
</body>
</html>
END
Expand Down

0 comments on commit 35d77d0

Please sign in to comment.