You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bazel/hunspell: Fall back to source-built hunspell for consumers - #5563
The prebuilt hub only covers Linux x86_64/aarch64, so on eg macOS consumers had no hunspell toolchain. Make the source build (@hunspell_src and @dictionary_en) and its toolchain non-dev, registered after the prebuilt hub: platforms without a prebuilt fetch and compile hunspell, everything else keeps the prebuilt.
Test the source build directly (resolution prefers the prebuilt), which also builds it for macOS in CI.
The prebuilt hub only covers Linux x86_64/aarch64, so on eg macOS
consumers had no hunspell toolchain. Make the source build (`@hunspell_src`
and `@dictionary_en`) and its toolchain non-dev, registered after the
prebuilt hub: platforms without a prebuilt fetch and compile hunspell,
everything else keeps the prebuilt.
Test the source build directly (resolution prefers the prebuilt), which
also builds it for macOS in CI.
Signed-off-by: Ryan Northey <[email protected]>
The build overlay assumes POSIX headers, so register the source
toolchain per supported exec OS: elsewhere (eg Windows) resolution fails
cleanly instead of selecting a toolchain that cannot build.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The new test fails on stock macOS because it uses mapfile, which is unavailable in system Bash 3.2, so it needs a compatible read loop or an explicitly provided newer Bash runtime.
This PR makes source-built hunspell available to downstream consumers when no prebuilt toolchain matches, notably on macOS, while preserving prebuilt preference.
Changes:
Exposes source archives and registers Linux/macOS source fallback toolchains for consumers.
Adds a direct source-build test and normalizes dictionary paths in the shared checker.
Updates documentation to explain fallback behavior.
File
Description
bazel/MODULE.bazel
Makes source dependencies and fallback toolchains available to consumers.
bazel/hunspell/test/BUILD
Adds a direct test of source-built hunspell.
bazel/hunspell/test/assert_hunspell_pipe.sh
Accepts dictionary paths with or without .dic.
bazel/hunspell/source/BUILD
Constrains source toolchains to Linux and macOS execution platforms.
The source test now also runs on macOS, whose system bash 3.2 has no
`mapfile`.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
macOS CI does not exercise the new fallback toolchain registration or its provider/runfiles wiring because the existing toolchain test remains Linux-only.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Run the toolchain test on macOS to cover source_toolchain_macos
bazel/hunspell/test/BUILD:60
This checks the source executable but never resolves the fallback toolchain. The existing hunspell_toolchain_test is still Linux-only, so macOS CI does not exercise the new source_toolchain_macos registration or its provider/runfiles wiring. Remove that test's Linux-only constraint at line 15 so it also runs on macOS, while retaining this direct test for source-build coverage on Linux.
Let `hunspell_toolchain_test` run on macOS, where it resolves the source
fallback, and run it with the direct source test in a macOS CI job: the
existing macOS job only builds, so nothing resolved and ran the fallback
there.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The test in bazel/hunspell/test/BUILD lacks Linux/macOS compatibility constraints, so its direct source dependency bypasses toolchain safeguards and attempts to compile POSIX-only code on Windows.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Restrict the source overlay test to Linux and macOS
bazel/hunspell/test/BUILD:71
This test bypasses toolchain resolution and unconditionally builds the source overlay, so bazel test //hunspell/test/... on Windows now attempts to compile code that requires POSIX headers such as unistd.h. The OS constraints on the fallback toolchains do not protect this direct dependency. Give this test the same Linux/macOS target_compatible_with select as hunspell_toolchain_test; it will still run in macOS CI while being skipped on unsupported platforms.
`hunspell_source_test` and `source_impl` build the source overlay
directly, outside the fallback toolchains' OS constraints, so on eg
Windows `//...` would try to compile POSIX-only code. Give them the same
Linux/macOS compatibility, and document the limit.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The implementation’s OS constraint checks the target platform rather than the execution platform, making valid cross-platform toolchain resolutions incompatible despite hunspell and its dictionary being exec-configured dependencies.
…entation
`target_compatible_with` on `source_impl` checked the consumer's target
platform, so a toolchain resolved for a supported exec platform could
still be rejected. Constrain the source `hunspell` binary instead: the
toolchain builds it in the exec configuration, so the check is against
the exec platform, and dependents (incl. the direct source test) are
skipped elsewhere.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ryan Northey <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The prebuilt hub only covers Linux x86_64/aarch64, so on eg macOS consumers had no hunspell toolchain. Make the source build (
@hunspell_srcand@dictionary_en) and its toolchain non-dev, registered after the prebuilt hub: platforms without a prebuilt fetch and compile hunspell, everything else keeps the prebuilt.Test the source build directly (resolution prefers the prebuilt), which also builds it for macOS in CI.