daml/build.sh
Moritz Kiefer f0a111ca1a
Get grpc from nix on unix (#3632)
* Get grpc from nix on unix

The one from Bazel seems to cause linking issues when trying to run
things in GHCi. I’ve spent some time trying to use rules_foreign_cc to
build gRPC using CMake but decided that for my own sanity it’s better
to not pursue that further.

* Address review comments

* Add missing module load

* Cleanup GHCI_SCRIPT

* use the correct file ending on macos

* Import is_linux

* Switch back to grpc-1.23

The newer version seems to cause issues in combination with the java libraries.

* Try to fix package_app on macos

* more debugging

* Maybe this is not necessary, we will never know

* linkers are the worst

* Remove debugging output again

* readd rpaths

* treat libdispatch specially

* remove hack

* more fooling around

* lalala
2019-11-26 18:47:39 +01:00

49 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Copyright (c) 2019 The DAML Authors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
eval "$($(dirname "$0")/dev-env/bin/dade-assist)"
execution_log_postfix=${1:-}
export LC_ALL=en_US.UTF-8
ARTIFACT_DIRS="${BUILD_ARTIFACTSTAGINGDIRECTORY:-$PWD}"
# Bazel test only builds targets that are dependencies of a test suite
# so do a full build first.
(
cd compiler
# Bazel also limits cache downloads by -j so increasing this to a ridiculous value
# helps. Bazel separately controls the number of jobs using CPUs so this should not
# overload machines.
# This also appears to be what Google uses internally, see
# https://github.com/bazelbuild/bazel/issues/6394#issuecomment-436234594.
bazel build -j 200 //... --experimental_execution_log_file "$ARTIFACT_DIRS/build_execution${execution_log_postfix}.log"
)
tag_filter=""
if [[ "$execution_log_postfix" == "_Darwin" ]]; then
tag_filter="-dont-run-on-darwin"
fi
bazel test -j 200 //... --test_tag_filters "$tag_filter" --experimental_execution_log_file "$ARTIFACT_DIRS/test_execution${execution_log_postfix}.log"
# Make sure that Bazel query works.
bazel query 'deps(//...)' > /dev/null
# Check that we can load damlc in ghci
GHCI_SCRIPT=$(mktemp)
function cleanup {
rm -rf "$GHCI_SCRIPT"
}
trap cleanup EXIT
cat <<EOF > $GHCI_SCRIPT
:m DA.Cli.Damlc
:main --help
:quit
EOF
da-ghci --data yes //:repl -ghci-script $GHCI_SCRIPT -e '()'
# Check that our IDE works on our codebase
./compiler/ghcide-daml.sh compiler/damlc/exe/Main.hs 2>&1 | tee ide-log
grep -q "1 file worked, 0 files failed" ide-log