Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tweag/rules_haskell
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 45e4b454ce89f72138e95514053d001d05f68f83
Choose a base ref
..
head repository: tweag/rules_haskell
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6ef57124c8bb5ffcfeb295e79e6e659c081a54b1
Choose a head ref
12 changes: 6 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -30,9 +30,9 @@ bazel_skylib_workspace()

http_archive(
name = "rules_proto",
sha256 = "303e86e722a520f6f326a50b41cfc16b98fe6d1955ce46642a5b7a67c11c0f5d",
strip_prefix = "rules_proto-6.0.0",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
strip_prefix = "rules_proto-6.0.2",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
)

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
@@ -46,10 +46,10 @@ rules_proto_toolchains()
# For buildifier
http_archive(
name = "io_bazel_rules_go",
sha256 = "33acc4ae0f70502db4b893c9fc1dd7a9bf998c23e7ff2c4517741d4049a976f8",
sha256 = "b2038e2de2cace18f032249cb4bb0048abf583a36369fa98f687af1b3f880b26",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.48.1/rules_go-v0.48.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.48.1/rules_go-v0.48.1.zip",
],
)

2 changes: 1 addition & 1 deletion examples/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ bazel_dep(
)
bazel_dep(
name = "bazel_skylib",
version = "1.6.1",
version = "1.7.1",
)

non_module_deps = use_extension(":non_module_deps.bzl", "non_module_deps")
6 changes: 6 additions & 0 deletions haskell/private/cc_wrapper.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@bazel_skylib//lib:paths.bzl", "paths")
load("@rules_cc//cc:action_names.bzl", "ACTION_NAMES")
load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain", "use_cc_toolchain")
load("@rules_python//python:defs.bzl", "py_binary")
@@ -46,6 +47,10 @@ def _cc_wrapper_impl(ctx):
feature_configuration = feature_configuration,
action_name = ACTION_NAMES.c_compile,
)
ar = cc_common.get_tool_for_action(
feature_configuration = feature_configuration,
action_name = ACTION_NAMES.cpp_link_static_library,
)
cc_wrapper = ctx.actions.declare_file(ctx.label.name)
ctx.actions.expand_template(
template = ctx.file.template,
@@ -56,6 +61,7 @@ def _cc_wrapper_impl(ctx):
"{:cpu:}": cc_toolchain.cpu,
"{:workspace:}": ctx.workspace_name,
"{:platform:}": ctx.attr.platform,
"{:bindir:}": paths.dirname(ar),
},
)
return [DefaultInfo(
15 changes: 11 additions & 4 deletions haskell/private/cc_wrapper.py.tpl
Original file line number Diff line number Diff line change
@@ -83,9 +83,10 @@ WORKSPACE = "{:workspace:}"
CC = os.environ.get("CC_WRAPPER_CC_PATH", "{:cc:}")
PLATFORM = os.environ.get("CC_WRAPPER_PLATFORM", "{:platform:}")
CPU = os.environ.get("CC_WRAPPER_CPU", "{:cpu:}")
INSTALL_NAME_TOOL = "/usr/bin/install_name_tool"
CODESIGN = "/usr/bin/codesign"
OTOOL = "/usr/bin/otool"
INSTALL_NAME_TOOL = "{:bindir:}/install_name_tool"
CODESIGN = "{:bindir:}/codesign"
CODESIGN_ALLOCATE = "{:bindir:}/codesign_allocate"
OTOOL = "{:bindir:}/otool"


def main():
@@ -930,12 +931,18 @@ def darwin_rewrite_load_commands(rewrites, output):
if args:
subprocess.check_call([INSTALL_NAME_TOOL] + args + [output])
# Resign the binary after patching it.
# Fall back to /usr/bin/codesign if the `CODESIGN` executable is not available
# (this might happen when using a default cc toolchain from a nix shell on Darwin instead
# of using a nixpkgs_cc_configure'd toolchain).
# Do the same for codesign_allocate.
codesign = CODESIGN if os.access(CODESIGN, os.X_OK) else "/usr/bin/codesign"
codesign_allocate = CODESIGN_ALLOCATE if os.access(CODESIGN_ALLOCATE, os.X_OK) else "/usr/bin/codesign_allocate"
# This is necessary on MacOS Monterey on M1.
# The moving back and forth is necessary because the OS caches the signature.
# See this note from nixpkgs for reference:
# https://github.com/NixOS/nixpkgs/blob/5855ff74f511423e3e2646248598b3ffff229223/pkgs/os-specific/darwin/signing-utils/utils.sh#L1-L6
os.rename(output, f"{output}.resign")
subprocess.check_call([CODESIGN] + ["-f", "-s", "-"] + [f"{output}.resign"])
subprocess.check_call([codesign] + ["-f", "-s", "-"] + [f"{output}.resign"], env = {'CODESIGN_ALLOCATE': codesign_allocate})
os.rename(f"{output}.resign", output)


6 changes: 4 additions & 2 deletions haskell/private/pkgdb_to_bzl.py
Original file line number Diff line number Diff line change
@@ -109,8 +109,10 @@ def hs_library_pattern(package_name, name, mode = "static", profiling = False):
# - `lib<library-name>.<dyn-library-extension>*`
if name.startswith("C"):
libname = name[1:] if mode == "dynamic" else name
dyn_suffix = ""
elif name.startswith("HS"):
libname = name
dyn_suffix = "-ghc*"
else:
sys.error("do not know how to handle hs-library `{}` in package {}".format(name, package_name))

@@ -127,8 +129,8 @@ def hs_library_pattern(package_name, name, mode = "static", profiling = False):
libnames = [libname + config for config in configs]

if mode == "dynamic":
libnames = [libname + "-ghc*" for libname in libnames]
exts = ["so", "so.*", "dylib", "dll"] if mode == "dynamic" else ["a"]
libnames = [libname + dyn_suffix for libname in libnames]
exts = ["so", "so.*", "dylib", "dll"]
else:
exts = ["a"]

16 changes: 8 additions & 8 deletions haskell/repositories.bzl
Original file line number Diff line number Diff line change
@@ -41,10 +41,10 @@ def rules_haskell_dependencies():
http_archive,
name = "bazel_skylib",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz",
],
sha256 = "9f38886a40548c6e96c106b752f242130ee11aaa068a56ba7e56f4511f33e4f2",
sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f",
)

maybe(
@@ -58,9 +58,9 @@ def rules_haskell_dependencies():
maybe(
http_archive,
name = "rules_python",
sha256 = "e3f1cc7a04d9b09635afb3130731ed82b5f58eadc8233d4efb59944d92ffc06f",
strip_prefix = "rules_python-0.33.2",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.33.2/rules_python-0.33.2.tar.gz",
sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618",
strip_prefix = "rules_python-0.34.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz",
)

maybe(
@@ -99,8 +99,8 @@ def rules_haskell_dependencies():
# required by rules_nixpkgs
http_archive(
name = "rules_nodejs",
sha256 = "8fc8e300cb67b89ceebd5b8ba6896ff273c84f6099fc88d23f24e7102319d8fd",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.4/rules_nodejs-core-5.8.4.tar.gz"],
sha256 = "0c2277164b1752bb71ecfba3107f01c6a8fb02e4835a790914c71dfadcf646ba",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.8.5/rules_nodejs-core-5.8.5.tar.gz"],
)

http_archive(
10 changes: 5 additions & 5 deletions rules_haskell_tests/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -57,27 +57,27 @@ bazel_dep(
)
bazel_dep(
name = "bazel_skylib",
version = "1.6.1",
version = "1.7.1",
)
bazel_dep(
name = "rules_java",
version = "6.5.2",
)
bazel_dep(
name = "rules_nodejs",
version = "5.8.3",
version = "5.8.5",
)
bazel_dep(
name = "aspect_rules_js",
version = "1.42.3",
)
bazel_dep(
name = "aspect_bazel_lib",
version = "2.7.3",
version = "2.7.8",
)
bazel_dep(
name = "rules_proto",
version = "6.0.0",
version = "6.0.2",
)
bazel_dep(
name = "protobuf",
@@ -200,7 +200,7 @@ local_path_override(
# Go setup for buildifieR
bazel_dep(
name = "rules_go",
version = "0.48.0",
version = "0.48.1",
repo_name = "io_bazel_rules_go",
)

18 changes: 9 additions & 9 deletions rules_haskell_tests/WORKSPACE
Original file line number Diff line number Diff line change
@@ -28,9 +28,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# For testing if bzlmod is enabled
http_archive(
name = "aspect_bazel_lib",
sha256 = "87ab4ec479ebeb00d286266aca2068caeef1bb0b1765e8f71c7b6cfee6af4226",
strip_prefix = "bazel-lib-2.7.3",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.3/bazel-lib-v2.7.3.tar.gz",
sha256 = "714cf8ce95a198bab0a6a3adaffea99e929d2f01bf6d4a59a2e6d6af72b4818c",
strip_prefix = "bazel-lib-2.7.8",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.7.8/bazel-lib-v2.7.8.tar.gz",
)

# bazel dependencies
@@ -45,9 +45,9 @@ bazel_skylib_workspace()

http_archive(
name = "rules_proto",
sha256 = "303e86e722a520f6f326a50b41cfc16b98fe6d1955ce46642a5b7a67c11c0f5d",
strip_prefix = "rules_proto-6.0.0",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.0/rules_proto-6.0.0.tar.gz",
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
strip_prefix = "rules_proto-6.0.2",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
)

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
@@ -61,10 +61,10 @@ rules_proto_toolchains()
# For buildifier
http_archive(
name = "io_bazel_rules_go",
sha256 = "33acc4ae0f70502db4b893c9fc1dd7a9bf998c23e7ff2c4517741d4049a976f8",
sha256 = "b2038e2de2cace18f032249cb4bb0048abf583a36369fa98f687af1b3f880b26",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.48.0/rules_go-v0.48.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.48.1/rules_go-v0.48.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.48.1/rules_go-v0.48.1.zip",
],
)