sdist.toml


Overview

The `sdist.toml` file is a configuration file for Rust's package manager, Cargo, specifically designed to control the source distribution (sdist) build process within the project. Its primary purpose is to instruct Cargo to replace the default crates.io online registry with a local, vendored source directory during source package builds.

This setup ensures:

In this project, `sdist.toml` is part of the CI and packaging sub-system that guarantees source distributions are self-contained with all Rust dependencies vendored locally.


File Content Explanation

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
directory = "include/cargo"

Sections


Parameters and Usage

Parameter

Description

`replace-with`

Tells Cargo to use an alternate source instead of the default crates.io registry.

`directory`

Path to the local directory containing the vendored crates to use instead of online sources.

Usage Context


Implementation Details and Important Notes


Interaction with Other Parts of the System


Example Usage Scenario

Assuming you have vendored your dependencies using:

cargo vendor include/cargo

You then ensure `sdist.toml` is present with the content above. When you run:

cargo package --config sdist.toml

Cargo will build a source package using the local vendored crates, without attempting to download anything from crates.io.


Visual Diagram

flowchart TD
    Cargo[Cargo Build Process]
    CratesIO[crates.io Registry]
    VendoredSources[include/cargo (Vendored Crates)]
    SdistToml[sdist.toml Configuration]
    CI[CI Pipeline]
    PackagingScript[Packaging Script]

    CI --> PackagingScript
    PackagingScript --> Cargo
    Cargo -->|Default| CratesIO
    Cargo -->|Configured by sdist.toml| VendoredSources
    SdistToml --> Cargo

**Diagram Explanation:**


Summary

The `sdist.toml` file is a minimal but crucial configuration that enables reproducible, secure, and offline Rust source package builds by instructing Cargo to replace the default crates.io registry with a local vendored crates directory. This configuration is integral to the project's CI and packaging strategy, ensuring that source distributions are self-contained and buildable in isolated environments.