* Refactor diagnostics for warnings support
- Add render trait
- Render warnings after errors
- Reuse build code across build, layout
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Delete bundle
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix clippy lints
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add git ref metadata
3 stages to fetch_remote:
- Ensure remote is in cache
- Add appropriate symlinks
- Classify + store ref metadata
Some code cleanup:
- Factored out some git clone dupe code
- Centralized git operations in git.rs
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Warn on unstable refs
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add "-Dwarnings" flag to error on warnings
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Warn on unstable refs in Module()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add snapshot tests for warnings
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix span detection for chained Module()
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add ResolveContext, dedup resolve code
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Use spec history for better alias warnings
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add pcb.toml spans
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add type-erased error storage to Diagnostic
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix bug with load() span detection
The previous logic would just attempt to match by path, but if there are
multiple load() statements in a single file with the same path, then
find_load_span_for_path with always return the first.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Added diagnostics passes
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add LSP-specific pass to filter out some warnings
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix rebase conflicts
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix unstable ref detection logic
If we clone by tag and the tag exists in the git repo, it's a stable
ref. Same with commit.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Update Cargo.lock
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add pcb vendor
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Copy pcb.toml to release if it exists
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Use vendor dir in resolver
Add --offline support to build, layout.
Standardize behavior of find_workspace_root. Most of the callsites would
fallback on parent dir of target .zen file. We should just do that
universally to reduce conditional code paths.
Add an option to the resolve to not use the vendor dir in case that's
useful in some cases.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Drop vendor alias
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Only support pcb vendor in pcb.toml workspaces
Attempting to resolve a common workspace root from multiple zen files in
a dir without pcb.toml just got way too complicated. We can add support
for this in the future if needed.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Canonicalize zen_path
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add pcb release command
Intentially spartan in terms of flags/arguments. All that's needed is
the path to the .zen file.
To test:
cargo run -- release crates/pcb/test-workspace/boards/TestBoard.zen
Implemented:
- Workspace root detection (even without pcb.toml)
- Git-based versioning (e.g. tag > commit hash > dirty commit hash)
- Zen source files copied into release dir (release-dir/src)
- Dependencies are vendored into release dir (release-dir/src/vendor)
- Unmatched bom is generated into release dir (release-dir/bom)
- KiCad layout dir is copied into release dir (release-dir/layout)
- Metadata file is generated into release dir (release-dir/metadata.json)
- Generated artifacts are stored in .pcb/ dir (for now) and not uploaded
TODO:
- Upload the release bundle to API server
- Add a --dry-run to generate release bundle but not upload (similar to
cargo)
- Use the vendor/ dir for dependency resolution for deterministic builds
- Add pcb vendor subcommand, --offline flag for build/layout
- Add more release artifacts (e.g. gerbers, odb, etc.)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Fix windows compat
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add support, test-coverage for workspace-relative loads
Assume that pcb.toml is needed for workspace-relative loads
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Use workspace root .pcb dir for staging releases
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add structured, unmatched BOM export command
Run using `pcb bom <path/to/zen> -o json`
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Test bom command in CI
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Bump stdlib in examples from v0.2.0 to v0.2.2
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Remove default_multiplier, use struct for group key
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Use PhysicalValue to do less string parsing
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Add alternatives to group key
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* Use DynamicFullWidth for the comfy table
Attempts to fit the table within terminal width.
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
---------
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
* add pcb fmt
* unify pcb path in extension
* change the name of the extension
* bundle buildifier
* better path res
* fix clippy
* recursive
* fix format
* fix one more
* cargo info
* fix format on save
* use load resolving with modules
* local package resolution
* fix spec
* update snapshots
* remove unnecessary code
* move to snapshot tests
* revert eval errors
* canonical cache
* make tests work on windows
* refresh snap
* do not shadow alias
* fix: Add serial_test to prevent race conditions in module loading tests
- Add serial_test dependency to pcb-zen crate
- Mark tests that use package aliases with #[serial_test::serial]
- This prevents race conditions with the global ALIAS_CACHE when tests run in parallel
- Fixes test failures on Ubuntu where path canonicalization differs from macOS