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
Fallback to spec shaking v1 if env var is not set (#1831)
### What
Change spec shaking v2 feature to gracefully fall back to v1 when the
`SOROBAN_SDK_BUILD_SYSTEM_SUPPORTS_SPEC_SHAKING_V2` env var is not set,
instead of panicking.
If the build process falls back to v1, a build warning is emitted:
```
Compiling soroban-sdk v26.0.0-rc.1 (/Users/alex/dev/stellar/rs-soroban-sdk/soroban-sdk)
warning: soroban-sdk@26.0.0-rc.1: soroban-sdk: feature 'experimental_spec_shaking_v2' was enabled
but not used, because this build was not started by a tool that supports spec shaking v2. Falling back to
spec shaking v1. To use v2, use a build tool that supports spec shaking v2 such as stellar-cli v25.2.0+
with `stellar contract build`. To manually use v2 without a supporting build tool, set the env var
SOROBAN_SDK_BUILD_SYSTEM_SUPPORTS_SPEC_SHAKING_V2 before building.
```
### Why
The `experimental_spec_shaking_v2` feature is enabled by default.
Previously, if the env var was not set and the target was wasm, the
build script panicked with an error.
Now, spec shaking v2 activates only when both the feature and the env
var are present. When the feature is enabled but the env var is missing,
the SDK falls back to v1 behavior and emits a compiler warning on wasm
targets. This allows `cargo build` to succeed without requiring
`stellar-cli`, while still benefiting from v2 when built with compatible
tooling.
### Known limitations
None
0 commit comments