Build an existing project
This page shows how to build a project that already has its ecosystem's manifest, such as a Cargo.toml, a go.mod or a CMakeLists.txt, without changing that manifest.
reprobuild reads the manifest for the project's structure and dependencies (Mode 2). You add a project file that names the package and the tools it uses.
Before you start
- Install reprobuild.
- The project follows its ecosystem's standard layout.
- The tools named in the project file below are on your
PATH, or you choose another source for them with--tool-provisioning.
Steps
1. Create the project file
In the directory that holds the manifest, create repro.nim. Name one package, the tools it uses, and the program or library it produces:
import repro_project_dsl
package rust_binary_example:
uses:
"rustc >=1.80 <2.0"
"cargo >=1.80 <2.0"
executable rust_binary_example:
discardimport repro_project_dsl
package goBinaryExample:
uses:
"go >=1.22 <2.0"
executable go_binary_example:
discardimport repro_project_dsl
package c_cpp_cmake_hello_binary_example:
uses:
"gcc >=11"
"cmake >=3.20"
executable hello:
discardThe uses: lines are version ranges. Use the ranges your project supports.
2. Check what reprobuild inferred
Check what reprobuild inferred from the manifest:
repro show-conventions3. Build
Build:
repro build --tool-provisioning=path--tool-provisioning=path uses the tools on your PATH. To let reprobuild provide them instead, choose another source, such as --tool-provisioning=nix.
Check that it worked
Run the build a second time. Nothing has changed, so reprobuild reuses every result and runs no compiler.
<!-- generated:begin capture build-an-existing-project rebuild --> <!-- generated:end -->
If the build does not match your manifest
- Run
repro show-conventionsagain and compare its targets with your manifest. The convention reads only the standard layout. - For a target that fits no convention, add a
build:block to that target inrepro.nim. The rest of the project stays on the convention.