// SPDX-License-Identifier: LGPL-3.0-only // SPDX-FileCopyrightText: Copyright (C) 2026 Catcrafts® import std; import Crafter.Build; using namespace Crafter; // Loads the same sibling three ways: with its args left at their default, // with nothing forwarded, and with a list of its own. The test reads what // each copy received back out of cfg.dependencies. extern "C" Configuration CrafterBuildProject(std::span args) { Configuration* inherited = LocalProject({ .projectFile = "../lib/project.cpp" }); Configuration* none = LocalProject({ .projectFile = "../lib/project.cpp", .args = {} }); Configuration* replaced = LocalProject({ .projectFile = "../lib/project.cpp", .args = { "--only" } }); Configuration cfg; cfg.path = "./"; cfg.name = "app"; cfg.outputName = "app"; cfg.type = ConfigurationType::Executable; ApplyStandardArgs(cfg, args); cfg.dependencies = { inherited, none, replaced }; // GitProjectSpec takes the same default. Checked on the spec itself, // since a GitProject would need a repository to clone. const GitProjectSpec git{ .source = { .url = "unused" } }; const bool gitDefault = git.args == std::vector(args.begin(), args.end()); cfg.compileFlags.push_back(gitDefault ? "-DGIT_DEFAULT=1" : "-DGIT_DEFAULT=0"); return cfg; }