fix(incremental): relink when a C or CUDA object is rebuilt
The C compile loop sets no repack flag, and the "is any object newer than the archive" sweep only walked interfaces and implementations. So editing a .c recompiled its object and then linked nothing: the archive and the executable kept the previous one. Surfaced by the header-change test, where a rebuilt counter.c produced a binary still printing the old value.
This commit is contained in:
parent
1d0d8e1e28
commit
f66120a8eb
1 changed files with 15 additions and 0 deletions
|
|
@ -1109,6 +1109,21 @@ BuildResult Crafter::Build(Configuration& config, std::unordered_map<fs::path, s
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// C and CUDA objects are archive members too, and their compile
|
||||||
|
// loop above is the only thing that knows it rebuilt one — it
|
||||||
|
// sets no repack flag, so without this a .c edit recompiled the
|
||||||
|
// object and then linked nothing.
|
||||||
|
if (!buildResult.repack) {
|
||||||
|
auto sourceObjNewer = [&](const std::vector<fs::path>& sources) {
|
||||||
|
for (const fs::path& source : sources) {
|
||||||
|
if (objNewer(buildDir / std::format("{}_source.o", source.filename().string()))) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
if (sourceObjNewer(config.cFiles) || sourceObjNewer(config.cuda)) {
|
||||||
|
buildResult.repack = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue