8e255b2125
Phase 8.2 — Gradual Ownership: - Add tkRef/tkMutRef types and `mut` keyword - Add @[Checked] attribute for opt-in borrow checking - Reject assignment through &T in checked functions - examples/ownership.bux Phase 8.4 — CTFE: - Evaluate const func at compile-time via evalExpr/evalBlock - Fold const declarations to literals; emit #define in C - examples/ctfe.bux (Factorial(10) → 3628800) Phase 8.5 — Trait Bounds: - Change declFuncTypeParams from seq[string] to seq[TypeParam] (name + bound) - Parser handles <T: Comparable> - Sema checks typeImplements at call sites - Fix C backend: generic receivers + pointer self field access - examples/trait_bounds.bux Phase 9.1 — Package Manager: - Inline tables/arrays in TOML parser - bux add, bux install, bux.lock generation - Dependency resolution with git/path sources - Build pipeline merges dependency .bux sources C Backend Fixes: - resolveExprType(ekIdent) now applies typeSubst for generic params - Method desugaring works for monomorphized generic receivers - Pointer checks use isPointer (covers tkRef/tkMutRef) - Field access on &T emits -> instead of . Remove accidentally committed test binaries from tracking
2.7 KiB
2.7 KiB
Bux Package Manager
Status: Implemented (Phase 9.1) | Format: Compatible with Rux.toml spec
Manifest (bux.toml)
Every Bux package has a bux.toml at the project root.
[Package]
Name = "MyApp"
Version = "0.1.0"
Type = "bin" # bin | lib | shared | static
Authors = ["Your Name <you@example.com>"]
License = "MIT"
[Build]
Output = "Bin"
[Dependencies]
Std = "1.0"
Json = { Version = "2.1", Source = "https://github.com/bux-lang/json" }
Utils = { Path = "../Utils" }
Dependency Forms
| Form | Example | Description |
|---|---|---|
| Version string | Std = "1.0" |
Registry dependency |
| Wildcard | Std = "*" |
Latest version |
| Inline table (git) | { Version = "1.4", Source = "https://..." } |
Git URL + version |
| Inline table (path) | { Path = "../Lib" } |
Local path dependency |
CLI Commands
bux add <name> [version]
Add a dependency to bux.toml.
# Add registry dependency
bux add json "2.1"
# Add path-based dependency
bux add utils --path "../utils"
# Add git dependency
bux add network --git "https://github.com/bux-lang/network"
bux install
Resolve dependencies and generate bux.lock.
bux install
What it does:
- Reads
[Dependencies]frombux.toml - Resolves path-based deps (verifies directory exists)
- Clones/pulls git-based deps to
~/.bux/packages/<name>/ - Generates
bux.lockwith exact versions and sources
bux build / bux run
Automatically reads bux.lock and merges dependency source files into the build.
bux build # Compile with all dependencies
bux run # Build and run
Lockfile (bux.lock)
Auto-generated. Do not edit manually.
[[Package]]
Name = "json"
Version = "2.1.3"
Source = "https://github.com/bux-lang/json"
Checksum = "8dcb2a7f..."
[[Package]]
Name = "utils"
Version = "0.1.0"
Source = "/home/user/projects/utils"
The lockfile ensures reproducible builds — every developer gets the exact same dependency versions.
Dependency Resolution Rules
- Path-based deps are resolved relative to the manifest directory
- Git-based deps are cloned to
~/.bux/packages/<name>/ - Version-based deps (without Source) require a registry (future feature)
- Dependencies are loaded from
<dep>/src/*.buxat build time - Later declarations shadow earlier ones (project > deps > stdlib)
Example: Creating a Library
bux new mylib
cd mylib
# Edit src/Main.bux → module MyLib { pub func Add(...) }
bux build # Builds as library (Type = "lib")
Example: Using a Library
bux new myapp
cd myapp
bux add mylib --path "../mylib"
bux install
# Edit src/Main.bux → import MyLib::Add;
bux run