asset changes
Some checks failed
CI / build-test-release (push) Failing after 15m11s

This commit is contained in:
Jorijn van der Graaf 2026-05-19 00:50:06 +02:00
commit f442caa888
6 changed files with 224 additions and 11 deletions

View file

@ -396,6 +396,34 @@ Configuration* Crafter::GitProject(const GitProjectSpec& spec) {
return ptr;
}
fs::path Crafter::GitFetch(const GitSource& source) {
std::string name = DeriveName(source);
if (name.empty()) {
throw std::runtime_error(std::format(
"GitFetch: could not derive name from URL '{}'", source.url));
}
fs::path externalRoot = GetCacheDir() / "external";
std::error_code ec;
fs::create_directories(externalRoot, ec);
if (ec) {
throw std::runtime_error(std::format(
"GitFetch: failed to create {}: {}", externalRoot.string(), ec.message()));
}
std::string keyMaterial = std::format("git|{}|{}|{}",
source.url, source.branch, source.commit);
std::size_t key = std::hash<std::string>{}(keyMaterial);
fs::path cloneDir = externalRoot / std::format("{}-{:016x}", name, key);
{
bool exists = fs::exists(cloneDir);
Progress::Task task(std::format("{} {}", exists ? "Updating" : "Cloning", name));
if (std::string err = FetchGit(source, cloneDir); !err.empty()) {
throw std::runtime_error(std::format("GitFetch({}): {}", source.url, err));
}
}
return cloneDir;
}
Configuration* Crafter::LocalProject(const LocalProjectSpec& spec) {
fs::path projectPath = fs::absolute(spec.projectFile).lexically_normal();
if (!fs::exists(projectPath)) {