Skip to content

Commit fb64091

Browse files
committed
Move install codegen handling out of CLI
1 parent e30caca commit fb64091

File tree

6 files changed

+14
-11
lines changed

6 files changed

+14
-11
lines changed

Cargo.lock

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

crates/cargo-gpu/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use anyhow::Context as _;
99
use rustc_codegen_spirv_cache::user_output;
1010
use spirv_builder::{CompileResult, ModuleResult, SpirvBuilder};
1111

12-
use crate::{install::Install, linkage::Linkage, lockfile::LockfileMismatchHandler};
12+
use crate::{linkage::Linkage, lockfile::LockfileMismatchHandler, Install};
1313

1414
/// Args for just a build
1515
#[derive(clap::Parser, Debug, Clone, serde::Deserialize, serde::Serialize)]

crates/cargo-gpu/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,18 @@
5050
//! conduct other post-processing, like converting the `spv` files into `wgsl` files,
5151
//! for example.
5252
53-
use crate::dump_usage::dump_full_usage_for_readme;
54-
use build::Build;
55-
use show::Show;
53+
use self::{build::Build, dump_usage::dump_full_usage_for_readme, show::Show};
5654

5755
mod build;
5856
mod config;
5957
mod dump_usage;
60-
mod install;
6158
mod linkage;
6259
mod lockfile;
6360
mod metadata;
6461
mod show;
6562
mod test;
6663

67-
pub use install::*;
64+
pub use rustc_codegen_spirv_cache::backend::*;
6865
pub use spirv_builder;
6966

7067
/// All of the available subcommands for `cargo gpu`

crates/rustc_codegen_spirv-cache/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ keywords.workspace = true
88
license.workspace = true
99

1010
[dependencies]
11+
spirv-builder.workspace = true
1112
legacy_target_specs.workspace = true
1213
thiserror.workspace = true
1314
anyhow.workspace = true
1415
log.workspace = true
1516
directories.workspace = true
1617
cargo_metadata.workspace = true
1718
crossterm.workspace = true
19+
clap.workspace = true
20+
serde.workspace = true
1821

1922
[dev-dependencies]
2023
test-log.workspace = true

crates/cargo-gpu/src/install.rs renamed to crates/rustc_codegen_spirv-cache/src/backend.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
use std::path::{Path, PathBuf};
44

55
use anyhow::Context as _;
6-
use rustc_codegen_spirv_cache::{
6+
use spirv_builder::SpirvBuilder;
7+
8+
use crate::{
79
cache::cache_dir,
810
spirv_source::{
911
get_channel_from_rustc_codegen_spirv_build_script, query_metadata, FindPackage as _,
@@ -12,11 +14,11 @@ use rustc_codegen_spirv_cache::{
1214
target_specs::update_target_specs_files,
1315
toolchain, user_output,
1416
};
15-
use spirv_builder::SpirvBuilder;
1617

1718
/// Represents a functional backend installation, whether it was cached or just installed.
1819
#[derive(Clone, Debug, Default)]
1920
#[non_exhaustive]
21+
#[expect(clippy::module_name_repetitions, reason = "it's fine")]
2022
pub struct InstalledBackend {
2123
/// path to the `rustc_codegen_spirv` dylib
2224
pub rustc_codegen_spirv_location: PathBuf,
@@ -183,9 +185,6 @@ impl Install {
183185
new_path.push("crates/spirv-builder");
184186
format!("path = \"{new_path}\"\nversion = \"{version}\"")
185187
}
186-
// TODO: remove this once this module moves to rustc_codegen_spirv-cache
187-
#[expect(clippy::todo, reason = "temporary allow this")]
188-
_ => todo!(),
189188
};
190189
let cargo_toml = format!(
191190
r#"

crates/rustc_codegen_spirv-cache/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
// TODO: remove this & fix documentation
1515
#![expect(clippy::missing_errors_doc, reason = "temporary allow this")]
1616

17+
pub mod backend;
1718
pub mod cache;
1819
pub mod spirv_source;
1920
pub mod target_specs;

0 commit comments

Comments
 (0)