Skip to content

Add optional support for building native extensions of path sources - #9820

Open
akiellor wants to merge 1 commit into
ruby:masterfrom
Hummingbird-RegTech:andrew/path-native-ext
Open

Add optional support for building native extensions of path sources#9820
akiellor wants to merge 1 commit into
ruby:masterfrom
Hummingbird-RegTech:andrew/path-native-ext

Conversation

@akiellor

Copy link
Copy Markdown

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, broke bundle exec / require for 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_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.

Make sure the following tasks are checked

@akiellor
akiellor force-pushed the andrew/path-native-ext branch from 73231e3 to 7dab41b Compare August 27, 2026 00:41
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
akiellor force-pushed the andrew/path-native-ext branch from 7dab41b to 2e1090d Compare August 27, 2026 00:42
@akiellor

akiellor commented Aug 27, 2026

Copy link
Copy Markdown
Author

This PR is an attempt to tackle this issue. Feedback is welcome 🙏.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant