mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-20 01:07:18 +03:00
e40f62f88a
This reverts commit 4c0118df4d
.
This breaks passing -p to bazel test for Haskell tests, e.g.,
bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p
--test_arg InterfaceEq
which breaks with something horrifying like
moritz@adjunction ~/daml (main)> bazel test //compiler/damlc/tests:integration-v1dev --test_arg -p --test_arg InterfaceEq
[dev-env] Building tools.bazel...
[dev-env] Built tools.bazel in /nix/store/m7gzlmr0pqjpl01ihgvazxgfs3sfwl61-bazel and linked to /home/moritz/daml/dev-env/var/gc-roots/bazel
[dev-env] Building tools.find...
[dev-env] Built tools.find in /nix/store/645v3545lcbx77wq7355rgdrgbhn5wx7-findutils-4.8.0 and linked to /home/moritz/daml/dev-env/var/gc-roots/find
INFO: Invocation ID: 034b3e45-851f-472e-ab71-b7f718829582
DEBUG: /home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/rules_haskell/haskell/private/versions.bzl:60:10: WARNING: bazel version is too recent. Supported versions range from 4.0.0 to 4.2.1, but found: 5.0.0- (@non-git)
/nix/store/dadkhf8vch2i2kvig962ilfr5j3chshr-go-1.17.6
/nix/store/pzh24n543i6jqa01hdmgqknlyf294bn1-bazel-nixpkgs-posix-toolchain
/nix/store/2hfwndk47wpvaib06qyhcdp83b423xvh-jq-1.6-bin
/nix/store/hjggs9s82qh7r5j8sgapn389hf24wdx8-bazel-nixpkgs-cc-toolchain
/nix/store/yxgg3bn4v288sc00kf09svrwz2r461c9-ghc-native-bignum-9.0.2
/nix/store/2hwx0jhcdsx3wfvmb50ih19jkh2ra4jh-glibc-locales-2.33-108
/nix/store/8wpmx049z8m0ffhy3jyi41qb6pbxwvy8-bazel-nixpkgs-java-runtime
ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o' is generated by these conflicting actions:
Label: @bazel_tools//src/tools/launcher:launcher
RuleClass: cc_binary rule
Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c
Mnemonic: CppCompile
Action key: 3d79fe1470dcb842d5944c98dfe7a62715db6d86fdb12d3ff60af3bdf41b7996
Progress message: Compiling src/tools/launcher/dummy.cc
PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.pic.o
Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]}
MandatoryInputs: are equal
Outputs: are equal
ERROR: file 'external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o' is generated by these conflicting actions:
Label: @bazel_tools//src/tools/launcher:launcher
RuleClass: cc_binary rule
Configuration: 869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9, 8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c
Mnemonic: CppCompile
Action key: 9f46e824944add9e9951ef51ddb6cb4b744bc97f90b5749132179d1d1699dfa1
Progress message: Compiling src/tools/launcher/dummy.cc
PrimaryInput: File:[/home/moritz/.cache/bazel/_bazel_moritz/bb4e4404f889dc1b816f246b08c0d9ea/external/bazel_tools[source]]src/tools/launcher/dummy.cc
PrimaryOutput: File:[[<execution_root>]bazel-out/k8-opt/bin]external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o
Owner information: ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[869f6bbd14d2ac66dcacb164312d88fa059b017e3c17513cb5051b23879ac7f9]}, ConfiguredTargetKey{label=@bazel_tools//src/tools/launcher:launcher, config=BuildConfigurationValue.Key[8c138cc79f95329f01b0d325511ad0ea89ca5126e421e67e5239706d0f247c2c]}
MandatoryInputs: are equal
Outputs: are equal
ERROR: com.google.devtools.build.lib.skyframe.ArtifactConflictFinder$ConflictException: com.google.devtools.build.lib.actions.MutableActionGraph$ActionConflictException: for external/bazel_tools/src/tools/launcher/_objs/launcher/dummy.o, previous action: action 'Compiling src/tools/launcher/dummy.cc', attempted action: action 'Compiling src/tools/launcher/dummy.cc'
changelog_begin
changelog_end
91 lines
2.8 KiB
Bash
Executable File
91 lines
2.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
## Functions
|
|
|
|
step() {
|
|
echo "step: $*" >&2
|
|
}
|
|
|
|
is_windows() {
|
|
[[ $os = windows ]]
|
|
}
|
|
|
|
## Main
|
|
|
|
# always run in the project root
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# detect the OS
|
|
case $(uname) in
|
|
Linux)
|
|
os=linux
|
|
;;
|
|
Darwin)
|
|
os=darwin
|
|
;;
|
|
MINGW*)
|
|
os=windows
|
|
;;
|
|
*)
|
|
echo "unknown kernel: $(uname)"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
cd "$(dirname "$0")"/..
|
|
|
|
step "configuring bazel"
|
|
|
|
# We include the rules_haskell revision in the suffix since
|
|
# it sometimes breaks Windows due to the lack of sandboxing.
|
|
RULES_HASKELL_REV="$(sed -n 's/rules_haskell_version = "\(.*\)"$/\1/p' deps.bzl)"
|
|
|
|
if [ ! -z "${BAZEL_CONFIG_DIR:-}" ]; then
|
|
cd "$BAZEL_CONFIG_DIR"
|
|
fi
|
|
|
|
CACHE_URL="https://storage.googleapis.com/daml-bazel-cache"
|
|
|
|
if is_windows; then
|
|
echo "build --config windows" > .bazelrc.local
|
|
echo "build --config windows-ci" >> .bazelrc.local
|
|
|
|
# Modify the output path to avoid shared action keys.
|
|
# The issue appears to be that GCC produces absolute paths
|
|
# to system includes in .d files. These files are cached
|
|
# so the absolute paths leak into different builds. Most of the time
|
|
# this works since Azure reuses the working directory. However,
|
|
# between the daily compatibility job seems to get a different
|
|
# working directory because it is in a different pipeline.
|
|
# To make matters worse, the working directory depends on which
|
|
# job runs first afaict. There is a counter that simply gets incremented.
|
|
# Sharing between the compatibility workspace and the main workspace
|
|
# runs into the same issue.
|
|
# To sidestep this we take a md5 hash of PWD
|
|
# (this is what bazel does to determine the execroot name).
|
|
# To avoid exceeding the maximum path limit on Windows we limit the suffix to
|
|
# three characters.
|
|
echo "Working directory: $PWD"
|
|
SUFFIX="$(echo $PWD $RULES_HASKELL_REV | openssl dgst -md5 -r)"
|
|
SUFFIX="${SUFFIX:0:12}"
|
|
echo "Platform suffix: $SUFFIX"
|
|
# We include an extra version at the end that we can bump manually.
|
|
CACHE_SUFFIX="$SUFFIX-v11"
|
|
CACHE_URL="$CACHE_URL/$CACHE_SUFFIX"
|
|
echo "build:windows-ci --remote_http_cache=https://bazel-cache.da-ext.net/$CACHE_SUFFIX" >> .bazelrc.local
|
|
fi
|
|
|
|
# sets up write access to the shared remote cache if the branch is not a fork
|
|
if [[ "${IS_FORK}" = False ]]; then
|
|
step "configuring write access to the remote cache"
|
|
GOOGLE_APPLICATION_CREDENTIALS=$(mktemp .tmp.XXXXXXXXXX)
|
|
echo "$GOOGLE_APPLICATION_CREDENTIALS_CONTENT" > "$GOOGLE_APPLICATION_CREDENTIALS"
|
|
unset GOOGLE_APPLICATION_CREDENTIALS_CONTENT
|
|
export GOOGLE_APPLICATION_CREDENTIALS
|
|
echo "build --remote_http_cache=$CACHE_URL --remote_upload_local_results=true --google_credentials=${GOOGLE_APPLICATION_CREDENTIALS}" >> .bazelrc.local
|
|
fi
|