Skip to content

Commit 8954b47

Browse files
committed
Decouple install codegen handling, add error types for it
1 parent 89d5713 commit 8954b47

File tree

13 files changed

+668
-550
lines changed

13 files changed

+668
-550
lines changed

Cargo.lock

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ keywords = ["gpu", "compiler", "rust-gpu"]
2323
license = "MIT OR Apache-2.0"
2424

2525
[workspace.dependencies]
26-
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3df836eb9d7b01344f52737bf9a310d1fb5a0c26", default-features = false }
26+
spirv-builder = { git = "https://github.com/Rust-GPU/rust-gpu", rev = "3a897aa96c83b7caede692cbf8da7e58d7014ec8", default-features = false }
2727
anyhow = "1.0.98"
2828
thiserror = "2.0.12"
2929
clap = { version = "4.5.41", features = ["derive"] }

crates/cargo-gpu-cache/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ license.workspace = true
1111
rustc_codegen_spirv-cache = { path = "../rustc_codegen_spirv-cache", default-features = false }
1212
cargo_metadata.workspace = true
1313
anyhow.workspace = true
14+
thiserror.workspace = true
1415
spirv-builder.workspace = true
1516
clap = { workspace = true, optional = true }
1617
log.workspace = true
@@ -31,7 +32,7 @@ cargo-util-schemas.workspace = true
3132
# Rebuilds target shader crate upon changes
3233
watch = ["spirv-builder/watch"]
3334
# Enables `clap` support for public structs
34-
clap = ["dep:clap", "spirv-builder/clap"]
35+
clap = ["dep:clap", "spirv-builder/clap", "rustc_codegen_spirv-cache/clap"]
3536

3637
[lints]
3738
workspace = true

crates/cargo-gpu-cache/src/build.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
55
use anyhow::Context as _;
66
use spirv_builder::{CompileResult, ModuleResult, SpirvBuilder};
7-
use std::io::Write as _;
7+
use std::io::{self, Write as _};
88
use std::path::PathBuf;
99

10-
use crate::install::Install;
10+
use crate::user_consent::ask_for_user_consent;
11+
use crate::Install;
12+
1113
use crate::linkage::Linkage;
1214
use crate::lockfile::LockfileMismatchHandler;
1315

@@ -63,7 +65,9 @@ pub struct Build {
6365
impl Build {
6466
/// Entrypoint
6567
pub fn run(&mut self) -> anyhow::Result<()> {
66-
let installed_backend = self.install.run()?;
68+
let skip_consent = self.install.auto_install_rust_toolchain;
69+
let halt_installation = ask_for_user_consent(skip_consent);
70+
let installed_backend = self.install.run(io::stdout(), halt_installation)?;
6771

6872
let _lockfile_mismatch_handler = LockfileMismatchHandler::new(
6973
&self.install.shader_crate,

0 commit comments

Comments
 (0)