Thank you for your interest in contributing to cpclib! This document provides guidelines and instructions for contributing.
-
Rust Toolchain: Nightly channel is required
rustup toolchain install nightly rustup override set nightly -
Platform-specific requirements:
- Windows: Use
nightly-x86_64-pc-windows-gnutoolchainrustup toolchain install nightly-x86_64-pc-windows-gnu rustup default nightly-x86_64-pc-windows-gnu
- Linux/macOS: Standard nightly toolchain works
- Windows: Use
# Clone the repository
git clone https://github.com/cpcsdk/rust.cpclib
cd rust.cpcdemotools
# Build all workspace crates
cargo build --workspace
# Build in release mode
cargo build --release --workspace
# Build a specific crate
cargo build -p cpclib-basm# Run all tests
cargo test --workspace
# Run tests for a specific crate
cargo test -p cpclib-asm
# Run a specific test
cargo test test_nameBefore submitting a PR, ensure your code passes these checks:
# Format code
cargo fmt --all
# Run clippy
cargo clippy --workspace --all-targets --all-features -- -D warnings
# Check for common issues
cargo deny checkThis is a Cargo workspace with multiple crates:
cpclib- Core library with most functionalitycpclib-asm- Z80 assembler componentscpclib-basm- Main assembler binarycpclib-bndbuild- Build automation tool (like Make for CPC demos)cpclib-runner- Emulator and tool integrationcpclib-disc- DSK file manipulationcpclib-sna- Snapshot file handlingcpclib-image- Image conversion to CPC formatscpclib-xfer- Hardware communication (cpcwifi)- GUI tools -
cpclib-visual-basm,cpclib-visual-bndbuild
- Avoid
.unwrap()in library code - useResultand?operator - Use
.expect()only when panic is truly appropriate with a clear message - Provide meaningful error messages
- Add doc comments (
///) for public APIs - Include examples in doc comments when helpful
- Update README files when adding new features
- Add unit tests for new functionality
- Add integration tests for user-facing features
- Test edge cases and error conditions
-
Fork the repository and create a feature branch
git checkout -b feature/my-new-feature
-
Make your changes with clear, atomic commits
git commit -m "Add support for new feature" -
Update documentation if you're changing user-facing behavior
-
Run quality checks locally:
cargo fmt --all cargo clippy --workspace cargo test --workspace -
Push to your fork
git push origin feature/my-new-feature
-
Create a Pull Request on GitHub with:
- Clear description of what changed and why
- Reference any related issues
- Screenshots/examples if applicable
-
Address review feedback and update your PR
When reporting bugs, please include:
- OS and Rust version (
rustc --version) - Steps to reproduce
- Expected vs actual behavior
- Relevant error messages or logs
Feature requests are welcome! Please:
- Check if the feature already exists or is planned
- Describe the use case clearly
- Explain how it fits with the project's goals
./build_windows.shexport PATH=~/src/osxcross/target/bin:$PATH
export PKG_CONFIG_ALLOW_CROSS=1
export CC=o64-clang
export CXX=o64-clang++
./build_osx_from_linux.sh./build_linux.shReleases are managed by project maintainers. Version numbers follow semantic versioning.
- Open an issue for bugs or questions
- Check existing documentation at https://cpcsdk.github.io/rust.cpclib/
- Review demo projects listed in the main README
By contributing, you agree that your contributions will be licensed under the MIT License.