Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions src/manifest.cppm
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,19 @@ export module mcpp.manifest;

import std;
import mcpp.libs.toml;
import mcpp.pm.dep_spec; // M5.x pm/ subsystem refactor: DependencySpec lives here

export namespace mcpp::manifest {

// PR-R1 transitional: the dependency data model has moved into
// `mcpp.pm.dep_spec`. The aliases below keep `mcpp::manifest::DependencySpec`
// and `mcpp::manifest::kDefaultNamespace` available as before so existing
// callers (`cli.cppm`, `fetcher.cppm`, ...) compile unchanged. A later
// refactor PR will migrate call sites to reference `mcpp::pm::` directly
// and these aliases can disappear.
using DependencySpec = mcpp::pm::DependencySpec;
inline constexpr auto kDefaultNamespace = mcpp::pm::kDefaultNamespace;

struct Package {
std::string name;
std::string version;
Expand Down Expand Up @@ -35,29 +45,9 @@ struct Target {
std::string main; // for binary / test
};

// One declared dependency. Path-based deps refer to a sibling mcpp package
// on disk; version-based deps (M2 future) come from a registry.
struct DependencySpec {
// (M5.x) xpkg-style namespace. Defaults to "mcpp" for the root index.
// Carried alongside the existing fully-qualified name (which the
// dependencies map keys on) so callers that want the structured form
// — registry lookup, lockfile entries, error messages — can pull it
// out without re-splitting strings.
std::string namespace_; // "mcpp" / "mcpplibs" / ...
std::string shortName; // package name without namespace prefix
std::string version; // "0.0.1" / "^1.2" / "" (req string)
std::string path; // filesystem path, or empty
std::string git; // "https://..." or empty
std::string gitRev; // commit / tag / branch (any one)
std::string gitRefKind; // "rev" / "tag" / "branch" (for clarity)
bool isPath() const { return !path.empty(); }
bool isGit() const { return !git.empty(); }
bool isVersion() const { return !isPath() && !isGit() && !version.empty(); }
};

// The default namespace for packages with no explicit namespace declaration.
// Treated as the mcpp-index "root" — `gtest = "1.15.2"` ⇒ (mcpp, gtest).
inline constexpr std::string_view kDefaultNamespace = "mcpp";
// `DependencySpec` and `kDefaultNamespace` have moved to mcpp.pm.dep_spec.
// Aliases at the top of this file keep `mcpp::manifest::DependencySpec`
// resolvable for unchanged call sites.

// `[toolchain]` section per docs/21-toolchain-and-tools.md
// linux = "gcc@15.1.0"
Expand Down
44 changes: 44 additions & 0 deletions src/pm/dep_spec.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// mcpp.pm.dep_spec — package-management subsystem: dependency data model.
//
// Owns `DependencySpec` and the default-namespace constant. Pure value
// types — no IO, no parsing here. Parsing currently lives in
// `mcpp.manifest`; a follow-up PR-R5 will move the `[dependencies]` /
// `[dev-dependencies]` parsing here, alongside the namespaced subtable
// + flat + legacy-dotted forms already established in PR-A.
//
// See `.agents/docs/2026-05-08-pm-subsystem-architecture.md` for the
// full pm/ subsystem layout.

export module mcpp.pm.dep_spec;

import std;

export namespace mcpp::pm {

// One declared dependency. Path-based deps refer to a sibling mcpp package
// on disk; version-based deps come from a registry; git-based deps clone
// a remote at a fixed ref.
struct DependencySpec {
// xpkg-style namespace. Defaults to `kDefaultNamespace` ("mcpp") for
// the root index. Carried alongside the existing fully-qualified name
// (which the dependencies map keys on) so callers that want the
// structured form — registry lookup, lockfile entries, error
// messages — can pull it out without re-splitting strings.
std::string namespace_; // "mcpp" / "mcpplibs" / ...
std::string shortName; // package name without namespace prefix
std::string version; // "0.0.1" / "^1.2" / "" (req string)
std::string path; // filesystem path, or empty
std::string git; // "https://..." or empty
std::string gitRev; // commit / tag / branch (any one)
std::string gitRefKind; // "rev" / "tag" / "branch" (for clarity)

bool isPath() const { return !path.empty(); }
bool isGit() const { return !git.empty(); }
bool isVersion() const { return !isPath() && !isGit() && !version.empty(); }
};

// Default namespace for packages declared without an explicit one — the
// mcpp-index "root". Bare `gtest = "1.15.2"` becomes `(mcpp, gtest)`.
inline constexpr std::string_view kDefaultNamespace = "mcpp";

} // namespace mcpp::pm
19 changes: 19 additions & 0 deletions src/pm/index_spec.cppm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// mcpp.pm.index_spec — package-index repository configuration.
//
// Reserved for the upcoming `[indices]` parsing & IndexSpec data type;
// see `.agents/docs/2026-05-08-package-index-config.md` for the full
// design. The module placeholder is created early so the rest of the
// pm/ subsystem can land its imports against a stable module path
// while the implementation arrives.

export module mcpp.pm.index_spec;

import std;

export namespace mcpp::pm {

// Placeholder. The full `IndexSpec` (url / rev / tag / branch / path)
// + `[indices]` TOML parsing lands in a dedicated PR per the
// package-index-config design doc.

} // namespace mcpp::pm
Loading