Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build_gh_pages script #616

Merged
merged 1 commit into from
Feb 18, 2020
Merged
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
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