From 05d8e9eb09a4181bce6bd930e13f25f7815eaa76 Mon Sep 17 00:00:00 2001 From: Moritz Kiefer Date: Wed, 24 Apr 2019 19:28:23 +0200 Subject: [PATCH] Fix concurrent DAML compilations on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since Windows builds aren’t sandboxed properly (see https://github.com/bazelbuild/bazel/issues/5136), concurrent compilations interact with the same tmp_db directory which leads to flaky build failures. --- daml-foundations/daml-ghc/package-database/util.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daml-foundations/daml-ghc/package-database/util.bzl b/daml-foundations/daml-ghc/package-database/util.bzl index 2ccef4dc1d51..723d7c24f95b 100644 --- a/daml-foundations/daml-ghc/package-database/util.bzl +++ b/daml-foundations/daml-ghc/package-database/util.bzl @@ -77,14 +77,14 @@ def _daml_package_rule_impl(ctx): progress_message = "Compiling " + name + ".daml to daml-lf " + ctx.attr.daml_lf_version, command = """ set -eou pipefail - mkdir -p tmp_db - tar xf {db_tar} -C tmp_db --strip-components 1 - mkdir -p tmp_db/{daml_lf_version} + PACKAGEDB=$(mktemp -d) + tar xf {db_tar} -C "$PACKAGEDB" --strip-components 1 + mkdir -p "$PACKAGEDB"/{daml_lf_version} # Compile the dalf file {damlc_bootstrap} compile \ --package-name {pkg_name} \ - --package-db tmp_db \ + --package-db "$PACKAGEDB" \ --write-iface \ --target {daml_lf_version} \ -o {dalf_file} \