Skip to content

Commit f748c83

Browse files
committed
prepare.cppm: split phase4 into phase4a_graph_load + phase4b_graph_worklist
Required by the file-size cap: phase4_dependency_graph was ~3300 lines, over the 2500 hard cap for whatever file its definition lands in. Split at loadVersionDep's own boundary (matches the design's graph_load.cpp / graph.cpp grouping): phase4a holds the git/path/ version dependency loader; phase4b holds the worklist engine and cycle detection that call it (already state.loadVersionDep from the previous commit, so the split itself needed only kMainConsumer -- a pure constant used by both halves -- hoisted to file scope. Golden fixture diff against the baseline is empty; mcpp test: 129/129.
1 parent e4544f1 commit f748c83

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎src/build/prepare.cppm‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2396,6 +2396,10 @@ constexpr std::string_view kCurrentPlatform = mcpp::platform::name;
23962396
namespace prov = mcpp::build::provisions;
23972397
namespace dg = mcpp::build::dep_graph;
23982398

2399+
// Sentinel for "the consumer is the main package" (no dep_manifests entry).
2400+
// A pure constant; used by both halves of the P4 split (graph_load, graph).
2401+
constexpr std::size_t kMainConsumer = static_cast<std::size_t>(-1);
2402+
23992403
struct DepCacheIdentity {
24002404
std::string indexName;
24012405
std::string packageName;
@@ -10698,7 +10702,7 @@ static std::expected<void, std::string> phase3_xlings_before_graph(PrepareState&
1069810702
return {};
1069910703
}
1070010704

10701-
static std::expected<void, std::string> phase4_dependency_graph(PrepareState& state) {
10705+
static std::expected<void, std::string> phase4a_graph_load(PrepareState& state) {
1070210706
// The features each package ends up built with, index-aligned with
1070310707
// `packages`. Recorded at activation because the passes that run after it
1070410708
// — `[feature-xlings]` provisioning among them — otherwise have no way to
@@ -10784,7 +10788,6 @@ static std::expected<void, std::string> phase4_dependency_graph(PrepareState& st
1078410788

1078510789

1078610790
// Sentinel for "the consumer is the main package" (no dep_manifests entry).
10787-
constexpr std::size_t kMainConsumer = static_cast<std::size_t>(-1);
1078810791

1078910792
// #634, A2. A `path` or `git` dependency's identity is the one its manifest
1079010793
// declares (SPEC-001 §1.2), and the key a consumer wrote is one way of
@@ -11757,6 +11760,10 @@ static std::expected<void, std::string> phase4_dependency_graph(PrepareState& st
1175711760

1175811761
return std::pair{effRoot, std::move(*manifest)};
1175911762
};
11763+
return {};
11764+
}
11765+
11766+
static std::expected<void, std::string> phase4b_graph_worklist(PrepareState& state) {
1176011767

1176111768
// #634, X: every request that reached a package, as the requester wrote
1176211769
// it, for the `graph` section of resolution.json. Kept apart from
@@ -14002,6 +14009,7 @@ static std::expected<void, std::string> phase4_dependency_graph(PrepareState& st
1400214009
return {};
1400314010
}
1400414011

14012+
1400514013
static std::expected<void, std::string> phase5_toolchain_after_graph(PrepareState& state) {
1400614014

1400714015
// ─── The toolchain, resolved now that the graph exists ──────────────────
@@ -16360,7 +16368,8 @@ prepare_build(bool print_fingerprint,
1636016368
if (auto r = phase1_toolchain_spec_and_axes(state); !r) return std::unexpected(r.error());
1636116369
if (auto r = phase2_define_toolchain_resolver(state); !r) return std::unexpected(r.error());
1636216370
if (auto r = phase3_xlings_before_graph(state); !r) return std::unexpected(r.error());
16363-
if (auto r = phase4_dependency_graph(state); !r) return std::unexpected(r.error());
16371+
if (auto r = phase4a_graph_load(state); !r) return std::unexpected(r.error());
16372+
if (auto r = phase4b_graph_worklist(state); !r) return std::unexpected(r.error());
1636416373
if (auto r = phase5_toolchain_after_graph(state); !r) return std::unexpected(r.error());
1636516374
if (auto r = phase6_features_and_host_tools(state); !r) return std::unexpected(r.error());
1636616375
if (auto r = phase9_target_side_and_scan(state); !r) return std::unexpected(r.error());

0 commit comments

Comments
 (0)