mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-17 15:57:21 +03:00
Add a daml-sdk-head script. (#404)
This commit is contained in:
parent
a1221d66f4
commit
78d77d0a2e
9
dev-env/bin/daml-head
Executable file
9
dev-env/bin/daml-head
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DAML_HEAD="$HOME/.daml-head"
|
||||
if [ -d $DAML_HEAD ] ; then
|
||||
DAML_HOME=$DAML_HEAD $DAML_HEAD/bin/daml $@
|
||||
else
|
||||
echo "daml-head is not installed"
|
||||
echo "please run daml-sdk-head to install"
|
||||
fi
|
42
dev-env/bin/daml-sdk-head
Executable file
42
dev-env/bin/daml-sdk-head
Executable file
@ -0,0 +1,42 @@
|
||||
#!/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 -P 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
|
||||
echo $DAML_HEAD
|
||||
DAML_HOME=$DAML_HEAD $TMPDIR/sdk-head/install.sh --quiet
|
||||
|
||||
trap - EXIT
|
||||
echo "$(tput setaf 3)Successfully installed DA SDK HEAD as version 0.0.0.$(tput sgr 0)"
|
||||
echo "Now use daml-head to use it."
|
@ -139,3 +139,39 @@ EOF
|
||||
""",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
||||
# Same as the above, but with head version 0.0.0.
|
||||
genrule(
|
||||
name = "sdk-head-tarball",
|
||||
srcs = [
|
||||
":config.yaml.tmpl",
|
||||
":sdk-release-tarball.tar.gz",
|
||||
],
|
||||
outs = ["sdk-head-tarball.tar.gz"],
|
||||
cmd = """
|
||||
|
||||
VERSION=0.0.0
|
||||
OUT=sdk-head
|
||||
mkdir -p $$OUT
|
||||
tar xf $(location sdk-release-tarball.tar.gz) --strip-components=1 -C $$OUT
|
||||
|
||||
cp $(location :config.yaml.tmpl) $$OUT/config.yaml
|
||||
sed -i "s/__VERSION__/$$VERSION/" $$OUT/config.yaml
|
||||
|
||||
rm $$OUT/templates/quickstart-java/daml.yaml
|
||||
cat > $$OUT/templates/quickstart-java/daml.yaml << EOF
|
||||
sdk-version: $$VERSION
|
||||
name: quickstart
|
||||
source: daml/Main.daml
|
||||
scenario: Main:setup
|
||||
parties:
|
||||
- Alice
|
||||
- Bob
|
||||
- USD_Bank
|
||||
- EUR_Bank
|
||||
EOF
|
||||
|
||||
tar zcf $(location sdk-head-tarball.tar.gz) --format=ustar $$OUT
|
||||
""",
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Copyright (c) 2019 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
DIR="$(cd $(dirname $(readlink -f "$BASH_SOURCE[0]")); pwd)"
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
|
||||
"$DIR/daml/daml" install "$DIR" --activate $@
|
||||
|
Loading…
Reference in New Issue
Block a user