Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion haskell/assets/relpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# returns relative path to $2=$target from $1=$source
## NOTE : path are compared in text only. They don’t have to exist
## and they WONT be normalized/escaped
## and they WON'T be normalized/escaped
## Result in "$return_value"# both $1 and $2 are absolute paths beginning with /

src="$1"
Expand Down
2 changes: 1 addition & 1 deletion haskell/asterius/asterius_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def asterius_tools_config(exec_cc_toolchain, posix_toolchain, node_toolchain, to
return struct(
# Asterius needs node in the path to evaluate template
# haskell. And the asterius bundle depends on the posix toolchain
# because it containts wrapper scripts.
# because it contains wrapper scripts.
path_for_run_ghc = posix_toolchain.paths + node_paths,
path_for_cabal = node_paths,
tools_for_ghc = node_toolchain.nodeinfo.tool_files,
Expand Down
8 changes: 4 additions & 4 deletions haskell/asterius/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -282,21 +282,21 @@ def _asterius_common_impl(is_asterius_test, name, ahc_dist_dep, entry_point, dat

def asterius_test(**kwargs):
"""\
A wrapper around the [js_test](https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_test) rule compatibe with asterius.
A wrapper around the [js_test](https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_test) rule compatible with asterius.

Args:
name: A unique name for this rule.
ahc_dist_dep:
The ahc_dist target (built with target="node") to be executed.
entry_point:
If the `entry_point` attribute was overriden in the `ahc_dist_dep` target,
If the `entry_point` attribute was overridden in the `ahc_dist_dep` target,
we need to specify the same here.
"""
_asterius_common_impl(is_asterius_test = True, **kwargs)

def asterius_binary(**kwargs):
"""\
A wrapper around the [js_binary](https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_binary) rule compatibe with asterius.
A wrapper around the [js_binary](https://github.com/aspect-build/rules_js/blob/main/docs/js_binary.md#js_binary) rule compatible with asterius.

Args:
name: A unique name for this rule.
Expand Down Expand Up @@ -339,7 +339,7 @@ def _name_of_label(label):

def asterius_webpack(name, ahc_dist_dep, entry_point, tags = [], srcs = [], **kwargs):
"""
Wapper around webpack that switches to a configuration where asterius targets the browser.
Wrapper around webpack that switches to a configuration where asterius targets the browser.
"""
subfolder_name = paths.dirname(entry_point)
webpack_cli_name = "{}-asterius-webpack-private".format(name)
Expand Down
2 changes: 1 addition & 1 deletion haskell/asterius/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def rules_haskell_asterius_toolchain(
ahc_pkg: Label of the `ahc-pkg` binary.
asterius_binaries: Filegroup containing the asterius top-level binaries.
full_bundle: Filegroup with the asterius_binaries and all their dependencies.
wasm_cc_toolchain: A web asssembly cc toolchain.
wasm_cc_toolchain: A web assembly cc toolchain.
ghcopts: [see rules_haskell_toolchains](toolchain.html#rules_haskell_toolchains-ghcopts)
haddock_flags: [see rules_haskell_toolchains](toolchain.html#rules_haskell_toolchains-haddock_flags)
repl_ghci_args: [see rules_haskell_toolchains](toolchain.html#rules_haskell_toolchains-repl_ghci_args)
Expand Down
2 changes: 1 addition & 1 deletion haskell/c2hs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def _c2hs_library_impl(ctx):
outputs = [hs_file, chi_file],
command =
# cpp (called via c2hs) gets very unhappy if the mingw bin dir is
# not in PATH so we add it to PATH explicitely.
# not in PATH so we add it to PATH explicitly.
(
"""
export PATH=$PATH:{mingw_bin}
Expand Down
4 changes: 2 additions & 2 deletions haskell/cabal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1284,7 +1284,7 @@ def _parse_package_spec(package_spec, enable_custom_toolchain_libraries, custom_
if enable_custom_toolchain_libraries and parsed["name"] not in custom_toolchain_libraries:
fail("""\
stack considers {name} a toolchain library, but it is not present in the toolchain_libraries attribute of the stack_snapshot rule: {}.
The {name} library may need to be added explicitely to a custom stack snapshot.
The {name} library may need to be added explicitly to a custom stack snapshot.
""".format(custom_toolchain_libraries, name = parsed["name"]))
else:
location["type"] = "core"
Expand Down Expand Up @@ -2753,7 +2753,7 @@ def stack_snapshot(
...,
)
```
setup_stack: Do not try to install stack if set to False (only usefull with bzlmod when only the first call to stack_snapshot must do the install).
setup_stack: Do not try to install stack if set to False (only useful with bzlmod when only the first call to stack_snapshot must do the install).
label_builder: A function to build a Label from the context of the caller module extension (only useful with bzlmod until we provide our own module extension).
"""
typecheck_stackage_extradeps(extra_deps)
Expand Down
2 changes: 1 addition & 1 deletion haskell/cc.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def ghc_cc_program_args(hs, cc, ld):
list of string, GHC arguments.
"""
args = [
# GHC uses C compiler for assemly, linking and preprocessing as well.
# GHC uses C compiler for assembly, linking and preprocessing as well.
"-pgma",
cc,
"-pgmc",
Expand Down
2 changes: 1 addition & 1 deletion haskell/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def haskell_runfiles(
base = "@rules_haskell//tools/runfiles:base"):
""" Convenience wrapper around rules_haskell runfiles library.

This wrapper is especially usefull with bzlmod, when a haskell library with runfiles is used from another module
This wrapper is especially useful with bzlmod, when a haskell library with runfiles is used from another module
(see [runfiles](https://github.com/tweag/rules_haskell/blob/master/tools/runfiles/README.md)).

### Usage
Expand Down
2 changes: 1 addition & 1 deletion haskell/doctest.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _haskell_doctest_single(target, ctx):
# doctest needs PATH to call GHC and the C compiler and linker.
export PATH
# signal our cc_wrapper to silence linker outputs as GHC < 9.4 writes that to
# the GHCI ouput which interferes with doctest's expected ouput
# the GHCI output which interferes with doctest's expected output
export RULES_HASKELL_SILENCE_LINKER=1
{doctest} "$@" {inputs} > {output} 2>&1 || (rc=$? && cat {output} && exit $rc)
""".format(
Expand Down
2 changes: 1 addition & 1 deletion haskell/experimental/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _haskell_module = rule(
cfg = "exec",
default = Label("@rules_haskell//haskell:ghc_wrapper"),
),
# TODO[AH] Suppport worker
# TODO[AH] Support worker
},
toolchains = use_cc_toolchain() + [
"@rules_haskell//haskell:toolchain",
Expand Down
2 changes: 1 addition & 1 deletion haskell/experimental/private/module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ def _merge_narrowed_deps_dicts(rule_label, narrowed_deps):
transitive_dyn_objects = {}
for dep in narrowed_deps:
if not HaskellInfo in dep or not HaskellLibraryInfo in dep:
fail("{}: depedency {} is not a haskell_library as required when used in narrowed_deps".format(
fail("{}: dependency {} is not a haskell_library as required when used in narrowed_deps".format(
str(rule_label),
str(dep.label),
))
Expand Down
4 changes: 2 additions & 2 deletions haskell/ghc_bindist.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ _ghc_bindist = repository_rule(
"patches": attr.label_list(
default = [],
doc =
"A list of files that are to be applied as patches afer " +
"A list of files that are to be applied as patches after " +
"extracting the archive.",
),
"patch_tool": attr.string(
Expand Down Expand Up @@ -697,7 +697,7 @@ def configure_python3_toolchain(name, register = True):
Note that prior to Bazel 0.27, there was no check to ensure that the interpreter's version matched the version declared by the target (#4815). If your build worked prior to Bazel 0.27, and you're sure your targets do not require Python 3, you can opt out of this version check by using the non-strict autodetecting toolchain instead of the standard autodetecting toolchain. This can be done by passing the flag `--extra_toolchains=@rules_python//python:autodetecting_toolchain_nonstrict` on the command line or adding it to your bazelrc.
```

This function defins a custom auto detcting Python toolchain that looks for
This function defins a custom auto detecting Python toolchain that looks for
a Python 3 interpreter within a repository rule, so that Bazel's sandboxing
does not restrict the visible installation paths. It then registers an
appropriate Python toolchain, so that build actions themselves can still be
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/actions/link.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def darwin_flags_for_linking_indirect_cc_deps(hs, cc, posix, basename, dynamic):
# are not directly resolving undefined symbols in the binary. I.e. any
# indirect shared library dependencies will be removed. This conflicts with
# Bazel's builtin cc rules, which assume that the final binary will load
# all transitive shared library dependencies. In particlar shared libraries
# all transitive shared library dependencies. In particular shared libraries
# produced by Bazel's cc rules never load shared libraries themselves. This
# causes missing symbols at runtime on MacOS, see #170.
#
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/actions/process_hsc_file.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def process_hsc_file(hs, cc, hsc_flags, hsc_inputs, hsc_file):
# Add an empty PATH variable if not already specified in hs.env.
# Needed to avoid a "Couldn't read PATH" error on Windows.
#
# On Unix platforms, though, we musn't set PATH as it is automatically set up
# On Unix platforms, though, we mustn't set PATH as it is automatically set up
# by the run action, unless already set in the env parameter. This triggers
# build errors when using GHC bindists on Linux.
if hs.env.get("PATH") == None and hs.toolchain.is_windows:
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/cabal_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ def make_relative_to_pkgroot(matchobj):
# On other systems paths may be relative to the distdir.
# These paths are invalid in the package configuration.
#
# Replace each ocurrence of either kind of path by one relative to ${pkgroot}.
# Replace each occurrence of either kind of path by one relative to ${pkgroot}.
line = re.sub(re.escape(cfg_execroot) + r'\S*', make_relative_to_pkgroot, line)
return line

Expand Down
4 changes: 2 additions & 2 deletions haskell/private/cc_wrapper.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ used to avoid command line length limitations.

Bazel 4.0.0 has its own cc_wrapper on macOS which attempts to expand any
argument starting with `@` as a response file. This will wrongly interpret
the follwoing types of arguments as referencing a response file:
the following types of arguments as referencing a response file:

-install_name @rpath/...
-Xlinker -rpath -Xlinker @executable_path/...
Expand Down Expand Up @@ -159,7 +159,7 @@ class Args:
if is_temporary_output(self.output):
# GHC with Template Haskell or tools like hsc2hs builds
# temporary Haskell binaries linked against libraries, but does
# not speficy the required runpaths on the command-line in the
# not specify the required runpaths on the command-line in the
# context of Bazel.
self.rpaths.extend(self.library_paths)
else:
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/dict.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Helper functions on dicts."""

def find(d, value):
""" Look for the first key correspondind to value `value` in dictionnary `d` """
""" Look for the first key corresponding to value `value` in dictionary `d` """
for (k, v) in d.items():
if v == value:
return k
Expand Down
4 changes: 2 additions & 2 deletions haskell/private/haskell_impl.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -870,11 +870,11 @@ def haskell_import_impl(ctx):
files = depset(target_files),
)

# This package haddock informations
# This package haddock information
transitive_html = {id: ctx.file.haddock_html} if ctx.file.haddock_html else {}
transitive_haddocks = {id: ctx.files.haddock_interfaces}

# Add dependencies haddock informations
# Add dependencies haddock information
for dep in ctx.attr.deps:
transitive_html.update(dep[HaddockInfo].transitive_html)
transitive_haddocks.update(dep[HaddockInfo].transitive_haddocks)
Expand Down
2 changes: 1 addition & 1 deletion haskell/private/path_utils.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def create_rpath_entry(
dependency,
keep_filename,
prefix = ""):
"""Return a (relative) path that points from `binary` to `dependecy`
"""Return a (relative) path that points from `binary` to `dependency`
while not leaving the current bazel runpath, taking into account weird
corner cases of `.short_path` concerning external repositories.
The resulting entry should be able to be inserted into rpath or similar.
Expand Down
4 changes: 2 additions & 2 deletions haskell/protobuf.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,11 @@ def _haskell_proto_aspect_impl(target, ctx):
# haskell_library_impl().
[hs_info, cc_info, cc_shared_library_info, _coverage_info, default_info, library_info, output_groups] = _haskell_library_impl(patched_ctx)

# Build haddock informations
# Build haddock information
transitive_html = {}
transitive_haddocks = {}

# Add dependencies haddock informations
# Add dependencies haddock information
for dep in ctx.toolchains["@rules_haskell//protobuf:toolchain"].deps:
if HaddockInfo in dep:
transitive_html.update(dep[HaddockInfo].transitive_html)
Expand Down
2 changes: 1 addition & 1 deletion haskell/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ def rules_haskell_dependencies():
],
patches = [
# see https://github.com/protocolbuffers/protobuf/issues/16844
# TODO: remove for protobuf version >= 32.0
# TODO: remove for protobuf version >= 31.0
"@rules_haskell//haskell:private/com_google_protobuf-protoc-dbghlp.diff",
],
patch_args = ["-p1"],
Expand Down
4 changes: 2 additions & 2 deletions haskell/toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def _run_ghc(
hs.actions.write(extra_args_file, arguments)

if abi_file != None:
# We declare the file containing informations about the call to GHC with --show-iface.
# We declare the file containing information about the call to GHC with --show-iface.
show_iface_file = hs.actions.declare_file("show_iface_%s_%s" % (hs.name, extra_name))
show_iface_args = hs.actions.args()
show_iface_args.set_param_file_format("multiline")
Expand All @@ -103,7 +103,7 @@ def _run_ghc(

# We create a file containing the name of all the interface files which should not be considered
# by the caching mechanism to know if recompilation should be triggered.
# This behaivour is extensively described in the Note [On the ABI hash] in haskell/experimaental/private/module.bzl
# This behaviour is extensively described in the Note [On the ABI hash] in haskell/experimaental/private/module.bzl
interface_with_abis_list = hs.actions.declare_file("interfaces_%s_%s" % (hs.name, extra_name))
interface_with_abis_args = hs.actions.args()
interface_with_abis_args.set_param_file_format("multiline")
Expand Down
9 changes: 8 additions & 1 deletion rules_haskell_tests/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,16 @@ bazel_dep(
)
bazel_dep(
name = "protobuf",
version = "21.7",
version = "28.3",
repo_name = "com_google_protobuf",
)
single_version_override(
module_name = "protobuf",
# see https://github.com/protocolbuffers/protobuf/issues/16844
# TODO: remove for protobuf version >= 31.0
patches = ["//:patches/com_google_protobuf-protoc-dbghlp.diff"],
patch_strip = 1,
)
bazel_dep(
name = "zlib",
version = "1.3.1.bcr.7",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/build_defs/cpp_opts.bzl b/build_defs/cpp_opts.bzl
index f667a4088..da463ca45 100644
--- a/build_defs/cpp_opts.bzl
+++ b/build_defs/cpp_opts.bzl
@@ -44,6 +44,11 @@ LINK_OPTS = select({
"-lm",
"-framework CoreFoundation",
],
+ "@platforms//os:windows": [
+ "-ldbghelp",
+ "-lpthread",
+ "-lm",
+ ],
"//conditions:default": [
"-lpthread",
"-lm",
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 60900d215..10c41b441 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -673,7 +673,7 @@ static_assert(PROTOBUF_ABSL_MIN(20230125, 3),
#error PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED was previously defined
#endif
#if defined(__GNUC__) && defined(__clang__) && !defined(__APPLE__) && \
- !defined(_MSC_VER)
+ !defined(_MSC_VER) && !defined(_WIN32)
#define PROTOBUF_DESCRIPTOR_WEAK_MESSAGES_ALLOWED
#endif