Merge branch 'claude/forward-project-args': sibling projects inherit the args, lint with the lite rules

PR #40. GitProject and LocalProject default their args to the loading
project's own (ProjectArgs()), this tree lints with LintRules' lite
set, and the fixes from the branch's review: a project file gets its
args only for the CrafterBuildProject call, host tooling gets project
cache entries of its own, and `--` ends crafter-build's options.

The conflicts with claude/dependency-notes are all places both sides
added to:
- Platform.cppm and Platform.cpp: PragmaDependencies() beside
  ProjectArgs() and LoadingHostTooling(), all three kept.
- LoadProject: the record PragmaDependencies() reads moves up with the
  frame's dependencies, which this branch sets before dlopen. Left
  where it was, it would have copied preDeps.configs after the vector
  was moved into the frame, and recorded nothing.
- README: the pragma section's new last sentence goes before the new
  "Dependency notes for agents" section.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jorijn van der Graaf 2026-10-31 05:27:37 +01:00
commit 75142276ab
Signed by: jorijnvdgraaf
GPG key ID: 2937E59CDCC1BCFB
23 changed files with 599 additions and 62 deletions

View file

@ -1652,6 +1652,10 @@ Build options:
-v, --verbose Verbose progress output.
-q, --quiet Suppress progress output.
--project=<path> Path to the project file (default: ./project.cpp).
-- Ends this tool's options. Every later word is a
project arg, even one that looks like an option or
a verb; after test, lint or format, a glob; after
run, the script's name and then its args.
Test options (after the `test` subcommand):
--list Enumerate matching tests without running them.
@ -1770,6 +1774,9 @@ std::int32_t Crafter::Run(std::int32_t argc, char** argv) {
RunLintOptions lintOpts;
RunScriptOptions scriptOpts;
Progress::Verbosity verbosity = Progress::Verbosity::Default;
// Set by `--`: every later word is an operand of the verb, never an
// option or a verb of this tool.
bool operandsOnly = false;
for (std::int32_t i = 1; i < argc; ++i) {
std::string_view arg = argv[i];
@ -1781,11 +1788,25 @@ std::int32_t Crafter::Run(std::int32_t argc, char** argv) {
// variant hash and so the directory the project builds into.
if (scriptOpts.named) {
scriptOpts.args.emplace_back(arg);
} else if (runScript && !arg.starts_with("-")) {
} else if (runScript && (operandsOnly || !arg.starts_with("-"))) {
// The first word after `run`, even one that is a verb
// elsewhere. Options before it keep their usual meaning.
scriptOpts.name = arg;
scriptOpts.named = true;
} else if (operandsOnly) {
if (runTests) {
testOpts.globs.emplace_back(arg);
} else if (runLint || runFormat) {
lintOpts.globs.emplace_back(arg);
} else {
projectArgs.push_back(arg);
}
} else if (arg == "--") {
// Ends this tool's options and is never forwarded itself. It
// used to land in projectArgs as a word of its own, giving the
// project a variant hash of its own, and every sibling project
// that inherits the args one as well.
operandsOnly = true;
} else if (arg == "--version") {
// Answered here, before the project file is looked for, so
// it works in any directory and is never forwarded to