daml/docs/scripts/live-preview.sh
Sofia Faro 6047cca194
daml-docs: Generate Hoogle database with anchor table from generating docs. (#5704)
* Fix all DAML hoogle links.

This PR changes how the hoogle database is rendered in damldocs, so it has access to the mapping of anchors to URLs that is produced during rendering of rst docs. This way these will not get out of sync.

I also added an --output-anchor option in preparation for fixing external/cross-package references.

changelog_begin
changelog_end

* Update settings.json

undo accidental vscode settings change.

* Update README.md
2020-04-23 16:12:48 +01:00

73 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
SCRIPT_DIR=$(dirname "$0")
cd $SCRIPT_DIR
BUILD_DIR=$(cd ..; pwd)/build
trap cleanup 1 2 3 6
cleanup()
{
echo "Caught Signal ... cleaning up."
rm -rf $BUILD_DIR
cd $SCRIPT_DIR
rm -rf ../source/daml/stdlib
rm -f ../source/app-dev/grpc/proto-docs.rst
rm -f ../source/LICENSE
rm -f ../source/NOTICES
echo "Done cleanup ... quitting."
exit 1
}
rm -rf $BUILD_DIR
mkdir -p $BUILD_DIR/gen
ln -s ../source $BUILD_DIR
ln -s ../configs $BUILD_DIR
mkdir $BUILD_DIR/theme
bazel build //docs:theme
tar -zxf ../../bazel-bin/docs/da_theme.tar.gz -C $BUILD_DIR/theme
# License and Notices
cp ../../LICENSE ../source
cp ../../NOTICES ../source
for arg in "$@"
do
if [ "$arg" = "--pdf" ]; then
bazel build //docs:pdf-docs
mkdir -p $BUILD_DIR/gen/_downloads
cp -L ../../bazel-bin/docs/DigitalAssetSDK.pdf $BUILD_DIR/gen/_downloads
fi
if [ "$arg" = "--gen" ]; then
# Hoogle
bazel build //compiler/damlc:daml-base-hoogle.txt
mkdir -p $BUILD_DIR/gen/hoogle_db
cp -L ../../bazel-bin/compiler/damlc/daml-base-hoogle.txt $BUILD_DIR/gen/hoogle_db/base.txt
# Javadoc
bazel build //language-support/java:javadoc
mkdir -p $BUILD_DIR/gen/app-dev/bindings-java
unzip ../../bazel-bin/language-support/java/javadoc.jar -d $BUILD_DIR/gen/app-dev/bindings-java/javadocs/
# Proto-docs
bazel build //ledger-api/grpc-definitions:docs
cp -L ../../bazel-bin/ledger-api/grpc-definitions/proto-docs.rst ../source/app-dev/grpc/
#StdLib
bazel build //compiler/damlc:daml-base-rst.tar.gz
tar xf ../../bazel-bin/compiler/damlc/daml-base-rst.tar.gz \
--strip-components 1 -C ../source/daml/stdlib
fi
done
DATE=$(date +"%Y-%m-%d")
echo { \"$DATE\" : \"$DATE\" } > $BUILD_DIR/gen/versions.json
pipenv install
pipenv run sphinx-autobuild -c $BUILD_DIR/configs/html $BUILD_DIR/source $BUILD_DIR/gen