Thank you for your interest in contributing to Builder! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Project Structure
- Coding Standards
- Testing
- Documentation
- Pull Request Process
- Language Support
This project adheres to a code of conduct that all contributors are expected to follow:
- Be respectful and inclusive
- Welcome newcomers and help them get started
- Focus on what is best for the community
- Show empathy towards other community members
- Accept constructive criticism gracefully
-
Fork the repository
git clone https://github.com/GriffinCanCode/bldr.git cd bldr -
Build the project
make build
-
Run tests
make test -
Generate documentation
make docs
- D Compiler: DMD, LDC, or GDC (DMD 2.100+ recommended)
- DUB: D package manager
- Make: Build automation
- Python 3: For tooling and documentation generation
# Debug build
make debug
# Release build
make build
# With Thread Sanitizer (requires LDC)
make tsan# Run all tests
make test
# Run tests with coverage
make test-coverage
# Run tests in parallel
make test-parallel
# Run Thread Sanitizer tests
make test-tsanBuilder/
├── source/ # Main source code
│ ├── analysis/ # Code analysis and dependency detection
│ ├── cli/ # Command-line interface
│ ├── config/ # Configuration parsing (Builderfile DSL)
│ ├── core/ # Core build system (graph, execution, caching)
│ ├── errors/ # Error handling and Result types
│ ├── languages/ # Language-specific handlers
│ │ ├── compiled/ # C++, Rust, D, Zig, Nim, Swift, etc.
│ │ ├── dotnet/ # C#, F#
│ │ ├── jvm/ # Java, Kotlin, Scala
│ │ ├── scripting/ # Python, Ruby, Go, Elixir, PHP, R, Lua
│ │ └── web/ # JavaScript, TypeScript
│ ├── tools/ # VS Code extension and tooling
│ └── utils/ # Utilities (SIMD, crypto, concurrency, etc.)
├── tests/ # Test suite
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── bench/ # Benchmarks
├── docs/ # Documentation
│ ├── api/ # Auto-generated API docs
│ ├── architecture/ # Architecture documentation
│ ├── development/ # Development guides
│ ├── security/ # Security documentation
│ └── user-guides/ # User guides and examples
├── examples/ # Example projects in various languages
└── tools/ # Build and development tools
-
Memory Safety
// Prefer @safe code @safe void myFunction() { ... } // Document @trusted blocks with detailed safety comments /// Safety: This function is @trusted because: /// 1. Reason one /// 2. Reason two /// 3. What could go wrong and why it won't @trusted void criticalFunction() { ... }
-
Error Handling
// Use Result<T, E> instead of exceptions Result!(BuildOutput, BuildError) build(Target target) { if (!target.isValid()) return Result!(BuildOutput, BuildError).err( BuildError("Invalid target") ); return Result!(BuildOutput, BuildError).ok(output); }
-
Documentation
/// Brief description of the function /// /// Detailed explanation of what the function does, including /// any important behavior, caveats, or performance considerations. /// /// Params: /// param1 = Description of first parameter /// param2 = Description of second parameter /// /// Returns: Description of return value /// /// Throws: Only if using exceptions (prefer Result types) /// /// Examples: /// --- /// auto result = myFunction(42, "hello"); /// assert(result.isOk()); /// --- ReturnType myFunction(int param1, string param2) { // Implementation }
-
Naming Conventions
- Types:
PascalCase(e.g.,BuildTarget,LanguageHandler) - Functions/Variables:
camelCase(e.g.,buildTarget,parseConfig) - Constants:
PascalCaseorUPPER_SNAKE_CASEfor global constants - Private Members: Prefix with
_(e.g.,_privateField)
- Types:
-
Code Style
// Use 4 spaces for indentation (no tabs) // Opening braces on same line void function() { if (condition) { doSomething(); } } // Use trailing commas in multi-line arrays string[] items = [ "first", "second", "third", ];
- SIMD Operations: Use SIMD utilities in
utils/simd/for performance-critical code - Parallelization: Use
ParallelExecutorfromutils/concurrency/for parallel tasks - Caching: Utilize
BuildCachefor expensive operations - Memory: Minimize allocations in hot paths
- Input Validation: Always validate user input and file paths
- Sandboxing: Use
SafeExecutorfor running external commands - Path Traversal: Use
validatePath()fromutils.security.validation - Temporary Files: Use
TempDirfor secure temporary file handling
/// Test description
unittest {
// Arrange
auto input = createTestInput();
// Act
auto result = functionUnderTest(input);
// Assert
assert(result.isOk());
assert(result.unwrap() == expectedValue);
}- Place unit tests in the same file as the code being tested
- Place integration tests in
tests/integration/ - Use descriptive test names
- Test both success and failure paths
- Include edge cases
# Run tests for a specific module
dub test -- --filter="module_name"
# Run benchmarks
make benchWe use DDoc for API documentation:
/// Summary of the class/function/module
///
/// Detailed description here. Can be multiple paragraphs.
///
/// Params:
/// name = Parameter description
///
/// Returns: Description of return valueGenerate documentation:
make docs # Generate API documentation
make docs-open # Generate and open in browser
make docs-serve # Serve on localhost:8000User-facing documentation goes in docs/user-guides/:
- Clear examples
- Step-by-step instructions
- Common pitfalls and solutions
- Links to related documentation
Technical architecture documentation goes in docs/architecture/:
- System design decisions
- Component interactions
- Performance characteristics
- Security considerations
-
Create a feature branch
git checkout -b feature/my-awesome-feature
-
Make your changes
- Follow coding standards
- Add tests for new functionality
- Update documentation
- Document
@trustedblocks with safety comments
-
Run tests and checks
make test # Run all tests make fmt # Format code make docs # Verify documentation builds
-
Commit with clear messages
git commit -m "feat: Add awesome new feature - Detailed explanation of what changed - Why it changed - Any breaking changes"
Use conventional commit prefixes:
feat:New featurefix:Bug fixdocs:Documentation onlytest:Adding/updating testsrefactor:Code refactoringperf:Performance improvementchore:Maintenance tasks
-
Push and create PR
git push origin feature/my-awesome-feature
In your PR description:
- Describe what changed and why
- Link to related issues
- Include screenshots for UI changes
- List any breaking changes
- Mention if documentation was updated
-
Code Review
- Address feedback promptly
- Keep discussions constructive
- Update your branch with main if needed
-
Merge
- Squash commits if requested
- Ensure CI passes
- Wait for maintainer approval
-
Create language module structure
source/languages/{category}/{language}/ ├── core/ │ ├── handler.d # Main language handler │ └── config.d # Configuration structures ├── builders/ # Build strategies ├── analysis/ # Dependency analysis ├── managers/ # Package managers └── tooling/ # Language-specific tools -
Implement
LanguageHandlerinterfaceclass MyLanguageHandler : LanguageHandler { Result!(BuildOutput, BuildError) build( in Target target, in WorkspaceConfig workspace ) { // Implementation } }
-
Add language detection
- Update
analysis/detection/detector.d - Add file patterns and detection logic
- Update
-
Create example project
- Add example in
examples/{language}-project/ - Include README with setup instructions
- Add Builderfile configuration
- Add example in
-
Write tests
- Unit tests for handler
- Integration tests for builds
- Test various project structures
-
Document
- API documentation with DDoc
- User guide in
docs/user-guides/ - Update main README
When reporting bugs, include:
- Description: Clear description of the issue
- Steps to Reproduce: Minimal steps to reproduce
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment:
- Builder version
- OS and version
- D compiler and version
- Logs: Relevant log output or error messages
- Minimal Example: If possible, a minimal project that reproduces the issue
When requesting features:
- Use Case: Describe your use case
- Proposed Solution: How you envision it working
- Alternatives: Other solutions you've considered
- Additional Context: Any other relevant information
- Documentation: Check
docs/directory - Examples: See
examples/directory - Issues: Search existing issues on GitHub
- Discussions: GitHub Discussions for questions
Contributors are recognized in:
- Release notes
- Contributors section of README
- Annual contributor highlights
By contributing, you agree that your contributions will be licensed under the project's license (see LICENSE file).
Thank you for contributing to Builder! 🎉