Upgrade rules_haskell and rules_nixpkgs (#10517)

* Update rules_haskell & rules_nixpkgs

changelog_begin
changelog_end

* remove unused patch

* Remove the strict-source-names patch

This patch was largely motivated by issues with directory outputs on
Windows occasionally producing empty outputs that would poison the
remote cache. However, we have continued seeing this type of issue
despite this patch and have since resorted to a regular fixup job that
cleans such empty items out of the cache.

With that the strongest motivation with this change is no longer valid
and it doesn't seem worth it to maintain it any longer.

changelog_begin
changelog_end

* Remove windows-remove-fake-libs patch

This patch was upstreamed.

* Update windows-extra-libraries patch

The GHC bindist patch is no longer required as it applied to GHC version
8.10.3 but we are using 8.10.4 instead.

* Remove cc-wrapper-windows patch

This was upstreamed.

* Remove protobuf-source patch

This was upstreamed

* Keep patches in sync between daml and compatibility

Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
This commit is contained in:
Andreas Herrmann 2021-08-09 15:19:17 +02:00 committed by GitHub
parent 35f1592098
commit 881d0aba91
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 32 additions and 1361 deletions

View File

@ -1,13 +0,0 @@
diff --git a/haskell/private/cc_wrapper_windows.sh.tpl b/haskell/private/cc_wrapper_windows.sh.tpl
index e62c07a5..0d64de97 100644
--- a/haskell/private/cc_wrapper_windows.sh.tpl
+++ b/haskell/private/cc_wrapper_windows.sh.tpl
@@ -183,7 +183,7 @@ handle_arg() {
handle_lib_dir "$arg"
elif [[ "$arg" =~ ^@(.*)$ ]]; then
(( ++IN_RESPONSE_FILE ))
- while read -r line; do
+ while IFS=$' \t\r\n' read -r line; do
handle_arg "$line"
done < "${BASH_REMATCH[1]}"
(( --IN_RESPONSE_FILE )) || true

File diff suppressed because it is too large Load Diff

View File

@ -1,37 +1,8 @@
diff --git a/haskell/assets/ghc_8_10_3_win_base.patch b/haskell/assets/ghc_8_10_3_win_base.patch
new file mode 100644
index 00000000..b205f35c
--- /dev/null
+++ b/haskell/assets/ghc_8_10_3_win_base.patch
@@ -0,0 +1,11 @@
+--- lib/package.conf.d/base-4.14.1.0.conf 2021-01-06 14:35:47.854943211 +0100
++++ lib/package.conf.d/base-4.14.1.0.conf 2021-01-06 14:34:52.090263590 +0100
+@@ -86,7 +86,7 @@
+ dynamic-library-dirs: $topdir\base-4.14.1.0
+ data-dir: $topdir\x86_64-windows-ghc-8.10.3\base-4.14.1.0
+ hs-libraries: HSbase-4.14.1.0
+-extra-libraries: wsock32 user32 shell32 msvcrt mingw32 mingwex shlwapi
++extra-libraries: wsock32 ws2_32 user32 shell32 msvcrt mingw32 mingwex shlwapi stdc++
+ include-dirs: $topdir\base-4.14.1.0\include
+ includes: HsBase.h
+ depends: ghc-prim-0.6.1 integer-gmp-1.0.3.0 rts
diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl
index bd32204e..7f47b1e7 100644
--- a/haskell/ghc_bindist.bzl
+++ b/haskell/ghc_bindist.bzl
@@ -511,6 +511,7 @@ def ghc_bindist(
"8.8.2": ["@rules_haskell//haskell:assets/ghc_8_8_2_win_base.patch"],
"8.8.3": ["@rules_haskell//haskell:assets/ghc_8_8_3_win_base.patch"],
"8.8.4": ["@rules_haskell//haskell:assets/ghc_8_8_4_win_base.patch"],
+ "8.10.3": ["@rules_haskell//haskell:assets/ghc_8_10_3_win_base.patch"],
}.get(version) if target == "windows_amd64" else None
extra_attrs = {"patches": patches, "patch_args": ["-p0"]} if patches else {}
diff --git a/haskell/private/actions/package.bzl b/haskell/private/actions/package.bzl
index a122332c..bc6d3d11 100644
index f46f56bc..3d14527b 100644
--- a/haskell/private/actions/package.bzl
+++ b/haskell/private/actions/package.bzl
@@ -98,8 +98,13 @@ def package(
@@ -107,7 +107,12 @@ def package(
"library-dirs": ["${pkgroot}"] + extra_lib_dirs,
"dynamic-library-dirs": ["${pkgroot}"] + extra_dynamic_lib_dirs,
"hs-libraries": [pkg_id.library_name(hs, my_pkg_id)] if has_hs_library else [],
@ -41,8 +12,7 @@ index a122332c..bc6d3d11 100644
+ "crypt32",
+ "shlwapi",
+ "ws2_32",
+ ] if hs.toolchain.is_windows else []),
+ ]) if hs.toolchain.is_windows else [],
"depends": hs.package_ids,
"exposed-modules": exposed_modules,
})

View File

@ -1,20 +0,0 @@
diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl
index aee64067..e049f37f 100644
--- a/haskell/ghc_bindist.bzl
+++ b/haskell/ghc_bindist.bzl
@@ -385,7 +385,11 @@ haskell_toolchain(
if os == "windows":
# These libraries cause linking errors on Windows when linking
- # pthreads, due to libwinpthread-1.dll not being loaded.
- execute_or_fail_loudly(ctx, ["rm", "mingw/lib/gcc/x86_64-w64-mingw32/7.2.0/libstdc++.dll.a"])
- execute_or_fail_loudly(ctx, ["rm", "mingw/x86_64-w64-mingw32/lib/libpthread.dll.a"])
- execute_or_fail_loudly(ctx, ["rm", "mingw/x86_64-w64-mingw32/lib/libwinpthread.dll.a"])
+ # pthreads, due to libwinpthread-1.dll not being loaded. It's
+ # hard to guesss the paths of these libraries, so we have to
+ # use dir to recursively find them.
+ result = ctx.execute(["cmd", "/c", "dir", "/s", "/b", "libstdc++.dll.a"])
+ for path in result.stdout.splitlines():
+ ctx.execute(["cmd", "/c", "del", path.strip()])
+ ctx.execute(["rm", "mingw/x86_64-w64-mingw32/lib/libpthread.dll.a"])
+ ctx.execute(["rm", "mingw/x86_64-w64-mingw32/lib/libwinpthread.dll.a"])

View File

@ -1,13 +0,0 @@
diff --git a/haskell/repositories.bzl b/haskell/repositories.bzl
index 691ecaf2..d0021200 100644
--- a/haskell/repositories.bzl
+++ b/haskell/repositories.bzl
@@ -66,7 +66,7 @@ def rules_haskell_dependencies():
sha256 = "f18a40816260a9a3190a94efb0fc26270b244a2436681602f0a944739095d632",
strip_prefix = "protobuf-3.15.1",
urls = [
- "https://github.com/google/protobuf/archive/v3.15.1.tar.gz",
+ "https://github.com/protocolbuffers/protobuf/archive/v3.15.1.tar.gz",
],
)

View File

@ -34,10 +34,12 @@ load(
"buildifier_version",
"rules_bazel_common_sha256",
"rules_bazel_common_version",
"rules_haskell_patches",
"rules_haskell_sha256",
"rules_haskell_version",
"rules_jvm_external_sha256",
"rules_jvm_external_version",
"rules_nixpkgs_patches",
"rules_nixpkgs_sha256",
"rules_nixpkgs_version",
"rules_nodejs_sha256",
@ -57,12 +59,8 @@ def daml_deps():
strip_prefix = "rules_haskell-%s" % rules_haskell_version,
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
patches = [
"@daml//bazel_tools:haskell-strict-source-names.patch",
"@daml//bazel_tools:haskell-windows-remove-fake-libs.patch",
"@daml//bazel_tools:haskell-windows-extra-libraries.patch",
"@daml//bazel_tools:haskell-cc-wrapper-windows.patch",
# Should be upstreamed.
"@daml//bazel_tools:haskell_protobuf_source.patch",
p.replace("@com_github_digital_asset_daml", "@daml")
for p in rules_haskell_patches
],
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
@ -75,14 +73,8 @@ def daml_deps():
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
patches = [
# On CI and locally we observe occasional segmantation faults
# of nix. A known issue since Nix 2.2.2 is that HTTP2 support
# can cause such segmentation faults. Since Nix 2.3.2 it is
# possible to disable HTTP2 via a command-line flag, which
# reportedly solves the issue. See
# https://github.com/NixOS/nix/issues/2733#issuecomment-518324335
"@daml//bazel_tools:nixpkgs-disable-http2.patch",
"@daml//bazel_tools:rules-nixpkgs-llvm-cov.patch",
p.replace("@com_github_digital_asset_daml", "@daml")
for p in rules_nixpkgs_patches
],
patch_args = ["-p1"],
)

View File

@ -33,10 +33,27 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
rules_scala_version = "67a7ac178a73d1d5ff4c2b0663a8eda6dfcbbc56"
rules_scala_sha256 = "95054009fd938ac7ef53a20619f94a5408d8ae74eb5b318cd150a3ecb1a6086f"
rules_haskell_version = "60ed30aab00e9ffa2e2fe19e59f7de885f029556"
rules_haskell_sha256 = "a9c94b1fb61e1e341b7544305e9b0a359594779f797fddfcfcd447709c7c9820"
rules_nixpkgs_version = "0dd4c8a085b108592b0193ad1e237e2e07f715ac"
rules_nixpkgs_sha256 = "f2073135db911ee94b70da1e2288dd2445976a1b20a1edfe67773b29751f50a9"
rules_haskell_version = "e444e82d3c354da7b7b09d26a65f14226730c5c1"
rules_haskell_sha256 = "3f3ddedb66c3fc13f62536c5d0865b7cd6a881a0cd8cfa149c32e47e3f7156c5"
rules_haskell_patches = [
# This is a daml specific patch and not upstreamable.
"@com_github_digital_asset_daml//bazel_tools:haskell-windows-extra-libraries.patch",
# This should be made configurable in rules_haskell.
# Remove this patch once that's available.
"@com_github_digital_asset_daml//bazel_tools:haskell-opt.patch",
]
rules_nixpkgs_version = "c40b35f73e5ab1c0096d95abf63027a3b8054061"
rules_nixpkgs_sha256 = "47fffc870a25d82deedb887c32481a43a12f56b51e5002773046f81fbe3ea9df"
rules_nixpkgs_patches = [
# On CI and locally we observe occasional segmantation faults
# of nix. A known issue since Nix 2.2.2 is that HTTP2 support
# can cause such segmentation faults. Since Nix 2.3.2 it is
# possible to disable HTTP2 via a command-line flag, which
# reportedly solves the issue. See
# https://github.com/NixOS/nix/issues/2733#issuecomment-518324335
"@com_github_digital_asset_daml//bazel_tools:nixpkgs-disable-http2.patch",
]
buildifier_version = "4.0.0"
buildifier_sha256 = "0d3ca4ed434958dda241fb129f77bd5ef0ce246250feed2d5a5470c6f29a77fa"
zlib_version = "1.2.11"
@ -79,23 +96,7 @@ def daml_deps():
name = "rules_haskell",
strip_prefix = "rules_haskell-%s" % rules_haskell_version,
urls = ["https://github.com/tweag/rules_haskell/archive/%s.tar.gz" % rules_haskell_version],
patches = [
# Update and remove this patch once this is upstreamed.
# See https://github.com/tweag/rules_haskell/pull/1281
"@com_github_digital_asset_daml//bazel_tools:haskell-strict-source-names.patch",
# The fake libs issue should be fixed in upstream rules_haskell
# or GHC. Remove this patch once that's available.
"@com_github_digital_asset_daml//bazel_tools:haskell-windows-remove-fake-libs.patch",
# This is a daml specific patch and not upstreamable.
"@com_github_digital_asset_daml//bazel_tools:haskell-windows-extra-libraries.patch",
# This should be made configurable in rules_haskell.
# Remove this patch once that's available.
"@com_github_digital_asset_daml//bazel_tools:haskell-opt.patch",
# Can be removed once https://github.com/tweag/rules_haskell/pull/1464 is merged.
"@com_github_digital_asset_daml//bazel_tools:haskell-cc-wrapper-windows.patch",
# Should be upstreamed.
"@com_github_digital_asset_daml//bazel_tools:haskell_protobuf_source.patch",
],
patches = rules_haskell_patches,
patch_args = ["-p1"],
sha256 = rules_haskell_sha256,
)
@ -106,17 +107,7 @@ def daml_deps():
strip_prefix = "rules_nixpkgs-%s" % rules_nixpkgs_version,
urls = ["https://github.com/tweag/rules_nixpkgs/archive/%s.tar.gz" % rules_nixpkgs_version],
sha256 = rules_nixpkgs_sha256,
patches = [
# On CI and locally we observe occasional segmantation faults
# of nix. A known issue since Nix 2.2.2 is that HTTP2 support
# can cause such segmentation faults. Since Nix 2.3.2 it is
# possible to disable HTTP2 via a command-line flag, which
# reportedly solves the issue. See
# https://github.com/NixOS/nix/issues/2733#issuecomment-518324335
"@com_github_digital_asset_daml//bazel_tools:nixpkgs-disable-http2.patch",
# Already upstreamed to rules-nixpkgs. Remove on next upgrade.
"@com_github_digital_asset_daml//bazel_tools:rules-nixpkgs-llvm-cov.patch",
],
patches = rules_nixpkgs_patches,
patch_args = ["-p1"],
)