Introduce pigweed and bazel

Introduce bazel to the repository.
- Name the bazel module `openprot`.
- Add pigweed and its dependencies.
- Add the `pw` automation script and basic workflows.

Signed-off-by: Chris Frantz <cfrantz@google.com>
14 files changed
tree: b14bb6b2425ccf8feddc6d52334a110bed6bde03
  1. .cargo/
  2. .github/
  3. docs/
  4. hal/
  5. openprot/
  6. platform/
  7. services/
  8. third_party/
  9. xtask/
  10. .bazelignore
  11. .bazelrc
  12. .bazelversion
  13. .gitignore
  14. .semgrepignore
  15. BUILD.bazel
  16. Cargo.lock
  17. Cargo.toml
  18. deny.toml
  19. LICENSE
  20. MODULE.bazel
  21. MODULE.bazel.lock
  22. pw
  23. README.md
  24. rust-toolchain.toml
  25. workflows.json
README.md

OpenPRoT

Technical Charter

The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md

Getting Started

NOTE: We are converting our build system to bazel. We recommend installing bazelisk to automatically manage bazel versions.

This project uses cargo-xtask for build automation and project management.

Available Tasks

You can run tasks using cargo xtask <task-name>:

  • cargo xtask build - Build the project
  • cargo xtask test - Run all tests
  • cargo xtask check - Run cargo check
  • cargo xtask clippy - Run clippy lints
  • cargo xtask fmt - Format code with rustfmt
  • cargo xtask clean - Clean build artifacts
  • cargo xtask dist - Build a distribution (release build)
  • cargo xtask docs - Build documentation with mdbook
  • cargo xtask cargo-lock - Manage Cargo.lock file
  • cargo xtask precheckin - Run all pre-checkin validation checks
  • cargo xtask header-check - Check license headers in source files
  • cargo xtask header-fix - Fix missing license headers in source files

Examples

# Build the project
cargo xtask build

# Run tests
cargo xtask test

# Create a distribution
cargo xtask dist

# Format code
cargo xtask fmt

# Run clippy
cargo xtask clippy

# Build documentation
cargo xtask docs

# Run all pre-checkin validation checks
cargo xtask precheckin

# Check license headers
cargo xtask header-check

# Fix missing license headers
cargo xtask header-fix

Development

The project is structured as a Cargo workspace with two main components:

  • openprot/ - The main application
  • xtask/ - Build automation scripts

The xtask workflow allows you to add custom build steps, automation, and project management tasks written in Rust, making them cross-platform and easy to maintain.

Requirements

  • Rust 1.70+ (2021 edition)
  • Cargo

No additional tools are required - everything is handled through Cargo and the xtask scripts.