- Workspace support (`[workspace]` with deps ordering)
- `clean --all` for workspace members
Changed:
- Project root discovery for `build/run/clean` (searches parent dirs)
- Workspace paths are excluded from root source scan
- Build output now uses a Cargo-style `Compiling <name> v<version>` line
- Build time now reports total time for the whole build stage (workspace included)
- Cache hits are silent (no compile line when nothing is rebuilt)
- Safer build cache: fingerprints include headers and resolved library files
This commit is contained in:
2026-03-06 21:58:54 +08:00
parent 617ba85442
commit 4ea6267a88
26 changed files with 1123 additions and 213 deletions

View File

@@ -15,6 +15,7 @@ pub struct BuildContext<'a> {
pub platform: Option<&'a str>,
pub linker: Option<&'a str>,
pub archiver: Option<&'a str>,
pub exclude_dirs: &'a [std::path::PathBuf],
pub include_dirs: &'a [String],
pub lib_dirs: &'a [String],
pub libs: &'a [String],
@@ -44,3 +45,26 @@ pub fn build(ctx: &BuildContext) -> Result<f64, String> {
}
clang::build(ctx)
}
pub fn collect_sources(ctx: &BuildContext) -> Result<Vec<String>, String> {
let compiler = ctx.compiler.to_lowercase();
if compiler.contains("clang-cl") {
return msvc::collect_sources(ctx.language, ctx.exclude_dirs);
}
if compiler == "as" || compiler.contains("gas") {
return gas::collect_sources(ctx.language, ctx.exclude_dirs);
}
if compiler.contains("nasm") {
return nasm::collect_sources(ctx.language, ctx.exclude_dirs);
}
if compiler.contains("gcc") || compiler.contains("g++") {
return gcc::collect_sources(ctx.language, ctx.exclude_dirs);
}
if compiler.contains("clang") || compiler.contains("clang++") {
return clang::collect_sources(ctx.language, ctx.exclude_dirs);
}
if compiler == "cl" || compiler.contains("msvc") {
return msvc::collect_sources(ctx.language, ctx.exclude_dirs);
}
clang::collect_sources(ctx.language, ctx.exclude_dirs)
}