Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate and fix parallel grammar builds on Windows #869

Merged
merged 4 commits into from
Feb 10, 2025
Merged
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
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Prefetch grammars
run: cargo run --all-features -- prefetch

- name: Run test suite
run: cargo test --all-features

Expand Down
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ This name should be decided amongst the team before the release.

### Fixed
- [#867](https://github.com/tweag/topiary/pull/867) Enable coverage check and add code samples for OpenSCAD
- [#869](https://github.com/tweag/topiary/pull/869) Disable parallel grammar building on Windows

<!-->
<!--

### Security
- <Vulnerabilities>
Expand Down
9 changes: 6 additions & 3 deletions topiary-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,11 @@ impl Configuration {
let tmp_dir = tempdir()?;
let tmp_dir_path = tmp_dir.path().to_owned();

// When "parallel" is enabled, we use rayon to fetch and compile all found grammars in parallel.
#[cfg(feature = "parallel")]
// When the `parallel` feature is enabled (which it is by default), we use Rayon to fetch
// and compile all found grammars concurrently.
// NOTE The MSVC linker does not seem to like concurrent builds, so concurrency is disabled
// on Windows (see https://github.com/tweag/topiary/issues/868)
#[cfg(all(feature = "parallel", not(windows)))]
{
use rayon::prelude::*;
self.languages
Expand All @@ -160,7 +163,7 @@ impl Configuration {
.collect::<Result<Vec<_>, TopiaryConfigFetchingError>>()?;
}

#[cfg(not(feature = "parallel"))]
#[cfg(any(not(feature = "parallel"), windows))]
{
self.languages
.iter()
Expand Down