Generate and use a manifest for prelude files. (#4291)

This removes the directory crawl because bazel doesn't remove files from
execroot when the rule generating them would no longer generate them.

Fixes #4288
This commit is contained in:
Jon Ross-Perkins
2024-09-10 20:59:49 +00:00
committed by GitHub
parent 2e299f5fc4
commit 6311552fcc
8 changed files with 85 additions and 43 deletions
+4 -3
View File
@@ -36,7 +36,7 @@ class ToolchainFileTest : public FileTestBase {
auto Run(const llvm::SmallVector<llvm::StringRef>& test_args,
llvm::vfs::InMemoryFileSystem& fs, llvm::raw_pwrite_stream& stdout,
llvm::raw_pwrite_stream& stderr) -> ErrorOr<RunResult> override {
CARBON_ASSIGN_OR_RETURN(auto prelude, installation_.FindPreludeFiles());
CARBON_ASSIGN_OR_RETURN(auto prelude, installation_.ReadPreludeManifest());
for (const auto& file : prelude) {
CARBON_RETURN_IF_ERROR(AddFile(fs, file));
}
@@ -136,10 +136,11 @@ class ToolchainFileTest : public FileTestBase {
llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> file =
llvm::MemoryBuffer::getFile(path);
if (file.getError()) {
return ErrorBuilder() << file.getError().message();
return ErrorBuilder()
<< "Getting `" << path << "`: " << file.getError().message();
}
if (!fs.addFile(path, /*ModificationTime=*/0, std::move(*file))) {
return ErrorBuilder() << "Duplicate file: " << path;
return ErrorBuilder() << "Duplicate file: `" << path << "`";
}
return Success();
}