- `dcr gen` command for IDE integration and build tool support
    - `dcr gen project-info`: Output project metadata as JSON
    - `dcr gen compile-commands`: Generate `compile_commands.json` for clangd and clang-tidy
    - `dcr gen vscode`: Generate VS Code `.vscode/` integration (launch.json, tasks.json, settings.json)
    - `dcr gen clion`: Generate JetBrains CLion `.idea/` integration (run configurations, build targets)
- Full workspace support for all `gen` subcommands
This commit is contained in:
2026-03-19 00:02:04 +08:00
parent 0e93a1aa0f
commit 5f0dca4bb3
28 changed files with 1416 additions and 200 deletions

View File

@@ -12,8 +12,9 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
} else {
ctx.compiler
};
if ctx.language.to_lowercase() == "asm" {
return Err("MSVC backend does not support build.language = \"asm\"".to_string());
let lang = ctx.language.to_lowercase();
if lang.contains("asm") {
return Err("MSVC backend does not support build.language with asm".to_string());
}
let start_time = Instant::now();
let sources = collect_sources(ctx)?;
@@ -109,16 +110,29 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
pub(crate) fn collect_sources(ctx: &BuildContext) -> Result<Vec<String>, String> {
let extensions = source_extensions(ctx.language);
common::collect_sources(&extensions, ctx.exclude_dirs)
common::collect_sources(
ctx.source_roots,
&extensions,
ctx.exclude_dirs,
ctx.include_paths,
)
}
fn source_extensions(language: &str) -> Vec<&str> {
let lang = language.to_lowercase();
match lang.as_str() {
"c" => vec!["c"],
"c++" | "cpp" | "cxx" => vec!["cpp", "cxx", "cc"],
_ => vec!["c"],
let mut out = Vec::new();
for part in language.split('+') {
let lang = part.trim().to_lowercase();
match lang.as_str() {
"c" => out.extend(["c"]),
"c++" | "cpp" | "cxx" => out.extend(["cpp", "cxx", "cc"]),
"asm" => {}
_ => {}
}
}
if out.is_empty() {
out.extend(["c"]);
}
out
}
fn msvc_standard_flag(language: &str, standard: &str) -> Result<String, String> {