59 lines
1.7 KiB
C++
59 lines
1.7 KiB
C++
export module cargoxx.manifest;
|
|
|
|
import std;
|
|
import cargoxx.util;
|
|
|
|
export namespace cargoxx::manifest {
|
|
|
|
enum class DepSource {
|
|
Auto, // string form or { version = ... } only → existing resolver chain
|
|
CargoxxPath, // { path = "../foo" } → recursive cargoxx build
|
|
CargoxxGit, // { git = "...", rev = "..." } → fetch + recursive cargoxx build
|
|
};
|
|
|
|
struct Dependency {
|
|
std::string name;
|
|
std::string version_spec;
|
|
std::vector<std::string> components;
|
|
DepSource source = DepSource::Auto;
|
|
std::optional<std::string> path; // when source == CargoxxPath
|
|
std::optional<std::string> git_url; // when source == CargoxxGit
|
|
std::optional<std::string> git_rev; // when source == CargoxxGit (40-char)
|
|
|
|
bool operator==(const Dependency&) const = default;
|
|
};
|
|
|
|
struct BuildSettings {
|
|
bool warnings_as_errors = false;
|
|
std::vector<std::string> sanitizers;
|
|
std::vector<std::string> include_dirs;
|
|
|
|
bool operator==(const BuildSettings&) const = default;
|
|
};
|
|
|
|
enum class Edition { Cpp20, Cpp23, Cpp26 };
|
|
|
|
struct Package {
|
|
std::string name;
|
|
std::string version;
|
|
Edition edition = Edition::Cpp23;
|
|
std::vector<std::string> authors;
|
|
std::optional<std::string> license;
|
|
|
|
bool operator==(const Package&) const = default;
|
|
};
|
|
|
|
struct Manifest {
|
|
Package package;
|
|
std::vector<Dependency> dependencies;
|
|
std::vector<Dependency> dev_dependencies;
|
|
BuildSettings build;
|
|
|
|
bool operator==(const Manifest&) const = default;
|
|
};
|
|
|
|
auto parse(const std::filesystem::path& path) -> util::Result<Manifest>;
|
|
auto write(const Manifest& m, const std::filesystem::path& path) -> util::Result<void>;
|
|
|
|
} // namespace cargoxx::manifest
|