Getting Started
Contributions to NativeLink or its dependencies should be made in the form of GitHub pull requests. Each pull request will be reviewed by a core contributor (someone with permission to land patches) and either landed in the main tree or given feedback for changes that would be required. If you wish to work on an issue, please claim it first by commenting on the GitHub issue. This prevents duplicated efforts from contributors on the same issue.Git Setup
NativeLink has a specific contribution process to ensure consistent quality across all commits.Initial Configuration
- In your GitHub settings, set up distinct authentication and signing keys:
-
Fork the
TraceMachina/nativelinkrepository by clicking theForkbutton. -
Clone your fork:
-
Navigate to the cloned repository:
-
Add
TraceMachina/nativelinkas a remote repository: -
Configure git to sign your commits. Create a
.gitconfigfile in your home directory:
Development Environment
NativeLink ships its tooling in a Nix flake configured viaflake.nix in the repository root. While you can work on some parts without this environment, it helps reproduce CI locally.
Setup Steps
- Install Nix with flakes using the experimental nix installer. See the Flakes wiki for more information.
-
Optionally install
direnv(highly recommended):Withoutdirenv, you’ll need to manually runnix developeach time you enter the repository or switch branches. -
Install a C++ toolchain:
Pull Request Process
NativeLink doesn’t allow direct commits to the main repository. All contributions, including those from core contributors, must go through pull requests.Creating a Pull Request
-
Ensure your fork is up-to-date:
-
Create a new branch:
-
Make your changes and create a commit following these guidelines:
- Use a capital letter to start the commit title
- Use imperative tone (“Add feature” not “Adds feature”)
- Don’t end the title with a period
- Keep the first line as short as possible
- Add details in the commit body if needed
- Limit commit body lines to 72 characters
- If you need “and” in the title, consider splitting the commit
-
Push your commit:
- Go to GitHub pulls and click the button to create a new pull request.
-
Click the purple
Reviewablebutton on your pull request page to add reviewers with+@somereviewer. -
If you need to make changes, use
git commit --amendandgit push -fto update the commit in-place. Changes between versions remain visible in Reviewable.
Using Git Rebase
When working on a feature, your branch may become outdated. To update it:Development Workflows
Rust Formatting
Ifbazel test reports formatting errors, run:
Pre-commit Hooks
Ensure you’re in the Nix development environment, then run:git add to stage them manually.
Setting Up rust-analyzer
rust-analyzer works out of the box, but for Bazel integration, generate a project configuration:rust-project.json file. Regenerate it when adding new files or dependencies.
For VS Code, configure tasks.json to auto-generate this file on folder open:
.vscode/settings.json:
Documentation
Generating Documentation
View documentation fornativelink-* crates:
Writing Documentation
NativeLink follows the Microsoft Style Guide. The project uses Vale for documentation style enforcement. Pre-commit hooks forbid errors but permit warnings. To view all suggestions:Code Coverage
Generate branch-based coverage reports:result symlink contains a webpage with the visualized report.