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:
commit
75142276ab
23 changed files with 599 additions and 62 deletions
|
|
@ -71,31 +71,56 @@ export namespace Crafter {
|
|||
// clone can still differ in includeDirs, libDirs and libs.
|
||||
ExternalBuildResult ExternalOutputs(const ExternalDependency& dep, std::string_view target);
|
||||
|
||||
// The args the project file now running its CrafterBuildProject was
|
||||
// loaded with: everything that function receives, --target=, --debug and
|
||||
// the other standard flags included. Not cfg.projectArgs, which holds
|
||||
// only what ApplyStandardArgs left uninterpreted: `.args =
|
||||
// cfg.projectArgs` would drop the target and the build type. Empty
|
||||
// everywhere else, because it reads the stack LoadProject keeps per
|
||||
// thread, as IsTopLevelProject does: outside a project file, on any
|
||||
// thread but the one running it, once CrafterBuildProject has returned
|
||||
// (a script runs later), and before it is called, which covers the
|
||||
// file's static initialisers and its `#pragma crafter dependency`
|
||||
// pre-pass. The specs below default their args to it. Defined beside
|
||||
// LoadProject, but declared here so those defaults can see it: importing
|
||||
// :Platform into this partition would make the exported `struct
|
||||
// Configuration;` above a redeclaration of :Platform's unexported one,
|
||||
// which clang rejects.
|
||||
std::vector<std::string> ProjectArgs();
|
||||
|
||||
// Specification for a sibling crafter-build project to fetch and depend on.
|
||||
// GitSource picks the revision: leave branch + commit empty for the
|
||||
// remote's default branch HEAD (sloppy but convenient), set branch to
|
||||
// track a branch tip, or set commit to pin to an immutable SHA. args are
|
||||
// forwarded verbatim to the dep's CrafterBuildProject — typically you
|
||||
// pass through the parent's args so target/march/debug propagate.
|
||||
// what the dep's CrafterBuildProject receives. They default to this
|
||||
// project's own, read when the spec is made, so --target=, --march=,
|
||||
// --debug and the project's own flags reach every sibling down a chain
|
||||
// without being passed. Set them to forward something else: {} for
|
||||
// nothing, or a list built from this project's args, such as one without
|
||||
// a flag only this project reads. Give such a list to every sibling: a
|
||||
// project that two paths load with two different lists is built twice,
|
||||
// and the program ends up with both builds.
|
||||
struct GitProjectSpec {
|
||||
GitSource source;
|
||||
fs::path projectFile = "project.cpp";
|
||||
std::vector<std::string> args;
|
||||
std::vector<std::string> args = ProjectArgs();
|
||||
};
|
||||
|
||||
// Clones the spec's git URL into the per-project external cache (keyed by
|
||||
// url+branch+commit+args+projectFile), recursively LoadProject's the
|
||||
// remote's project.cpp, and returns a stable Configuration* you can drop
|
||||
// into cfg.dependencies. The Configuration is owned by an internal cache
|
||||
// for the lifetime of the build; identical specs share one Configuration.
|
||||
// Clones the spec's git URL into the external cache, recursively
|
||||
// LoadProject's the remote's project.cpp, and returns a stable
|
||||
// Configuration* you can drop into cfg.dependencies. The clone is keyed by
|
||||
// url+branch+commit+projectFile alone, so every arg list builds in the
|
||||
// same working tree, each into variant directories of its own. The
|
||||
// Configuration is owned by an internal cache for the lifetime of the
|
||||
// build, keyed by the clone and the args: identical specs share one.
|
||||
Configuration* GitProject(const GitProjectSpec& spec);
|
||||
|
||||
// Specification for a local sibling crafter-build project (e.g. an
|
||||
// example folder depending on its parent project, or a workspace where
|
||||
// multiple projects live side-by-side without going through git).
|
||||
struct LocalProjectSpec {
|
||||
fs::path projectFile; // relative to cwd or absolute
|
||||
std::vector<std::string> args; // forwarded to dep's CrafterBuildProject
|
||||
fs::path projectFile; // relative to cwd or absolute
|
||||
std::vector<std::string> args = ProjectArgs(); // as GitProjectSpec::args
|
||||
};
|
||||
|
||||
// Same as GitProject but for a local on-disk project — no fetch, no
|
||||
|
|
|
|||
Loading…
Reference in a new issue