Skip to content

Commit

Permalink
Remove Bazel override (digital-asset#3603)
Browse files Browse the repository at this point in the history
* Remove Bazel override

The extended default shell env is no longer required. See
digital-asset#3597 (review)

* Import diff from rules_sh posix toolchain
  • Loading branch information
aherrmann-da authored and mergify[bot] committed Nov 26, 2019
1 parent 8818ea7 commit 15f12ee
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 1,144 deletions.
1 change: 1 addition & 0 deletions .hlint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
- DA.Sdk.Cli.System
- DA.Sdk.Cli.Version
- DA.Daml.Assistant.Install.Path
- DA.Daml.Doc.Tests
- DA.Signals
- Development.IDE.Core.Compile
- Development.IDE.GHC.Compat
Expand Down
6 changes: 6 additions & 0 deletions compiler/damlc/daml-doc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ da_haskell_library(
da_haskell_library(
name = "daml-doc-testing",
srcs = glob(["test/**/*.hs"]),
compiler_flags = [
"-DPOSIX_DIFF=\"$(POSIX_DIFF)\"",
],
hackage_deps = [
"aeson-pretty",
"base",
Expand All @@ -62,6 +65,9 @@ da_haskell_library(
"transformers",
],
src_strip_prefix = "test",
toolchains = [
"@rules_sh//sh/posix:make_variables",
],
visibility = ["//visibility:public"],
deps = [
"//compiler/damlc/daml-doc",
Expand Down
3 changes: 2 additions & 1 deletion compiler/damlc/daml-doc/test/DA/Daml/GHC/Damldoc/Tests.hs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- Copyright (c) 2019 The DAML Authors. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0

{-# LANGUAGE CPP #-}

module DA.Daml.Doc.Tests(mkTestTree)
where
Expand Down Expand Up @@ -311,4 +312,4 @@ fileTest damlFile = do
".json" -> AP.encodePretty' jsonConf doc
other -> error $ "Unsupported file extension " <> other
where
diff ref new = ["diff", "--strip-trailing-cr", ref, new]
diff ref new = [POSIX_DIFF, "--strip-trailing-cr", ref, new]
4 changes: 4 additions & 0 deletions compiler/damlc/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,17 @@ sh_test(
args = [
"$(location //compiler/damlc)",
"$(location @com_google_protobuf//:protoc)",
"$(POSIX_DIFF)",
],
data = [
":daml-test-files",
"//compiler/damlc",
"//compiler/damlc/pkg-db",
"@com_google_protobuf//:protoc",
],
toolchains = [
"@rules_sh//sh/posix:make_variables",
],
deps = [
"@bazel_tools//tools/bash/runfiles",
],
Expand Down
9 changes: 5 additions & 4 deletions compiler/damlc/tests/src/daml-ghc-deterministic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fi
TESTS_DIR=$(dirname $(rlocation "$TEST_WORKSPACE/compiler/damlc/tests/daml-test-files/Examples.daml"))
damlc=$(rlocation "$TEST_WORKSPACE/$1")
protoc=$(rlocation "$TEST_WORKSPACE/$2")
diff="$3"

# Check that DAML compilation is deterministic.
TMP_SRC1=$(mktemp -d)
Expand Down Expand Up @@ -54,10 +55,10 @@ $protoc --decode_raw < "$TMP_OUT/out_2" > "$TMP_OUT/decoded_out_2"
# We first diff the decoded files to get useful debugging output and
# then the non-decoded files to ensure that we actually get bitwise
# identical outputs.
diff -u "$TMP_OUT/decoded_out_1" "$TMP_OUT/decoded_out_2"
diff -u "$TMP_OUT/out_1" "$TMP_OUT/out_2"
$diff -u "$TMP_OUT/decoded_out_1" "$TMP_OUT/decoded_out_2"
$diff -u "$TMP_OUT/out_1" "$TMP_OUT/out_2"
$protoc --decode_raw < "$TMP_OUT/out_proj_1" > "$TMP_OUT/decoded_out_proj_1"
$protoc --decode_raw < "$TMP_OUT/out_proj_2" > "$TMP_OUT/decoded_out_proj_2"
diff -u "$TMP_OUT/decoded_out_proj_1" "$TMP_OUT/decoded_out_proj_2"
diff -u "$TMP_OUT/out_proj_1" "$TMP_OUT/out_proj_2"
$diff -u "$TMP_OUT/decoded_out_proj_1" "$TMP_OUT/decoded_out_proj_2"
$diff -u "$TMP_OUT/out_proj_1" "$TMP_OUT/out_proj_2"

4 changes: 4 additions & 0 deletions daml-lf/tests/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,17 @@ daml_compile(
"$(location //daml-lf/repl:repl)",
"$(location //compiler/damlc)",
"$(location :%s)" % file,
"$(POSIX_DIFF)",
],
data = [
"//compiler/damlc",
"//daml-lf/repl",
file,
"%s/EXPECTED.ledger" % "/".join(file.split("/")[0:3]),
],
toolchains = [
"@rules_sh//sh/posix:make_variables",
],
deps = [
"@bazel_tools//tools/bash/runfiles",
],
Expand Down
3 changes: 2 additions & 1 deletion daml-lf/tests/scenario/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ fi
REPL=$(rlocation "$TEST_WORKSPACE/$1")
DAMLC=$(rlocation "$TEST_WORKSPACE/$2")
TESTMAIN=$(rlocation "$TEST_WORKSPACE/$3")
DIFF="$4"
TESTDIR="$(dirname $TESTMAIN)"
TESTDAR="$TESTDIR/Main.dar"

Expand All @@ -44,4 +45,4 @@ $DAMLC package --debug $TESTMAIN 'main' -o $TESTDAR

$REPL test Test:run $TESTDAR | sed '1d' | sed -E "$REGEX_HIDE_HASHES" > ${TESTDIR}/ACTUAL.ledger

diff --strip-trailing-cr ${TESTDIR}/ACTUAL.ledger ${TESTDIR}/EXPECTED.ledger
$DIFF --strip-trailing-cr ${TESTDIR}/ACTUAL.ledger ${TESTDIR}/EXPECTED.ledger
10 changes: 0 additions & 10 deletions nix/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ let

# package overrides
overrides = _: pkgs: rec {
# We can't use pkgs.bazel here, as it is somewhat outdated. It features
# version 0.10.1, while rules_haskell (for example) requires bazel >= 0.14.
bazel = pkgs.callPackage ./overrides/bazel {
inherit (pkgs.darwin) cctools;
inherit (pkgs.darwin.apple_sdk.frameworks) CoreFoundation CoreServices Foundation;
buildJdk = pkgs.jdk8;
buildJdkName = "jdk8";
runJdk = pkgs.jdk8;
stdenv = if pkgs.stdenv.cc.isClang then pkgs.llvmPackages_6.stdenv else pkgs.stdenv;
};
ephemeralpg = pkgs.ephemeralpg.overrideAttrs(oldAttrs: {
installPhase = ''
mkdir -p $out
Expand Down
Loading

0 comments on commit 15f12ee

Please sign in to comment.