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 haddock publishing #2276

Merged
merged 2 commits into from
Jan 13, 2021
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
2 changes: 1 addition & 1 deletion .github/workflows/github-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
echo "CABAL_BUILDDIR=$CABAL_BUILDDIR" >> $GITHUB_ENV

- name: Set cache version
run: echo "CACHE_VERSION=myfzgX7" >> $GITHUB_ENV
run: echo "CACHE_VERSION=UN37rUo" >> $GITHUB_ENV

- name: Add build script path
run: echo "$(pwd)/.github/bin" >> $GITHUB_PATH
Expand Down
30 changes: 22 additions & 8 deletions scripts/haddocs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,22 @@ HADDOCK_OPTS=(
--haddock-hyperlink-source
--haddock-option "--show-all"
--haddock-option "--use-unicode"
--haddock-option "--use-contents=\"../index.html\""
--disable-tests
)

# build documentation of all modules
if [ ${REGENERATE} == "true" ]; then
cabal haddock "${HADDOCK_OPTS[@]}" cardano-api
cabal haddock "${HADDOCK_OPTS[@]}" \
cardano-api \
cardano-api-test \
cardano-cli \
cardano-config \
cardano-node \
hedgehog-extras \
exe:cardano-cli \
exe:cardano-node \
exe:cardano-node-chairman \
exe:cardano-testnet
elif [ ${REGENERATE} != "false" ]; then
cabal haddock "${HADDOCK_OPTS[@]}" ${REGENERATE}
fi
Expand All @@ -55,16 +65,21 @@ if [[ !( -d ${OUTPUT_DIR} ) ]]; then
fi

# copy the new docs
for noopt_dir in $(ls "${BUILD_DIR}/build/${OS_ARCH}/ghc-${GHC_VERSION}"/noopt); do
dir="$(dirname "$noopt_dir")"
package=$(echo "${dir}" | sed 's/-[0-9]\+\(\.[0-9]\+\)*//')
cp -r "${BUILD_DIR}/build/${OS_ARCH}/ghc-${GHC_VERSION}/${dir}/noopt/doc/html/${package}" ${OUTPUT_DIR}
for noopt_dir in $(find "${BUILD_DIR}/build/${OS_ARCH}/ghc-${GHC_VERSION}" -name noopt | grep -v /t/); do
for doc_index in $(find "${noopt_dir}" -name doc-index.html); do
package_dir="$(dirname "$doc_index")"
package="$(echo "$(basename "${package_dir}")" | sed 's/-[0-9]\+\(\.[0-9]\+\)*//')"
echo "Copying package: ${package}"
cp -r "${package_dir}" "${OUTPUT_DIR}"
done
done

# --read-interface options
interface_options () {
for package in $(ls "${OUTPUT_DIR}"); do
echo "--read-interface=${package},${OUTPUT_DIR}/${package}/${package}.haddock"
if [ -f "${OUTPUT_DIR}/${package}/${package}.haddock" ]; then
echo "--read-interface=${package},${OUTPUT_DIR}/${package}/${package}.haddock"
fi
done
}

Expand All @@ -77,7 +92,6 @@ haddock \
--gen-index \
--gen-contents \
--quickjump \
--prolog ./scripts/prolog \
$(interface_options)

# Assemble a toplevel `doc-index.json` from package level ones.
Expand Down
12 changes: 10 additions & 2 deletions scripts/prolog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

[skip to module list](#module-list)

This site contains Haskell documentation of
This site contains Haskell documentation of:

* __[Cardano API](cardano-api/Cardano-API.html)__
* __[Cardano Api ](cardano-api/doc-index.html)__
* __[Cardano Api-test ](cardano-api-test/doc-index.html)__
* __[Cardano Cli ](cardano-cli/doc-index.html)__
* __[Cardano Config ](cardano-config/doc-index.html)__
* __[Cardano Node ](cardano-node/doc-index.html)__
* __[Cardano Node ](cardano-node/doc-index.html)__
* __[Cardano Node-chairman ](cardano-node-chairman/doc-index.html)__
* __[Cardano Testnet ](cardano-testnet/doc-index.html)__
* __[Hedgehog Extras ](hedgehog-extras/doc-index.html)__