feat: let a project file return several configurations

A project.cpp described one configuration: CrafterBuildProject returns a
Configuration by value, and anything else the project wanted built had
to be among that one's dependencies. There it was built as part of that
configuration's graph: under the check that a graph builds each module
once, with its libraries handed up to whatever links that configuration,
and with its tests and scripts out of reach of `test` and `run`. Jorijn
asked for a project.cpp that can return several unrelated configurations
which all get built, and suggested a separate entry point, so that no
existing project file breaks.

A project file now defines one of two functions. CrafterBuildProject is
as it was. CrafterBuildConfigurations returns
std::vector<Configuration*>: pointers to configurations the file keeps
alive itself, or that GitProject and LocalProject gave it. The two have
different names because the loader finds the entry point by its C
symbol, which carries no return type, so one name with two return types
would be called as whichever the loader guessed. They are pointers
because a project file takes pointers between its configurations, for
`dependencies` and for a test's, before it returns them, and a vector of
values would move them.

LoadConfigurations loads a project file with either entry point and
returns the list. A CrafterBuildProject's Configuration comes back as a
list of one, constructed by the call where the loader keeps it for the
rest of the process; LoadProjectFromRoot, which did that for a
sibling's, leaves it to LoadConfigurations, and the project cache holds
the lists without owning a Configuration. The Configuration of the
project crafter-build is pointed at is kept that long as well, where it
was a local of Run(). LoadConfigurations throws for a file that defines
both functions or neither, and for a CrafterBuildConfigurations that
returns nothing, a null pointer or one configuration twice. It also
throws for one that returns a configuration a project loaded through
GitProject or LocalProject keeps to itself, which the loader now takes
down when it loads that project's file: what the configurations the file
returned led to through `dependencies` or through their tests, as far as
the first configuration on each way that a loaded project's file had
returned or another loaded project keeps. Returned from here, such a
configuration would count as this file's own to `test` and `run`, and
only the configurations a project file returns are rebased onto its
directory. LoadProject stays, for a caller that wants a
CrafterBuildProject's Configuration by value, and throws for a file with
the other entry point.

GitProject and LocalProject keep, per spec and args, the list a
sibling's file returned, and return the first one unless the spec's new
`configuration` names another by Configuration::name. Every
configuration of the list is rebased onto the sibling's directory,
except one that another project's file had returned before, which was
rebased onto that project's. Specs that differ only in the name they
pick share one load. A name the sibling does not have throws, listing
the names it has, and a name two of its configurations share throws
too. A `#pragma crafter dependency` gets the first.

BuildAll builds the returned configurations in one pass. Each is built
by Build(), as a project's one configuration is, the first on the
calling thread and each other one on a thread of its own, and its result
then goes into the record of the pass under its PcmDir, where Build()
looks for a dependency. One that another of them is built on is built
before that other starts, which then finds it in the record: started
beside it, the other would not find it there yet and would build it a
second time. A configuration is not put into the record before it is
built, because a dependency of its own that is built into the same
directory would be handed its unfinished build and wait for it, while it
waits for the dependency. All of them are built to the end, and the
errors come back in the order given, each message once; an exception a
build throws comes back as an error that names the configuration, where
Run() printed the exception's own text for a project's one
configuration. Refused before anything is built: two that would be built
into one directory, which would be two builds writing the same files at
once; several that are each built on something of another's directory,
so that none could be built first; and one that is built on something of
its own directory when another is built on that directory as well, since
the record holds one result for a directory and the other could be given
either.

One shortcut is in it. A wasm executable that declares wasmVariants
builds what it is built on once more per variant, and says which
variant by rewriting those configurations in place, at the end of its
Build(). A library that two returned configurations share would change
under the one still building its baseline, so with such an executable
anywhere in the graph BuildAll builds the configurations one after the
other, on the calling thread. Keeping them side by side takes a variant
driver that does not rewrite configurations other builds read, which
this commit does not attempt.

Run() works on the list. A build builds all of it. `test` runs the
tests, and `run` offers the scripts, of the ones in it that the project
file made itself. One that another project's file returned to GitProject
or LocalProject, and that this file returns in turn, is built with the
rest, but its tests and scripts stay that project's, so `run` still
reaches only the scripts of the project crafter-build was pointed at.
What the list itself rules out Run() refuses once the project file has
loaded, before any of the list is built and before AGENTS.md is written:
for a build, `-r`, `install` and `bundle` whatever BuildAll refuses a
list for, and for `test`, which builds its tests with Build() and never
comes to BuildAll, two returned configurations of one directory.
BuildAll makes its refusals again for whoever calls it. A script is
handed the configuration it is declared on. `lint` and `format` walk
from every returned configuration and keep, as before, the
configurations in the project's directory: the returned ones first, in
the order the file returned them, then what they depend on, so that of
two returned ones that register a rule under one name the earlier one's
runs. `-r` runs the executable when exactly one of them is one, and
`install` and `bundle` export the one that is packaged as a Flatpak;
with more than one candidate each refuses and names them, `-r` once
everything is built and `install` and `bundle` before anything is.
AGENTS.md takes the notes that the dependencyNotes of each returned
configuration the file made itself selects among what that one is built
against, and the file's pragma tooling and a returned configuration of
another project go by the widest of those settings. There, a
configuration is another project's when GitProject or LocalProject
loaded it from another project file than the one whose AGENTS.md is
written, two files being one when they resolve to one path, so
UpdateAgentsMd still reads the setting of a Configuration one of the two
returned when it is given that Configuration's own project file.

For that, RunTests, RunLint, RunScript and UpdateAgentsMd each gained an
overload that takes the list, and the one that takes a single
Configuration calls it with a list of one. SetParentProject gained one
too, and ParentLib searches the graph of every configuration it was
given. BuildAll, RunTests and RunScript count a configuration the list
names twice once.

The tests of several configurations share what one configuration's had
to itself: AddTest names a test's sources, tests/<name>, and its build
directory after the test and its compile state, not after the
configuration that declares it. Two configurations that each declare a
test of one name, compiled alike, would have RunTests build both in that
one directory, each with the dependencies of its own declaration.
RunTests fails both without building either, and each failure names the
configurations. It compares tests of different configurations only, so
a project of one configuration is treated as it was.

The --help text names the second entry point, says what -r, install and
bundle do with several configurations, and speaks of the project file's
entry point as what gets the project args, where it named
CrafterBuildProject. AGENTS.template.md says that a project.cpp returns
one configuration or several, that Run() works on the list and what a
new verb has to decide about it, which configurations have their path
rebased, and that the scripts of a returned configuration of another
project cannot be run. Two of its notes named LoadProject as what loads
a project.cpp for crafter-build, which Run(), GitProject and
LocalProject no longer call, and speak of the load now. Its rule for the
link flags of a test that loads a project file names the ways a test
loads one, where it named LoadProject, and its entry for `:Script`
speaks of the `scripts` of the configurations the driver is given, where
it named `cfg.scripts`. Its entry for `:Platform` names
LoadConfigurations beside LoadProject. That entry also said that
`:Platform` holds all OS-specific code, which it did not before this
range either, :Agents, :Progress, :Lint and :Clang including POSIX
headers of their own, and no longer says so. The bug-prover lens's
section names BuildAll's threads and LoadConfigurations.

Not in this commit: a way to say which executable -r runs or which app
install and bundle export when there are several, and a keyword that
lets a `#pragma crafter dependency` name a configuration.
This commit is contained in:
Jorijn van der Graaf 2026-11-15 02:16:06 +01:00
commit 4283a3ecd2
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
16 changed files with 986 additions and 241 deletions

View file

@ -479,6 +479,21 @@ CompileCommand Crafter::GetCompileCommand(const Configuration& config) {
}
namespace {
// Two of `configurations` that would be built into one directory, as
// the error that names them; empty when no two would. Built side by
// side they are two builds writing the same files, and a pass that has
// built one of them hands it to whatever is built on the other.
std::string SameDirectoryError(std::span<Configuration* const> configurations) {
std::unordered_map<fs::path, const Configuration*> builtInto;
for (const Configuration* cfg : configurations) {
const auto [known, added] = builtInto.try_emplace(fs::absolute(cfg->PcmDir()).lexically_normal(), cfg);
if (!added && known->second != cfg) {
return std::format("two configurations named {} would both be built into {}: give each a name of its own", cfg->name, known->first.string());
}
}
return "";
}
// The outcome of `work` for `key` in this build pass. The first caller
// runs it; every other caller, whether at the same time or later, waits
// for that run and gets its result or its exception. The keys are the
@ -1667,6 +1682,175 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
return buildResult;
}
namespace {
// How BuildAll builds the configurations of a list, or why it does not:
// worked out from the list alone, before anything of it is built.
struct BuildPlan {
// Each of them once, however often the list names it.
std::vector<Configuration*> roots;
// For each of `roots`, the others it is built after, by their places
// in `roots`.
std::vector<std::vector<std::size_t>> waitsFor;
// The places in `roots`, each after the ones it waits for.
std::vector<std::size_t> order;
// Whether a wasm executable that declares variants is among them or
// among what they are built on, so that they are built one after the
// other.
bool rewrites = false;
// Why the list is not built, as BuildAll returns it; empty when it
// is.
std::string refused;
};
BuildPlan PlanBuild(std::span<Configuration* const> configurations) {
BuildPlan plan;
for (Configuration* cfg : configurations) {
if (!std::ranges::contains(plan.roots, cfg)) plan.roots.push_back(cfg);
}
const std::span<Configuration* const> roots = plan.roots;
const std::size_t count = roots.size();
const auto directory = [](const Configuration& cfg) { return fs::absolute(cfg.PcmDir()).lexically_normal(); };
// The directory each of them is built into, and the directories of
// everything it is built on. A wasm executable that declares
// variants builds everything it is built on once more for each of
// them, and says which variant by rewriting those configurations in
// place (the end of Build()). A library that two of these share
// would change under whichever is still building its baseline, so
// with such a configuration anywhere among them they are built one
// after the other.
std::vector<fs::path> builtInto(count);
std::vector<std::unordered_set<fs::path>> builtOn(count);
for (std::size_t index = 0; index < count; ++index) {
builtInto[index] = directory(*roots[index]);
std::unordered_set<const Configuration*> seen = { roots[index] };
std::vector<const Configuration*> pending = { roots[index] };
while (!pending.empty()) {
const Configuration& cfg = *pending.back();
pending.pop_back();
if (cfg.type == ConfigurationType::Executable && cfg.target.starts_with("wasm32") && !cfg.wasmVariants.empty()) plan.rewrites = true;
for (const Configuration* dep : cfg.dependencies) {
if (!seen.insert(dep).second) continue;
builtOn[index].insert(directory(*dep));
pending.push_back(dep);
}
}
}
plan.refused = SameDirectoryError(roots);
if (!plan.refused.empty()) return plan;
// One that another is built on, which is to say that something the
// other is built on is built into its directory, is built before
// the other starts: the other then finds it built, in the record of
// the pass, instead of building it a second time beside this build
// of it.
plan.waitsFor.resize(count);
for (std::size_t index = 0; index < count; ++index) {
for (std::size_t other = 0; other < count; ++other) {
if (other != index && builtOn[index].contains(builtInto[other])) plan.waitsFor[index].push_back(other);
}
}
// One that is itself built on something of its own directory makes
// two builds for that directory, its dependency's and its own, and
// the record of the pass holds one result for a directory: another
// of them that looks there for what it is built on would be given
// one of the two, whichever it had asked for. By itself, or with no
// other of them built on that directory, it builds as it does for
// Build().
for (std::size_t index = 0; index < count; ++index) {
if (!builtOn[index].contains(builtInto[index])) continue;
for (std::size_t other = 0; other < count; ++other) {
if (other == index || !builtOn[other].contains(builtInto[index])) continue;
plan.refused = std::format("{} and a configuration it is built on would both be built into {}, where {} looks for what it is built on: give each a name of its own", roots[index]->name, builtInto[index].string(), roots[other]->name);
return plan;
}
}
std::vector<bool> ordered(count, false);
for (bool placed = true; placed;) {
placed = false;
for (std::size_t index = 0; index < count; ++index) {
if (ordered[index] || !std::ranges::all_of(plan.waitsFor[index], [&](std::size_t other) { return ordered[other]; })) continue;
ordered[index] = true;
plan.order.push_back(index);
placed = true;
}
}
if (plan.order.size() != count) {
std::string names;
for (std::size_t index = 0; index < count; ++index) {
if (ordered[index]) continue;
if (!names.empty()) names += ", ";
names += roots[index]->name;
}
plan.refused = std::format("{}: each of these is built on something that would be built into the directory of another of them, so none of them can be built first", names);
}
return plan;
}
}
std::string Crafter::BuildAll(std::span<Configuration* const> configurations, std::unordered_map<fs::path, std::shared_future<BuildResult>>& depResults, std::mutex& depMutex) {
const BuildPlan plan = PlanBuild(configurations);
if (!plan.refused.empty()) return plan.refused;
const std::size_t count = plan.roots.size();
std::vector<std::string> errors(count);
const auto build = [&](std::size_t index) {
Configuration& cfg = *plan.roots[index];
// By Build() itself, as a project's one configuration always was,
// and only then put into the record of the pass, where a
// configuration that depends on this one looks for it, with what
// the build returned or threw. Recorded while it is still being
// built, it would be handed to a dependency of its own that is
// built into the same directory, which would wait for the build
// that is waiting for it. Such a dependency has left its own result
// under that directory by now, and this one's takes its place: no
// other of them is built on that directory, or the set was refused.
std::promise<BuildResult> built;
try {
BuildResult result = Build(cfg, depResults, depMutex);
errors[index] = result.result;
built.set_value(std::move(result));
} catch (const std::exception& e) {
errors[index] = std::format("build of {} threw: {}", cfg.name, e.what());
built.set_exception(std::current_exception());
} catch (...) {
errors[index] = std::format("build of {} threw something that is not a std::exception", cfg.name);
built.set_exception(std::current_exception());
}
const std::lock_guard lock(depMutex);
depResults.insert_or_assign(cfg.PcmDir(), built.get_future().share());
};
if (plan.rewrites) {
for (const std::size_t index : plan.order) build(index);
} else {
std::vector<std::promise<void>> finishes(count);
std::vector<std::shared_future<void>> finished;
finished.reserve(count);
for (std::promise<void>& finish : finishes) finished.push_back(finish.get_future().share());
const auto buildInTurn = [&](std::size_t index) {
for (const std::size_t other : plan.waitsFor[index]) finished[other].wait();
build(index);
finishes[index].set_value();
};
// The first on this thread, so a project of one configuration is
// built where it always was.
std::vector<std::jthread> others;
others.reserve(count);
for (std::size_t index = 1; index < count; ++index) others.emplace_back(buildInTurn, index);
if (count > 0) buildInTurn(0);
}
std::string failed;
for (auto error = errors.begin(); error != errors.end(); ++error) {
if (error->empty() || std::ranges::contains(errors.begin(), error, *error)) continue;
if (!failed.empty()) failed += '\n';
failed += *error;
}
return failed;
}
namespace {
FlatpakExport ExportOf(const Configuration& config) {
FlatpakExport app;
@ -1700,6 +1884,41 @@ namespace {
return "";
}
// The names of `configurations`, as a message lists them.
std::string NamesOf(std::span<const Configuration* const> configurations) {
std::string names;
for (const Configuration* cfg : configurations) {
if (!names.empty()) names += ", ";
names += cfg->name;
}
return names;
}
// What install or bundle exports of the configurations a project file
// returns: the only one, or of several the one packaged as a Flatpak.
struct ExportChoice {
// Null when none of several is packaged, or more than one is.
const Configuration* config = nullptr;
// Why `config` cannot be exported, or why there is none; empty when
// it can be.
std::string refused;
};
ExportChoice ChooseExport(std::span<Configuration* const> configurations, std::string_view verb) {
std::vector<const Configuration*> packaged;
for (const Configuration* cfg : configurations) {
if (cfg->ResolvedPackaging() == Packaging::Flatpak) packaged.push_back(cfg);
}
if (packaged.size() > 1) {
return { nullptr, std::format("crafter-build {0}: {1} are each packaged as a Flatpak, and {0} exports one app", verb, NamesOf(packaged)) };
}
if (packaged.empty() && configurations.size() > 1) {
return { nullptr, std::format("crafter-build {0}: none of {1} is packaged as a Flatpak; set cfg.packaging = Packaging::Flatpak in project.cpp on the one to {0}", verb, NamesOf(configurations)) };
}
const Configuration* const config = packaged.empty() ? configurations.front() : packaged.front();
return { config, ExportRefusal(*config, verb) };
}
// A repo's path as the file:// URL of a remote: percent-encoded, since
// `remote-modify --url=` stores what it is given as it is.
std::string FileUrl(const fs::path& path) {
@ -2151,7 +2370,9 @@ R"(Usage:
Loads ./project.cpp (override with --project=<path>), compiles it to a shared
object, and invokes its CrafterBuildProject() to obtain a Configuration that
drives the build. Outputs land at bin/<name>-<target>-<march>/, intermediates
at build/<name>-<target>-<march>/.
at build/<name>-<target>-<march>/. A project of several configurations
defines CrafterBuildConfigurations() instead, which returns them all and gets
the same args, and every one of them is built.
A build runs at most as many of its steps at once as the machine has hardware
threads: the compiles of its sources, its shaders and assets, and its links
@ -2165,7 +2386,8 @@ Build options:
one for the host in its own directory, a wasm32 one
under wasmtime or wasmer, or one built for the
browser served over HTTP from its directory.
Libraries cannot be run.
Libraries cannot be run, and of several
configurations one has to be the only executable.
-v, --verbose Verbose progress output.
-q, --quiet Suppress progress output.
--project=<path> Path to the project file (default: ./project.cpp).
@ -2244,7 +2466,9 @@ Install and bundle (after the `install` or `bundle` subcommand):
run the host's flatpak, inside crafter-build's Flatpak through
flatpak-spawn --host, and refuse a project whose bin/ and build/ the host
does not see where crafter-build does, as in the sandbox's own /tmp, /var,
/usr, /etc and /app, which they ask the host before building.
/usr, /etc and /app, which they ask the host before building. Of several
configurations they export the one that is packaged as a Flatpak, and
refuse before building when none is, or more than one.
Clean (after the `clean` subcommand):
Removes bin/ and build/ next to the project file. Does not load project.cpp,
@ -2263,14 +2487,14 @@ AGENTS.md:
Direct, or None.
Project args:
Any flag not consumed above is forwarded verbatim to CrafterBuildProject as
part of its `args` span. Project-specific flags (e.g. --target=, custom
feature toggles) live there. ApplyStandardArgs reads --debug, --target=,
--march=, --mtune=, --cuda-arch=, --sysroot=, --lib, --shared and
--packaging=none|flatpak, the last for the project crafter-build was pointed
at only. Flags it does not itself interpret are folded into the variant
hash, so switching one lands in its own bin/ and build/ directory instead of
overwriting the other setting's.
Any flag not consumed above is forwarded verbatim to the project file's
entry point as part of its `args` span. Project-specific flags (e.g.
--target=, custom feature toggles) live there. ApplyStandardArgs reads
--debug, --target=, --march=, --mtune=, --cuda-arch=, --sysroot=, --lib,
--shared and --packaging=none|flatpak, the last for the project
crafter-build was pointed at only. Flags it does not itself interpret are
folded into the variant hash, so switching one lands in its own bin/ and
build/ directory instead of overwriting the other setting's.
Environment:
CRAFTER_BUILD_MARCH Override -march (default: native).
@ -2436,7 +2660,7 @@ std::int32_t Crafter::Run(std::int32_t argc, char** argv) {
return 1;
}
// Ahead of LoadProject on purpose — see CleanProject.
// Ahead of the load on purpose — see CleanProject.
if (verb == Verb::Clean) {
std::vector<fs::path> removed = CleanProject(projectFile);
if (removed.empty()) {
@ -2447,19 +2671,31 @@ std::int32_t Crafter::Run(std::int32_t argc, char** argv) {
return 0;
}
Configuration config = LoadProject(projectFile, projectArgs);
SetParentProject(&config);
// What the project file describes: one configuration, or several
// that are all built.
const std::vector<Configuration*> configurations = LoadConfigurations(projectFile, projectArgs);
// The ones the file made itself: every one but those that another
// project's file returned to GitProject or LocalProject. One of
// those, returned here in turn, is built with the rest, and -r,
// install and bundle count it among them, but its tests and its
// scripts stay that project's: `run` still reaches no script but
// those of the project crafter-build was pointed at.
std::vector<Configuration*> own;
for (Configuration* cfg : configurations) {
if (!LoadedProjectOf(*cfg)) own.push_back(cfg);
}
SetParentProject(configurations);
if (verb == Verb::Run) {
scriptOpts.projectFile = fs::absolute(projectFile).lexically_normal();
return RunScript(config, scriptOpts);
return RunScript(own, scriptOpts);
}
if (verb == Verb::Lint || verb == Verb::Format) {
// lexically_normal: fs::absolute keeps a "./" component, which
// would leak into displayed paths and the project-root derivation.
lintOpts.projectFile = fs::absolute(projectFile).lexically_normal();
LintSummary lintSummary = RunLint(config, lintOpts);
LintSummary lintSummary = RunLint(configurations, lintOpts);
if (verb == Verb::Lint) return lintSummary.Clean() ? 0 : 1;
if (lintSummary.noRulesDefined || lintSummary.errors > 0) return 1;
// Apply: formatting files is success (gofmt convention).
@ -2469,51 +2705,76 @@ std::int32_t Crafter::Run(std::int32_t argc, char** argv) {
// What install and bundle cannot export they refuse here, before
// anything is built: a project that is not packaged as a Flatpak, or
// a host flatpak out of reach, is known from the loaded project.
// a host flatpak out of reach, is known from the loaded project, and
// so is which of several configurations is the app.
ExportChoice exported;
if (verb == Verb::Install || verb == Verb::Bundle) {
if (const std::string refused = ExportRefusal(config, verb == Verb::Install ? "install" : "bundle"); !refused.empty()) {
std::println(std::cerr, "{}", refused);
exported = ChooseExport(configurations, verb == Verb::Install ? "install" : "bundle");
if (!exported.refused.empty()) {
std::println(std::cerr, "{}", exported.refused);
return 1;
}
}
// What the list itself rules out is refused here too, before any of
// it is built and before AGENTS.md is written: two returned
// configurations of one directory for every verb that builds, and
// for the verbs that build the configurations themselves whatever
// else BuildAll refuses a list for. `test` builds its tests with
// Build() and never comes to BuildAll, which makes these refusals
// again for whoever calls it.
if (const std::string refused = verb == Verb::Test ? SameDirectoryError(configurations) : PlanBuild(configurations).refused; !refused.empty()) {
Progress::Clear();
std::println(std::cerr, "{}", refused);
return 1;
}
// Builds and test runs only: lint and `format --check` promise to
// write nothing, `format` rewrites the project's sources and nothing
// else, `run` is for chores and `test --list` only lists. Here,
// before compiling, because loading has just fetched every
// dependency, so the notes are current, and an agent fixing a build
// that fails needs them.
if (!testOpts.listOnly) UpdateAgentsMd(config, projectFile);
if (!testOpts.listOnly) UpdateAgentsMd(configurations, projectFile);
if (verb == Verb::Test) {
TestSummary summary = RunTests(config, testOpts, projectArgs);
TestSummary summary = RunTests(own, testOpts, projectArgs);
return summary.AllPassed() ? 0 : 1;
}
std::unordered_map<fs::path, std::shared_future<BuildResult>> depResults;
std::mutex depMutex;
BuildResult result = Build(config, depResults, depMutex);
if (!result.result.empty()) {
if (const std::string failed = BuildAll(configurations, depResults, depMutex); !failed.empty()) {
Progress::Clear();
std::println(std::cerr, "{}", result.result);
std::println(std::cerr, "{}", failed);
return 1;
}
Progress::Finalize();
if (verb == Verb::Install || verb == Verb::Bundle) {
const std::string failed = verb == Verb::Install ? InstallFlatpakApp(config) : BundleFlatpakApp(config);
const std::string failed = verb == Verb::Install ? InstallFlatpakApp(*exported.config) : BundleFlatpakApp(*exported.config);
if (failed.empty()) return 0;
std::println(std::cerr, "{}", failed);
return 1;
}
if (runAfterBuild) {
if (config.type != ConfigurationType::Executable) {
std::vector<const Configuration*> executables;
for (const Configuration* cfg : configurations) {
if (cfg->type == ConfigurationType::Executable) executables.push_back(cfg);
}
if (executables.empty()) {
std::println(std::cerr, "-r: cannot run a library");
return 1;
}
// Everything is built by now, as without -r. Which one to run
// would be a guess.
if (executables.size() > 1) {
std::println(std::cerr, "-r: {} are executables, and -r runs one", NamesOf(executables));
return 1;
}
const Configuration& config = *executables.front();
fs::path dir = config.ProgramDir();
fs::path artifact = fs::absolute(ExpectedOutput(config));
fs::path absDir = fs::absolute(dir);