Review fixes (8 blocking issues):
- Extract ParseError to shared error.hpp (ODR fix)
- Remove dead package.cpp/package.hpp + tomlplusplus dep
- Safe parse_int() helper replacing crash-prone std::stoi
- consume_string() now accepts bare numbers and idents
- line_at() fixed for post-EOF line numbers
- Subcommand validation before file read in CLI
- KwService/KwAssert/KwImport added to consume_ident()
- root partition promoted to first-class BootBlock field
New features:
- Imports: imports = [...] with recursive merge resolution
- Assertions: assert { "msg" : field op value } in both parsers
- Merge engine: resolve_package() with features/config merge + force support
- Per-package overrides: /kappa/system/builds/<name>.kap
- .gitignore: added vcpkg_installed/ and kappa binary
84 lines
1.7 KiB
C++
84 lines
1.7 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <unordered_set>
|
|
#include <vector>
|
|
|
|
namespace kappa::dsl {
|
|
|
|
using Command = std::string;
|
|
|
|
struct Phase {
|
|
std::vector<Command> commands;
|
|
};
|
|
|
|
struct Dependency {
|
|
std::string name;
|
|
std::string version;
|
|
std::string output;
|
|
std::string feature; // empty = unconditional
|
|
};
|
|
|
|
struct ConfigFile {
|
|
std::string path;
|
|
std::string mode;
|
|
std::unordered_map<std::string, std::string> entries;
|
|
};
|
|
|
|
struct FeatureDef {
|
|
bool enabled = false;
|
|
bool force = false;
|
|
std::string flag;
|
|
};
|
|
|
|
struct Patch {
|
|
std::string url;
|
|
std::string sha256;
|
|
int level = 1;
|
|
};
|
|
|
|
struct EnvEntry {
|
|
std::string key;
|
|
std::string value;
|
|
bool soft = false;
|
|
};
|
|
|
|
struct ServiceInit {
|
|
std::string exec;
|
|
std::string type;
|
|
std::string user;
|
|
std::vector<int> ports;
|
|
std::unordered_map<std::string, std::string> env;
|
|
};
|
|
|
|
struct Assertion {
|
|
std::string message;
|
|
std::string field;
|
|
std::string op; // "==" or "!="
|
|
std::string value;
|
|
};
|
|
|
|
struct PackageDef {
|
|
std::string name;
|
|
std::string version;
|
|
std::string source;
|
|
std::string license;
|
|
std::vector<Dependency> depends;
|
|
std::vector<std::string> provides;
|
|
std::vector<std::string> outputs;
|
|
std::unordered_map<std::string, FeatureDef> features;
|
|
std::vector<ConfigFile> config_files;
|
|
std::vector<Patch> patches;
|
|
std::vector<EnvEntry> env_entries;
|
|
std::unordered_map<std::string, ServiceInit> service;
|
|
std::vector<Assertion> assertions;
|
|
std::unordered_set<std::string> const_keys;
|
|
Phase prepare;
|
|
Phase build;
|
|
Phase check;
|
|
Phase install;
|
|
};
|
|
|
|
} // namespace kappa::dsl
|