One user-space repair task per eligible HWE debug-diag / compile-deploy base ID: 320 admitted (C 218, C++ 97, build scripts 5), 1 skipped by the content filter. Each ships a public spec with a check-to-basis table, at least two defects with single-fix fixtures, a symptom-masking fixture and an alternative correct implementation. Claude re-checked all 320: structure, the HWE quality items and trace6 Docker calibration receipts against current digests (320/320 USABLE). Difficulty is unmeasured. Known follow-up: 212 tasks use 120 ad-hoc family names; the next batch maps them to the canonical list. The batch's 1,256-line progress log stays in its factory report and the 36-local branch batch15-hwe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
108 lines
2.6 KiB
C++
108 lines
2.6 KiB
C++
#ifndef BUILD_PLAN_PLANNER_HPP
|
|
#define BUILD_PLAN_PLANNER_HPP
|
|
|
|
#include <cstddef>
|
|
#include <map>
|
|
#include <set>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace buildplan {
|
|
|
|
enum class Language { C, CPP };
|
|
enum class Origin { TARGET, HOST };
|
|
enum class Problem {
|
|
NONE,
|
|
FORMAT,
|
|
DUPLICATE,
|
|
MISSING,
|
|
CYCLE,
|
|
HOST_DEP,
|
|
LIMIT,
|
|
NO_ROOT
|
|
};
|
|
|
|
struct Configuration {
|
|
std::string target;
|
|
std::string sysroot;
|
|
std::string cc;
|
|
std::string cxx;
|
|
std::string cruntime;
|
|
std::string cppruntime;
|
|
};
|
|
|
|
struct Unit {
|
|
std::string name;
|
|
Language language;
|
|
Origin origin;
|
|
std::vector<std::string> dependencies;
|
|
};
|
|
|
|
struct Request {
|
|
Configuration config;
|
|
std::map<std::string, Unit> units;
|
|
std::string root;
|
|
bool has_config = false;
|
|
bool has_root = false;
|
|
};
|
|
|
|
struct Observation {
|
|
std::string kind;
|
|
std::vector<std::string> fields;
|
|
};
|
|
|
|
struct Result {
|
|
Problem problem = Problem::NONE;
|
|
std::vector<Observation> observations;
|
|
};
|
|
|
|
std::string problem_name(Problem problem);
|
|
std::vector<std::string> split_fields(const std::string& line);
|
|
bool name_valid(const std::string& name);
|
|
bool atom_valid(const std::string& atom, bool allow_slash);
|
|
bool sysroot_valid(const std::string& path);
|
|
std::string runtime_path(const std::string& sysroot, const std::string& runtime);
|
|
Result parse_and_plan(const std::vector<std::string>& lines);
|
|
std::string encode_result(const Result& result);
|
|
|
|
class RequestReader {
|
|
public:
|
|
void accept(const std::string& line);
|
|
bool pending() const;
|
|
Result finish();
|
|
private:
|
|
std::vector<std::string> lines_;
|
|
};
|
|
|
|
class Parser {
|
|
public:
|
|
explicit Parser(const std::vector<std::string>& lines);
|
|
Problem parse(Request& request) const;
|
|
private:
|
|
const std::vector<std::string>& lines_;
|
|
Problem parse_config(const std::vector<std::string>& fields, Request& request) const;
|
|
Problem parse_unit(const std::vector<std::string>& fields, Request& request) const;
|
|
Problem parse_root(const std::vector<std::string>& fields, Request& request) const;
|
|
Problem parse_dependencies(const std::string& token,
|
|
std::vector<std::string>& dependencies) const;
|
|
};
|
|
|
|
class Planner {
|
|
public:
|
|
explicit Planner(const Request& request);
|
|
Result make_plan();
|
|
private:
|
|
const Request& request_;
|
|
std::set<std::string> reachable_;
|
|
std::set<std::pair<std::string, std::string>> edges_;
|
|
std::map<std::string, int> color_;
|
|
std::map<std::string, int> depth_;
|
|
bool needs_cpp_ = false;
|
|
Problem visit(const std::string& name);
|
|
Result render() const;
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|