This commit is contained in:
parent
bc9ceb8f24
commit
0ab30a1d81
5 changed files with 249 additions and 18 deletions
|
|
@ -24,6 +24,8 @@ import std;
|
|||
namespace fs = std::filesystem;
|
||||
|
||||
export namespace Crafter {
|
||||
struct Configuration;
|
||||
|
||||
struct GitSource {
|
||||
std::string url;
|
||||
std::string branch;
|
||||
|
|
@ -55,4 +57,37 @@ export namespace Crafter {
|
|||
const ExternalDependency& dep,
|
||||
std::string_view target,
|
||||
std::atomic<bool>& cancelled);
|
||||
|
||||
// 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.
|
||||
struct GitProjectSpec {
|
||||
GitSource source;
|
||||
fs::path projectFile = "project.cpp";
|
||||
std::vector<std::string> args;
|
||||
};
|
||||
|
||||
// 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.
|
||||
CRAFTER_API 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
|
||||
};
|
||||
|
||||
// Same as GitProject but for a local on-disk project — no fetch, no
|
||||
// cache copy. Resolves projectFile to its canonical absolute path and
|
||||
// recursively LoadProject's it. Returns a stable Configuration* owned
|
||||
// by the same internal cache as GitProject.
|
||||
CRAFTER_API Configuration* LocalProject(const LocalProjectSpec& spec);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue