Skip to content

Commit 3ea3fb1

Browse files
committed
PR #759, round 4: the Windows literal-to-optional<std::string> form, and a 5-line tighten so src/build/prepare/plan.cpp is back under the 2,500-line gate
The third CI round (run 36946677551) had two failures from the #756/#757 commit's +12 lines: - Windows clang+MSVC STL would not compile a literal returned directly to std::optional<std::string> in engine_declined_because (execute.cppm:189). std::string(...) makes the conversion explicit and identical on every STL. - src/build/prepare/plan.cpp went from 2,491 to 2,503 lines, three over the check_file_lengths.sh cap. The new rootOf/recorded lambdas in step13_source_packages carry DepSourceRoot (a comment is redundant with the struct's own), and the two are tight enough to put the file back at 2,498. No semantic change. Local unit tests: 20/20 BuildCacheRecord tests pass (BuildCacheRecord, DepSourcesNewerThan, ReadEngineBinding).
1 parent cd8dad9 commit 3ea3fb1

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

‎src/build/execute.cppm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ export EngineIdentity running_engine() {
186186
export std::optional<std::string>
187187
engine_declined_because(const std::optional<EngineIdentity>& recorded,
188188
const EngineIdentity& running) {
189-
if (!recorded) return "the recorded build predates the engine identity";
189+
if (!recorded) return std::string("the recorded build predates the engine identity");
190190
if (recorded->version != running.version)
191191
return std::format("the recorded build was written by mcpp {}, and this is mcpp {}",
192192
recorded->version, running.version);

‎src/build/prepare/plan.cpp‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,12 @@ static std::expected<void, std::string> step13_source_packages(PrepareState& sta
139139
std::vector<std::filesystem::path> owned = state.storeRoots;
140140
owned.push_back(mcpp::home::root());
141141
std::vector<DepSourceRoot> roots;
142-
// A root is recorded with its own package's extension tables, from the
143-
// package's effective manifest (see DepSourceRoot).
144-
auto rootOf = [&](std::size_t i, std::filesystem::path normalized) {
142+
auto rootOf = [&](std::size_t i, std::filesystem::path n) {
145143
const auto& bc = state.packages[i].manifest.buildConfig;
146-
return DepSourceRoot{std::move(normalized), bc.moduleExtensions,
147-
bc.deviceExtensions};
144+
return DepSourceRoot{std::move(n), bc.moduleExtensions, bc.deviceExtensions};
148145
};
149-
auto recorded = [&](const std::filesystem::path& normalized) {
150-
return std::ranges::any_of(roots, [&](const DepSourceRoot& r) {
151-
return r.root == normalized;
152-
});
146+
auto recorded = [&](const std::filesystem::path& n) {
147+
return std::ranges::any_of(roots, [&](const DepSourceRoot& r) { return r.root == n; });
153148
};
154149
// The same enumeration answers a second reader: which packages were
155150
// read from an editable tree, with their source globs (the build

0 commit comments

Comments
 (0)