feat(scaffold): honor per-target core-dependency overrides in the scripting bindings#164
Merged
Goldziher merged 2 commits intoJul 3, 2026
Conversation
Extend target_dep_overrides (previously ffi/jni/dart/swift only) to the pyo3/napi/magnus/php/rustler backends, mirroring the FFI backend: when overrides are set, the core dependency moves out of [dependencies] into a cfg(not(...)) default block plus one [target.'cfg(<cfg>)'.dependencies] block per override. - shared render_core_dep_with_overrides helper in scaffold/mod.rs - target_dep_overrides config field on Python/Node/Ruby/Php/Elixir (+ schema) - wired all five scaffolds - unit tests for the renderer + an all-five-backends integration test Fixes xberg-io#163.
020dda9 to
f804399
Compare
The new field was added to the src/scaffold/tests literals but the integration tests under tests/ also construct PythonConfig/NodeConfig as full struct literals; --all-targets compilation failed with E0063. cargo check --all-targets, clippy (CI flags), and both affected test binaries are green.
Goldziher
added a commit
that referenced
this pull request
Jul 3, 2026
Two related issues introduced by feat(scaffold): emit canonical rustfmt.toml: 1. language_files() in scaffold/tests.rs did not filter rustfmt.toml. scaffold_poly() now emits [poly.toml, rustfmt.toml]; the helper already filtered poly.toml but not rustfmt.toml, so every language-specific file-count assertion was off by one. Fix: add rustfmt.toml to the project-level file filter, mirroring the existing poly.toml exclusion. 2. crates/alpha/Cargo.toml fixture in sync_versions_patches_dep_tables_on_ version_change lacked a src/lib.rs stub. cargo update --workspace --offline (called via run_optional) printed "no targets specified in the manifest" to the test output on every run. Fix: write an empty src/lib.rs alongside each member Cargo.toml so cargo's manifest validation is satisfied. Fixes #164.
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.
Fixes #163.
What this changes
alef generates a Rust crate for each language binding and writes its
Cargo.toml. You can tell alef to build the core crate with different features on a specific platform, viatarget_dep_overridesinalef.toml— but until now only the FFI, JNI, Dart, and Swift bindings honored it. The Python, Node, Ruby, PHP, and Elixir bindings ignored it and always wrote a single, platform-independent core dependency.This makes those five bindings honor it too.
Before — a Python binding's
Cargo.toml, override silently ignored:After — same binding, with an override configured for Intel macOS:
How
The FFI backend already does exactly this, so the change is a straight port, not new design:
render_core_dep_with_overrides);target_dep_overridesoption to the Python/Node/Ruby/PHP/Elixir configs (reusing the FFI backend'sFfiTargetDepOverride, as JNI already does), which regenerates the JSON schema;The override sets the features for the matched platform (same shape as FFI/JNI). The
default_features = falsevariant that Dart/Swift also support is not included here — it can be a follow-up if needed.Verification
cargo fmt --checkandcargo checkare clean. New tests cover the helper directly and assert that all five bindings emit the per-platform sections. The full library test run adds no failures:origin/mainis4181 passed / 14 failed, this branch is4184 passed / 14 failed— the same 14 pre-existing, environment-sensitivetest_scaffold_*failures (they read the real workspaceCargo.toml), plus the 3 new passing tests.Follow-up commit
ebcbaaaextends the new config field to the struct literals in thetests/integration suites (backends_pyo3_gen_bindings/*,backends_napi_gen_bindings_test.rs), so--all-targetscompiles cleanly — theValidatecheck is green as of that commit. The redTest/poly-validatechecks reproduce identically onmain(the 14 environment-sensitive failures above, and repo-widepoly fmtdrift in files this PR doesn't touch).