got rid of --local

This commit is contained in:
Jorijn van der Graaf 2026-05-27 04:36:11 +02:00
commit 54f02b1e17

View file

@ -5,28 +5,14 @@ using namespace Crafter;
extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) { extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> args) {
std::vector<std::string> depArgs(args.begin(), args.end()); std::vector<std::string> depArgs(args.begin(), args.end());
Configuration* math = GitProject({
// Local-mode resolution for the Crafter.Math/Crafter.Asset deps that the .source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git" },
// self-host pass links in (so `cfg.assets` calls CompressAsset → Crafter.Asset .args = depArgs,
// in-process). `--local` points at sibling working trees instead of git; });
// useful during cross-repo development so edits in ../Crafter.Asset are Configuration* asset = GitProject({
// picked up without commit-and-pull. .source = { "https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git" },
bool useLocal = false; .args = depArgs,
for (std::string_view a : args) { });
if (a == "--local") { useLocal = true; break; }
}
auto resolveDep = [&](std::string_view name, std::string_view gitUrl) -> Configuration* {
if (useLocal) {
return LocalProject({
.projectFile = fs::path("../") / name / "project.cpp",
.args = depArgs,
});
}
return GitProject({
.source = { .url = std::string(gitUrl) },
.args = depArgs,
});
};
static auto crafterBuildLib = std::make_unique<Configuration>(); static auto crafterBuildLib = std::make_unique<Configuration>();
crafterBuildLib->path = "./"; crafterBuildLib->path = "./";
@ -39,12 +25,7 @@ extern "C" Configuration CrafterBuildProject(std::span<const std::string_view> a
crafterBuildLib->type = (crafterBuildLib->target == "x86_64-w64-mingw32" || crafterBuildLib->target == "x86_64-pc-windows-msvc") crafterBuildLib->type = (crafterBuildLib->target == "x86_64-w64-mingw32" || crafterBuildLib->target == "x86_64-pc-windows-msvc")
? ConfigurationType::LibraryDynamic ? ConfigurationType::LibraryDynamic
: ConfigurationType::LibraryStatic; : ConfigurationType::LibraryStatic;
// Self-host pass links Crafter.Asset (and its Crafter.Math dep) into the
// crafter-build binary so cfg.assets can call CompressAsset in-process.
// The bootstrap (build.sh) defines no such dep — its impl unit takes the
// stub branch and cfg.assets errors at runtime until a self-host rebuild.
Configuration* math = resolveDep("Crafter.Math", "https://forgejo.catcrafts.net/Catcrafts/Crafter.Math.git");
Configuration* asset = resolveDep("Crafter.Asset", "https://forgejo.catcrafts.net/Catcrafts/Crafter.Asset.git");
crafterBuildLib->dependencies = { math, asset }; crafterBuildLib->dependencies = { math, asset };
crafterBuildLib->defines.push_back({"CRAFTER_BUILD_HAS_ASSET", ""}); crafterBuildLib->defines.push_back({"CRAFTER_BUILD_HAS_ASSET", ""});
{ {