mirror of
https://github.com/digital-asset/daml.git
synced 2024-09-19 08:48:21 +03:00
Update rules_haskell (#8987)
changelog_begin changelog_end Co-authored-by: Andreas Herrmann <andreas.herrmann@tweag.io>
This commit is contained in:
parent
fc743374f6
commit
f4eeed396a
@ -1,22 +1,23 @@
|
||||
diff --git a/haskell/BUILD.bazel b/haskell/BUILD.bazel
|
||||
index 910dc57c..99547c5d 100644
|
||||
index 8bdd9922..aeafacfe 100644
|
||||
--- a/haskell/BUILD.bazel
|
||||
+++ b/haskell/BUILD.bazel
|
||||
@@ -92,12 +92,6 @@ py_binary(
|
||||
visibility = ["//visibility:public"],
|
||||
@@ -99,13 +99,6 @@ py_library(
|
||||
visibility = ["//tests/package_configuration:__subpackages__"],
|
||||
)
|
||||
|
||||
-py_binary(
|
||||
- name = "ls_modules",
|
||||
- srcs = ["private/ls_modules.py"],
|
||||
- visibility = ["//visibility:public"],
|
||||
- deps = [":package_configuration"],
|
||||
-)
|
||||
-
|
||||
sh_binary(
|
||||
name = "ghc_wrapper",
|
||||
srcs = ["private/ghc_wrapper.sh"],
|
||||
diff --git a/haskell/defs.bzl b/haskell/defs.bzl
|
||||
index 0d50f7a9..d359248e 100644
|
||||
index 91c49825..afc5ec15 100644
|
||||
--- a/haskell/defs.bzl
|
||||
+++ b/haskell/defs.bzl
|
||||
@@ -66,11 +66,6 @@ _haskell_common_attrs = {
|
||||
@ -181,7 +182,7 @@ index 0d50f7a9..d359248e 100644
|
||||
deps: List of other Haskell libraries to be linked to this target.
|
||||
data: See [Bazel documentation](https://docs.bazel.build/versions/master/be/common-definitions.html#common.data).,
|
||||
diff --git a/haskell/private/actions/compile.bzl b/haskell/private/actions/compile.bzl
|
||||
index 90c0cc90..f5ac99e6 100644
|
||||
index 6c5f75e9..e167e6a3 100644
|
||||
--- a/haskell/private/actions/compile.bzl
|
||||
+++ b/haskell/private/actions/compile.bzl
|
||||
@@ -10,7 +10,6 @@ load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||
@ -309,7 +310,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
source_files = source_files,
|
||||
extra_source_files = extra_source_files,
|
||||
import_dirs = import_dirs,
|
||||
@@ -385,7 +403,7 @@ def compile_binary(
|
||||
@@ -386,7 +404,7 @@ def compile_binary(
|
||||
dep_info,
|
||||
plugin_dep_info,
|
||||
srcs,
|
||||
@ -318,16 +319,16 @@ index 90c0cc90..f5ac99e6 100644
|
||||
import_dir_map,
|
||||
extra_srcs,
|
||||
user_compile_flags,
|
||||
@@ -405,7 +423,7 @@ def compile_binary(
|
||||
@@ -406,7 +424,7 @@ def compile_binary(
|
||||
modules: set of module names
|
||||
source_files: set of Haskell source files
|
||||
"""
|
||||
- c = _compilation_defaults(hs, cc, java, posix, dep_info, plugin_dep_info, srcs, import_dir_map, extra_srcs, user_compile_flags, with_profiling, my_pkg_id = None, version = version, plugins = plugins, preprocessors = preprocessors)
|
||||
+ c = _compilation_defaults(hs, cc, java, posix, dep_info, plugin_dep_info, srcs, module_map, import_dir_map, extra_srcs, user_compile_flags, "dynamic-too" if dynamic else "static", with_profiling, my_pkg_id = None, version = version, plugins = plugins, preprocessors = preprocessors)
|
||||
+ c = _compilation_defaults(hs, cc, java, posix, dep_info, plugin_dep_info, srcs, module_map, import_dir_map, extra_srcs, user_compile_flags, "dynamic" if dynamic else "static", with_profiling, my_pkg_id = None, version = version, plugins = plugins, preprocessors = preprocessors)
|
||||
c.args.add_all(["-main-is", main_function])
|
||||
if dynamic:
|
||||
# For binaries, GHC creates .o files even for code to be
|
||||
@@ -417,10 +435,9 @@ def compile_binary(
|
||||
@@ -418,10 +436,9 @@ def compile_binary(
|
||||
coverage_data = []
|
||||
if inspect_coverage:
|
||||
c.args.add_all(_hpc_compiler_args(hs))
|
||||
@ -340,7 +341,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
|
||||
hs.toolchain.actions.run_ghc(
|
||||
hs,
|
||||
@@ -435,7 +452,7 @@ def compile_binary(
|
||||
@@ -436,7 +453,7 @@ def compile_binary(
|
||||
)
|
||||
|
||||
return struct(
|
||||
@ -349,7 +350,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
source_files = c.source_files,
|
||||
extra_source_files = c.extra_source_files,
|
||||
import_dirs = c.import_dirs,
|
||||
@@ -451,6 +468,7 @@ def compile_library(
|
||||
@@ -452,6 +469,7 @@ def compile_library(
|
||||
dep_info,
|
||||
plugin_dep_info,
|
||||
srcs,
|
||||
@ -357,7 +358,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
import_dir_map,
|
||||
extra_srcs,
|
||||
user_compile_flags,
|
||||
@@ -472,7 +490,7 @@ def compile_library(
|
||||
@@ -473,7 +491,7 @@ def compile_library(
|
||||
source_files: set of Haskell module files
|
||||
import_dirs: import directories that should make all modules visible (for GHCi)
|
||||
"""
|
||||
@ -366,7 +367,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
if with_shared:
|
||||
c.args.add("-dynamic-too")
|
||||
|
||||
@@ -485,11 +503,10 @@ def compile_library(
|
||||
@@ -486,11 +504,10 @@ def compile_library(
|
||||
coverage_data = []
|
||||
if hs.coverage_enabled:
|
||||
c.args.add_all(_hpc_compiler_args(hs))
|
||||
@ -381,7 +382,7 @@ index 90c0cc90..f5ac99e6 100644
|
||||
|
||||
if srcs:
|
||||
hs.toolchain.actions.run_ghc(
|
||||
@@ -503,76 +520,13 @@ def compile_library(
|
||||
@@ -504,76 +521,13 @@ def compile_library(
|
||||
env = c.env,
|
||||
arguments = c.args,
|
||||
)
|
||||
@ -712,7 +713,7 @@ index a122332c..bcb83c73 100644
|
||||
|
||||
return conf_file, cache_file
|
||||
diff --git a/haskell/private/haskell_impl.bzl b/haskell/private/haskell_impl.bzl
|
||||
index e99cb829..11a03231 100644
|
||||
index f46d008d..28b2d83c 100644
|
||||
--- a/haskell/private/haskell_impl.bzl
|
||||
+++ b/haskell/private/haskell_impl.bzl
|
||||
@@ -11,10 +11,6 @@ load(
|
||||
@ -734,7 +735,7 @@ index e99cb829..11a03231 100644
|
||||
"get_dynamic_hs_lib_name",
|
||||
"get_lib_extension",
|
||||
"get_static_hs_lib_name",
|
||||
@@ -177,6 +174,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
@@ -178,6 +175,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
|
||||
with_profiling = is_profiling_enabled(hs)
|
||||
srcs_files, import_dir_map = _prepare_srcs(ctx.attr.srcs)
|
||||
@ -742,7 +743,7 @@ index e99cb829..11a03231 100644
|
||||
inspect_coverage = _should_inspect_coverage(ctx, hs, is_test)
|
||||
|
||||
dynamic = not ctx.attr.linkstatic
|
||||
@@ -198,7 +196,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
@@ -199,7 +197,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
dep_info,
|
||||
plugin_dep_info,
|
||||
srcs = srcs_files,
|
||||
@ -751,7 +752,7 @@ index e99cb829..11a03231 100644
|
||||
import_dir_map = import_dir_map,
|
||||
extra_srcs = depset(ctx.files.extra_srcs),
|
||||
user_compile_flags = user_compile_flags,
|
||||
@@ -226,7 +224,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
@@ -227,7 +225,7 @@ def _haskell_binary_common_impl(ctx, is_test):
|
||||
dep_info,
|
||||
ctx.files.extra_srcs,
|
||||
user_compile_flags,
|
||||
@ -760,7 +761,7 @@ index e99cb829..11a03231 100644
|
||||
dynamic = dynamic,
|
||||
with_profiling = with_profiling,
|
||||
version = ctx.attr.version,
|
||||
@@ -360,6 +358,7 @@ def haskell_library_impl(ctx):
|
||||
@@ -361,6 +359,7 @@ def haskell_library_impl(ctx):
|
||||
|
||||
with_profiling = is_profiling_enabled(hs)
|
||||
srcs_files, import_dir_map = _prepare_srcs(ctx.attr.srcs)
|
||||
@ -768,7 +769,7 @@ index e99cb829..11a03231 100644
|
||||
|
||||
with_shared = not ctx.attr.linkstatic
|
||||
if with_profiling or hs.toolchain.static_runtime:
|
||||
@@ -384,6 +383,7 @@ def haskell_library_impl(ctx):
|
||||
@@ -385,6 +384,7 @@ def haskell_library_impl(ctx):
|
||||
dep_info,
|
||||
plugin_dep_info,
|
||||
srcs = srcs_files,
|
||||
@ -776,7 +777,7 @@ index e99cb829..11a03231 100644
|
||||
import_dir_map = import_dir_map,
|
||||
extra_srcs = depset(ctx.files.extra_srcs),
|
||||
user_compile_flags = user_compile_flags,
|
||||
@@ -396,14 +396,9 @@ def haskell_library_impl(ctx):
|
||||
@@ -397,14 +397,9 @@ def haskell_library_impl(ctx):
|
||||
|
||||
other_modules = ctx.attr.hidden_modules
|
||||
exposed_modules_reexports = _exposed_modules_reexports(ctx.attr.reexported_modules)
|
||||
@ -794,7 +795,7 @@ index e99cb829..11a03231 100644
|
||||
|
||||
if srcs_files:
|
||||
static_library = link_library_static(
|
||||
@@ -411,7 +406,7 @@ def haskell_library_impl(ctx):
|
||||
@@ -412,7 +407,7 @@ def haskell_library_impl(ctx):
|
||||
cc,
|
||||
posix,
|
||||
dep_info,
|
||||
@ -803,7 +804,7 @@ index e99cb829..11a03231 100644
|
||||
my_pkg_id,
|
||||
with_profiling = with_profiling,
|
||||
)
|
||||
@@ -425,7 +420,7 @@ def haskell_library_impl(ctx):
|
||||
@@ -426,7 +421,7 @@ def haskell_library_impl(ctx):
|
||||
posix,
|
||||
dep_info,
|
||||
depset(ctx.files.extra_srcs),
|
||||
@ -812,7 +813,7 @@ index e99cb829..11a03231 100644
|
||||
my_pkg_id,
|
||||
user_compile_flags,
|
||||
)
|
||||
@@ -438,14 +433,14 @@ def haskell_library_impl(ctx):
|
||||
@@ -439,14 +434,14 @@ def haskell_library_impl(ctx):
|
||||
posix,
|
||||
dep_info,
|
||||
with_shared,
|
||||
@ -831,10 +832,10 @@ index e99cb829..11a03231 100644
|
||||
|
||||
diff --git a/haskell/private/ls_modules.py b/haskell/private/ls_modules.py
|
||||
deleted file mode 100755
|
||||
index bb4d616a..00000000
|
||||
index c3202e83..00000000
|
||||
--- a/haskell/private/ls_modules.py
|
||||
+++ /dev/null
|
||||
@@ -1,110 +0,0 @@
|
||||
@@ -1,111 +0,0 @@
|
||||
-#!/usr/bin/env python3
|
||||
-#
|
||||
-# Create a list of exposed modules (including reexported modules)
|
||||
@ -853,6 +854,8 @@ index bb4d616a..00000000
|
||||
-import sys
|
||||
-import io
|
||||
-
|
||||
-import package_configuration
|
||||
-
|
||||
-if len(sys.argv) != 7:
|
||||
- sys.exit("Usage: %s <WITH_PROFILING> <DIRECTORY> <GLOBAL_PKG_DB> <HIDDEN_MODS_FILE> <REEXPORTED_MODS_FILE> <RESULT_FILE>" % sys.argv[0])
|
||||
-
|
||||
@ -864,23 +867,22 @@ index bb4d616a..00000000
|
||||
-results_file = sys.argv[6]
|
||||
-
|
||||
-with io.open(global_pkg_db_dump, "r", encoding='utf8') as f:
|
||||
- names = [line.split()[1] for line in f if line.startswith("name:")]
|
||||
- f.seek(0)
|
||||
- ids = [line.split()[1] for line in f if line.startswith("id:")]
|
||||
- name_id_pairs = [
|
||||
- (pkg.name, pkg.id)
|
||||
- for pkg in package_configuration.parse_package_database_dump(f)
|
||||
- ]
|
||||
-
|
||||
- # A few sanity checks.
|
||||
- assert len(names) == len(ids)
|
||||
-# compute duplicate, i.e. package name associated with multiples ids
|
||||
-names = [name for (name, _) in name_id_pairs]
|
||||
-duplicates = set()
|
||||
-if len(names) != len(set(names)):
|
||||
- duplicates = set([
|
||||
- name for name, count in collections.Counter(names).items()
|
||||
- if count > 1
|
||||
- ])
|
||||
-
|
||||
- # compute duplicate, i.e. package name associated with multiples ids
|
||||
- duplicates = set()
|
||||
- if len(names) != len(set(names)):
|
||||
- duplicates = set([
|
||||
- name for name, count in collections.Counter(names).items()
|
||||
- if count > 1
|
||||
- ])
|
||||
-
|
||||
- # This associate pkg name to pkg id
|
||||
- pkg_ids_map = dict(zip(names, ids))
|
||||
-# This associate pkg name to pkg id
|
||||
-pkg_ids_map = dict(name_id_pairs)
|
||||
-
|
||||
-with io.open(hidden_modules_file, "r", encoding='utf8') as f:
|
||||
- hidden_modules = [mod.strip() for mod in f.read().split(",")]
|
||||
@ -1187,10 +1189,10 @@ index f5c6220f..66fbd572 100644
|
||||
from_list = _from_list,
|
||||
to_list = _to_list,
|
||||
diff --git a/haskell/protobuf.bzl b/haskell/protobuf.bzl
|
||||
index 523551b5..41af5edf 100644
|
||||
index 9181c6b3..92a11e6e 100644
|
||||
--- a/haskell/protobuf.bzl
|
||||
+++ b/haskell/protobuf.bzl
|
||||
@@ -180,7 +180,6 @@ def _haskell_proto_aspect_impl(target, ctx):
|
||||
@@ -184,7 +184,6 @@ def _haskell_proto_aspect_impl(target, ctx):
|
||||
bin_dir = ctx.bin_dir,
|
||||
disabled_features = ctx.rule.attr.features,
|
||||
executable = struct(
|
||||
@ -1198,7 +1200,7 @@ index 523551b5..41af5edf 100644
|
||||
_ghc_wrapper = ctx.executable._ghc_wrapper,
|
||||
worker = None,
|
||||
),
|
||||
@@ -267,11 +266,6 @@ _haskell_proto_aspect = aspect(
|
||||
@@ -271,11 +270,6 @@ _haskell_proto_aspect = aspect(
|
||||
allow_single_file = True,
|
||||
default = Label("@rules_haskell//haskell:private/ghci_repl_wrapper.sh"),
|
||||
),
|
||||
@ -1221,14 +1223,14 @@ index ae300ffd..2ca5916e 100644
|
||||
import Proto.Tests.HaddockProtobuf.HelloWorld
|
||||
|
||||
diff --git a/tests/version-macros/BUILD.bazel b/tests/version-macros/BUILD.bazel
|
||||
index 595fbabc..a9b53a1c 100644
|
||||
index 73d1fddd..6f8c6fd4 100644
|
||||
--- a/tests/version-macros/BUILD.bazel
|
||||
+++ b/tests/version-macros/BUILD.bazel
|
||||
@@ -50,6 +50,7 @@ haskell_test(
|
||||
@@ -54,6 +54,7 @@ haskell_test(
|
||||
"MainC2hs.hs",
|
||||
":c2hs-lib",
|
||||
],
|
||||
+ main_file = "MainC2hs.hs",
|
||||
tags = ["requires_c2hs"],
|
||||
version = "4.5.6.7",
|
||||
deps = [
|
||||
tags = [
|
||||
# See https://github.com/tweag/rules_haskell/issues/1486
|
||||
"dont_test_on_darwin_with_bindist",
|
||||
|
4
deps.bzl
4
deps.bzl
@ -33,8 +33,8 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
rules_scala_version = "67a7ac178a73d1d5ff4c2b0663a8eda6dfcbbc56"
|
||||
rules_scala_sha256 = "95054009fd938ac7ef53a20619f94a5408d8ae74eb5b318cd150a3ecb1a6086f"
|
||||
|
||||
rules_haskell_version = "3987c494f7a3b72805855246a844a28880dd0b15"
|
||||
rules_haskell_sha256 = "7f6e7005cefbce61930e2feca71d96abba9d7a23059ca1bcdc1d13355f5d448f"
|
||||
rules_haskell_version = "60ed30aab00e9ffa2e2fe19e59f7de885f029556"
|
||||
rules_haskell_sha256 = "a9c94b1fb61e1e341b7544305e9b0a359594779f797fddfcfcd447709c7c9820"
|
||||
rules_nixpkgs_version = "0dd4c8a085b108592b0193ad1e237e2e07f715ac"
|
||||
rules_nixpkgs_sha256 = "f2073135db911ee94b70da1e2288dd2445976a1b20a1edfe67773b29751f50a9"
|
||||
buildifier_version = "4.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user