refactor: build from conventions, adopt ConsoleLogger, and colorize TTY output
This commit is contained in:
1 parent
ea6ac852e7
commit
83ec08390f
23 files changed
+172
-151
No files matched your search
+11
-7
@@ -202,7 +202,11 @@ materialize_binary_variant(const BinaryCompatibilityKey &key,
|
||||
Void::Result::Result<MaterializedSource, Void::Result::Error>
|
||||
materialize_dependency_source(const DependencyRecord &dep, const FetchOptions &options) {
|
||||
std::error_code ec;
|
||||
std::filesystem::create_directories(options.cache_dir, ec);
|
||||
// Cache paths are made absolute so materialized sources stay valid regardless of the
|
||||
// provider's/consumer's working directory.
|
||||
const std::filesystem::path cache_dir =
|
||||
std::filesystem::absolute(options.cache_dir, ec).lexically_normal();
|
||||
std::filesystem::create_directories(cache_dir, ec);
|
||||
|
||||
// 1. Local path source: compute content hash without mutating the external checkout.
|
||||
if (dep.source_kind == DependencySourceKind::Path) {
|
||||
@@ -217,7 +221,7 @@ materialize_dependency_source(const DependencyRecord &dep, const FetchOptions &o
|
||||
}
|
||||
Snapshot::SnapshotOptions sopts;
|
||||
sopts.project_root = canon;
|
||||
sopts.snapshot_store_dir = options.cache_dir / "path-snapshots";
|
||||
sopts.snapshot_store_dir = cache_dir / "path-snapshots";
|
||||
sopts.materialize = false;
|
||||
// Generated editor metadata is never a build input and may be an out-of-tree symlink.
|
||||
sopts.excluded_names.push_back("compile_commands.json");
|
||||
@@ -235,9 +239,9 @@ materialize_dependency_source(const DependencyRecord &dep, const FetchOptions &o
|
||||
|
||||
// 2. Checksummed archive source (local file:// or verified cached tar).
|
||||
if (dep.source_kind == DependencySourceKind::Archive) {
|
||||
const auto extract_dir = options.cache_dir / "archives" / dep.sha256;
|
||||
const auto extract_dir = cache_dir / "archives" / dep.sha256;
|
||||
const auto marker = extract_dir / ".vbs_verified";
|
||||
const auto lock_path = options.cache_dir / "locks" / (dep.sha256 + ".lock");
|
||||
const auto lock_path = cache_dir / "locks" / (dep.sha256 + ".lock");
|
||||
auto lock = Platform::FileLock::acquire(lock_path, Platform::LockMode::Exclusive);
|
||||
if (!lock) {
|
||||
return std::unexpected{lock.error()};
|
||||
@@ -252,7 +256,7 @@ materialize_dependency_source(const DependencyRecord &dep, const FetchOptions &o
|
||||
return out;
|
||||
}
|
||||
|
||||
const auto downloaded_tar = options.cache_dir / "downloads" / (dep.sha256 + ".tar");
|
||||
const auto downloaded_tar = cache_dir / "downloads" / (dep.sha256 + ".tar");
|
||||
std::filesystem::create_directories(downloaded_tar.parent_path(), ec);
|
||||
|
||||
if (!std::filesystem::is_regular_file(downloaded_tar, ec)) {
|
||||
@@ -348,9 +352,9 @@ materialize_dependency_source(const DependencyRecord &dep, const FetchOptions &o
|
||||
}
|
||||
|
||||
const auto git_dir =
|
||||
options.cache_dir / "git" / (sanitize_key(dep.name) + "_" + dep.revision);
|
||||
cache_dir / "git" / (sanitize_key(dep.name) + "_" + dep.revision);
|
||||
const auto marker = git_dir / ".vbs_verified_rev";
|
||||
const auto lock_path = options.cache_dir / "locks" / ("git_" + dep.revision + ".lock");
|
||||
const auto lock_path = cache_dir / "locks" / ("git_" + dep.revision + ".lock");
|
||||
auto lock = Platform::FileLock::acquire(lock_path, Platform::LockMode::Exclusive);
|
||||
if (!lock) {
|
||||
return std::unexpected{lock.error()};
|
||||
|
||||
Reference in new issue
Block a user