daml/dev-env/bin/daml-sdk-head
Robin Krom 0f2ac2d06d
language: new package command for damlc (#395)
* language: new package command for damlc

The (internal) package-new command reads all information from the
daml.yaml file of a DAML project and also creates the .conf file for the
package database and packs it with the dar.
2019-04-15 18:12:04 +02:00

42 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eu
# Make sure they are in the right repo
readonly REPO_ROOT=$(bazel info workspace)
if [[ "${REPO_ROOT}/dev-env/bin/daml-sdk-head" != "${BASH_SOURCE}" ]];
then
echo "Repo root does not match the script being run."
echo "Make sure you run this script from a directory within the 'daml' repository "
exit 1
fi
# This is where we install the head version. Clean it up before we start.
readonly DAML_HEAD="$HOME/.daml-head"
if [ -d $DAML_HEAD ] ; then
chmod -R u+w $DAML_HEAD
rm -rf $DAML_HEAD
fi
echo "$(tput setaf 3)Building version 0.0.0 - this may take a while ...$(tput sgr 0)"
echo ""
function cleanup() {
echo "SDK 0.0.0 failed to build/install - if you need help ask on #team-daml"
echo "$(tput setaf 3)FAILED TO INSTALL! $(tput sgr 0)"
}
trap cleanup EXIT
# Building here separately so the user can see the build process which could take a while
bazel build //release:sdk-head-tarball.tar.gz
readonly TARBALL=$(bazel info bazel-genfiles)/release/sdk-head-tarball.tar.gz
readonly TMPDIR=$(mktemp -d)
mkdir -p $TMPDIR/sdk-head
tar xzf $TARBALL -C $TMPDIR/sdk-head --strip-components 1
DAML_HOME=$DAML_HEAD $TMPDIR/sdk-head/install.sh
mv $DAML_HEAD/bin/{daml,daml-head}
trap - EXIT
echo "$(tput setaf 3)Successfully installed daml-head command.$(tput sgr 0)"