Commit 94bbb95
Refactor BB2/Sandbox code into package extension
This refactors all BinaryBuilder2 and Sandbox-related code into a
package extension (SandboxExt) that loads conditionally when Sandbox
and BinaryBuilder2 are available. This significantly reduces the
dependency footprint for users who don't need sandboxing.
Changes:
- Move all BB2/Sandbox dependencies from [deps] to [weakdeps]
- Keep Scratch as primary dependency (used by base package)
- Create ext/SandboxExt.jl extension triggered by Sandbox + BinaryBuilder2
- Move all sandbox functions to ext/sandbox_impl.jl
- Add sandbox_stubs.jl with 0-method function declarations
- Use invokelatest for all calls to extension functions
- Automatically load Sandbox/BB2 when sandbox mode requested
- Access BinaryBuilderToolchains through BinaryBuilder2 import
- Fix nested module references (e.g., BinaryBuilder2.BinaryBuilderSources)
Extension loading:
- Extension triggers on: Sandbox + BinaryBuilder2
- BinaryBuilderToolchains accessed via BinaryBuilder2, not as trigger
- has_sandbox_support() implemented by extension to return true
- Use hasmethod() check before attempting to load
- Use Base.invokelatest() for all extension function calls
Error handling:
- Distinguish between "not installed" vs other load errors
- Provide helpful error messages with --direct flag suggestion
- Show full backtrace in verbose mode for debugging
This maintains full backward compatibility while making the package
much lighter for users who run with --direct mode.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 2380ee8 commit 94bbb95
File tree
7 files changed
+725
-1179
lines changed- ext
- src
7 files changed
+725
-1179
lines changed
0 commit comments