Skip to content

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:
    discard

The 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-conventions

3. 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-conventions again 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 in repro.nim. The rest of the project stays on the convention.