Skip to content

Commit

Permalink
Added rustup stuff into build.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
dkcumming committed Jan 24, 2025
1 parent 23671ee commit 9c3436b
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,9 @@ This package provides a program that will emit a JSON serialisation of the Stabl

## Building

For first-time builds, run: (requries [rustup](https://www.rust-lang.org/tools/install))
NOTE: requries [rustup](https://www.rust-lang.org/tools/install)

```shell
rustup install nightly-2024-11-29;
rustup default nightly-2024-11-29;
rustup component add rustc-dev;
rustup component add llvm-dev;
```
The `build.rs` script will ensure that the correct version of rust and the required components are installed and defaulted.

## Usage

Expand Down
31 changes: 31 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
use std::process::Command;

fn main() {
let status = Command::new("rustup")
.args(&["install", "nightly-2024-11-29"])
.status()
.expect("build.rs failed to install nightly-2024-11-29");

println!("Installed nightly-2024-11-29: {}", status);

let status = Command::new("rustup")
.args(&["default", "nightly-2024-11-29"])
.status()
.expect("build.rs failed to default nightly-2024-11-29");

println!("Defaulted nightly-2024-11-29: {}", status);

let status = Command::new("rustup")
.args(&["component", "add", "rustc-dev"])
.status()
.expect("build.rs failed to install rustc-dev");

println!("Added component rustc-dev: {}", status);

let status = Command::new("rustup")
.args(&["component", "add", "llvm-tools"])
.status()
.expect("build.rs failed to install llvm-tools");

println!("Added component llvm-tools: {}", status);
}

0 comments on commit 9c3436b

Please sign in to comment.