Add optional support for building native extensions of path sources - #9820
Open
akiellor wants to merge 1 commit into
Open
Add optional support for building native extensions of path sources#9820akiellor wants to merge 1 commit into
akiellor wants to merge 1 commit into
Conversation
akiellor
force-pushed
the
andrew/path-native-ext
branch
from
August 27, 2026 00:41
73231e3 to
7dab41b
Compare
This adds a new `build_path_extensions` setting for local path gems with native extensions. When enabled, Bundler compiles those extensions out of tree under `BUNDLE_PATH`, keeps the checkout untouched, and puts the built extension directory ahead of the gem's own load paths so `bundle exec` and `require` can load the compiled artifacts. The feature supports per-gem opt in via `build_path_extensions.<gem>`, reuses existing build flags from `build.<gem>`, avoids rebuilding when nothing changed, and rebuilds when native extension sources or build flags change. It also surfaces native extension build output for path sources and preserves the existing failure mode when a required extension has not been built or has gone stale.
akiellor
force-pushed
the
andrew/path-native-ext
branch
from
August 27, 2026 00:42
7dab41b to
2e1090d
Compare
Author
|
This PR is an attempt to tackle this issue. Feedback is welcome 🙏. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What was the end-user or developer problem that led to this PR?
Bundler did not build native extensions for gems sourced from a local
:path, which is a common setup in monorepos. That meant path-based gems that relied on compiled code could not be used unless developers built those extensions manually in their checkout. In practice, this made local development in monorepos inconsistent with out-of-tree gems, brokebundle exec/requirefor those gems, and added manual setup steps that made the developer experience worse.What is your fix for the problem, implemented in this PR?
This adds a new
build_path_extensionssetting for local path gems with native extensions. When enabled, Bundler compiles those extensions out of tree underBUNDLE_PATH, keeps the checkout untouched, and puts the built extension directory ahead of the gem's own load paths sobundle execandrequirecan load the compiled artifacts.The feature supports per-gem opt in via
build_path_extensions.<gem>, reuses existing build flags frombuild.<gem>, avoids rebuilding when nothing changed, and rebuilds when native extension sources or build flags change. It also surfaces native extension build output for path sources and preserves the existing failure mode when a required extension has not been built or has gone stale.Make sure the following tasks are checked