We have yet to devise a contribution process for this repository. Just file a PR for now and we'll work from there.
In VSCode's distribution of rust-analyzer, you can populate the file .vscode/settings.json at the root directory of this project with:
{
"rust-analyzer.linkedProjects": [
"src/cargo/Cargo.toml",
"src/rustc/Cargo.toml",
"src/userland/Cargo.toml",
],
"rust-analyzer.cargo.extraArgs": ["-Z", "bindeps"],
}...to ensure that all projects in this repository can be properly discovered and given IntelliSense.
There are three major components to AuToken:
- The
userlandcrate (calledautoken) people include in their projects to interface with AuToken. - The
rustcwrapper (calledautoken-rustc), which is a modified version ofrustcwhich adds AuToken's analysis phase and configures therustccompiler to always emit the full MIR for every crate it compiles. - The
cargowrapper (calledcargo-autoken), which...- validates the
cargotoolchain version to avoid ABI issues - compiles a version of the Rust standard library using our custom version of
rustcfor use as a sysroot - ...and re-executes the appropriate
cargocommand withrustcoverwritten to point to our custom wrapper and with the appropriate sysroot specified.
- validates the
The cargo-autoken binary automatically builds its own version of autoken-rustc so you can execute the entire stack by calling cargo run in the src/cargo directory. This tool can be installed onto your local computer with cargo install --path src/cargo -Z bindeps—no questions asked! The rust-toolchain.toml should handle all the nightly shenanigans for you.
The easiest way to execute autoken-rustc directly is through cargo-autoken's rustc subcommand.
Alternatively, you could build the custom rustc driver manually. If you want to call it directly without the help of cargo, you have to build it with an appropriate rpath:
RUSTFLAGS="-C link-args=-Wl,-rpath,$(rustc --print sysroot)/lib" cargo build --releaseOtherwise, you can build it with:
cargo build --release...but then the wrapper must be called by a version of cargo which corresponds to the rustc toolchain with which the binary was built since, otherwise, you could get a dynamic library mismatch.
Then, just run cargo on the desired project with the appropriate custom rustc driver and separate target directory:
RUSTC="path/to/autoken_rustc_wrapper" CARGO_TARGET_DIR="target/autoken" cargo +toolchain run -Zbuild-std=core,alloc,std --target $(path/to/autoken_rustc_wrapper -vV | sed -n 's|host: ||p')
Interface updates:
- Bump
autoken-rustc's version if need be. - Bump the peer version requirement in
cargo-autoken. - Bump
autoken's version if need be. - Bump
INTERFACE_VERSION.inin bothsrc/userlandandsrc/cargoif need be.
Documentation updates:
- If the toolchain changed, update the toolchain in the
autokencrate documentation. - If the version of
cargo-autokenchanged, update the toolchain in theautokencrate documentation. - Regenerate the repository README from the
autoken's crate documentation if need be usingcargo rdme. - Copy that regenerated README from the repository root to
src/userland/README.mdif need be.
Updating repository information:
- If this repository URL is changed, it needs to be changed in:
- All the
Cargo.tomlmetadata files. - The rustc driver's ICE issue config.
- Cargo's version checking constants.
- All the
- If the project tag-line changes, it needs to be updated in all the
Cargo.tomlmetadata files.
Publishing:
- Publish everything that changed in the following order:
-
autoken-rustc -
cargo-autoken -
autoken
-