diff --git a/haskell/assets/relpath.sh b/haskell/assets/relpath.sh index c2f82f430..317521244 100755 --- a/haskell/assets/relpath.sh +++ b/haskell/assets/relpath.sh @@ -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" diff --git a/haskell/asterius/asterius_config.bzl b/haskell/asterius/asterius_config.bzl index cef30b50a..953ded40c 100644 --- a/haskell/asterius/asterius_config.bzl +++ b/haskell/asterius/asterius_config.bzl @@ -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, diff --git a/haskell/asterius/defs.bzl b/haskell/asterius/defs.bzl index ea69a0385..d3b9f35d7 100644 --- a/haskell/asterius/defs.bzl +++ b/haskell/asterius/defs.bzl @@ -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. @@ -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) diff --git a/haskell/asterius/repositories.bzl b/haskell/asterius/repositories.bzl index 624cc9dda..07fa4f578 100644 --- a/haskell/asterius/repositories.bzl +++ b/haskell/asterius/repositories.bzl @@ -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) diff --git a/haskell/c2hs.bzl b/haskell/c2hs.bzl index 11c681eae..73b98cefc 100644 --- a/haskell/c2hs.bzl +++ b/haskell/c2hs.bzl @@ -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} diff --git a/haskell/cabal.bzl b/haskell/cabal.bzl index 5af933218..a3bd0b092 100644 --- a/haskell/cabal.bzl +++ b/haskell/cabal.bzl @@ -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" @@ -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) diff --git a/haskell/cc.bzl b/haskell/cc.bzl index e6851444e..8d0c0f30a 100644 --- a/haskell/cc.bzl +++ b/haskell/cc.bzl @@ -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", diff --git a/haskell/defs.bzl b/haskell/defs.bzl index dac2179c8..6487b365b 100644 --- a/haskell/defs.bzl +++ b/haskell/defs.bzl @@ -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 diff --git a/haskell/doctest.bzl b/haskell/doctest.bzl index 838dbcdf9..664cd61c9 100644 --- a/haskell/doctest.bzl +++ b/haskell/doctest.bzl @@ -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( diff --git a/haskell/experimental/defs.bzl b/haskell/experimental/defs.bzl index 8d9e5373f..7eb5aee39 100644 --- a/haskell/experimental/defs.bzl +++ b/haskell/experimental/defs.bzl @@ -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", diff --git a/haskell/experimental/private/module.bzl b/haskell/experimental/private/module.bzl index 886b29fb8..754a64c72 100644 --- a/haskell/experimental/private/module.bzl +++ b/haskell/experimental/private/module.bzl @@ -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), )) diff --git a/haskell/ghc_bindist.bzl b/haskell/ghc_bindist.bzl index f09d456fa..033207246 100644 --- a/haskell/ghc_bindist.bzl +++ b/haskell/ghc_bindist.bzl @@ -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( @@ -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 diff --git a/haskell/private/actions/link.bzl b/haskell/private/actions/link.bzl index 94302cfa4..c01777ac8 100644 --- a/haskell/private/actions/link.bzl +++ b/haskell/private/actions/link.bzl @@ -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. # diff --git a/haskell/private/actions/process_hsc_file.bzl b/haskell/private/actions/process_hsc_file.bzl index 31090b404..b22fcfd58 100644 --- a/haskell/private/actions/process_hsc_file.bzl +++ b/haskell/private/actions/process_hsc_file.bzl @@ -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: diff --git a/haskell/private/cabal_wrapper.py b/haskell/private/cabal_wrapper.py index 8bc35717d..ee8fb5abf 100755 --- a/haskell/private/cabal_wrapper.py +++ b/haskell/private/cabal_wrapper.py @@ -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 diff --git a/haskell/private/cc_wrapper.py.tpl b/haskell/private/cc_wrapper.py.tpl index 6b5ce9111..1e0062743 100644 --- a/haskell/private/cc_wrapper.py.tpl +++ b/haskell/private/cc_wrapper.py.tpl @@ -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/... @@ -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: diff --git a/haskell/private/dict.bzl b/haskell/private/dict.bzl index 043317eca..9df18647a 100644 --- a/haskell/private/dict.bzl +++ b/haskell/private/dict.bzl @@ -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 diff --git a/haskell/private/haskell_impl.bzl b/haskell/private/haskell_impl.bzl index b64c5b4cc..e120d99c7 100644 --- a/haskell/private/haskell_impl.bzl +++ b/haskell/private/haskell_impl.bzl @@ -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) diff --git a/haskell/private/path_utils.bzl b/haskell/private/path_utils.bzl index fc454e4de..99828f812 100644 --- a/haskell/private/path_utils.bzl +++ b/haskell/private/path_utils.bzl @@ -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. diff --git a/haskell/protobuf.bzl b/haskell/protobuf.bzl index c1cc4adc6..fd6979793 100644 --- a/haskell/protobuf.bzl +++ b/haskell/protobuf.bzl @@ -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) diff --git a/haskell/repositories.bzl b/haskell/repositories.bzl index 9f5f9d49c..05da35318 100644 --- a/haskell/repositories.bzl +++ b/haskell/repositories.bzl @@ -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"], diff --git a/haskell/toolchain.bzl b/haskell/toolchain.bzl index 6d445adce..5e033af84 100644 --- a/haskell/toolchain.bzl +++ b/haskell/toolchain.bzl @@ -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") @@ -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") diff --git a/rules_haskell_tests/MODULE.bazel b/rules_haskell_tests/MODULE.bazel index d24bac158..0b6ccc97c 100644 --- a/rules_haskell_tests/MODULE.bazel +++ b/rules_haskell_tests/MODULE.bazel @@ -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", diff --git a/rules_haskell_tests/patches/com_google_protobuf-protoc-dbghlp.diff b/rules_haskell_tests/patches/com_google_protobuf-protoc-dbghlp.diff new file mode 100644 index 000000000..133593d0d --- /dev/null +++ b/rules_haskell_tests/patches/com_google_protobuf-protoc-dbghlp.diff @@ -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 +