Add support for forcing a rebuild of runtimes (#6537)

This is useful during development, testing, and will also be useful for
a more bazel-integrated build step.

Also clean up the path management when creating runtimes:

- Teach the main runtimes code to handle making a relative path absolute
- Separate out methods for _creating_ a runtimes tree vs. opening an
existing one. Teach the creation path to create intervening directories
as needed. This provides a more useful and less surprising set of
behaviors.

Last but not least, also clean up a bunch of comments in the runtimes
cache code to talk generically about components -- these APIs are no
longer specific to the resource directory.
This commit is contained in:
Chandler Carruth
2025-12-31 01:59:19 +00:00
committed by GitHub
parent 2078721e1c
commit 65f35ad98e
5 changed files with 86 additions and 35 deletions
+2 -3
View File
@@ -206,9 +206,8 @@ auto Driver::RunCommand(llvm::ArrayRef<llvm::StringRef> args) -> DriverResult {
driver_env_.runtimes_cache = std::move(*cache_result);
if (!options.prebuilt_runtimes_path.empty()) {
auto result = Runtimes::Make(
std::filesystem::absolute(options.prebuilt_runtimes_path.str()),
driver_env_.vlog_stream);
auto result = Runtimes::OpenExisting(options.prebuilt_runtimes_path.str(),
driver_env_.vlog_stream);
if (!result.ok()) {
// TODO: We should provide a better diagnostic than the raw error.
CARBON_DIAGNOSTIC(DriverPrebuiltRuntimesInvalid, Error, "{0}",