mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 20:01:14 +01:00
precompile and cache Carbon prelude (#7432)
Refactors the link driver to automatically compile and cache the carbon prelude for use in linking. Implements a `carbon_library` rule for compiling the Core library dependencies in the examples.
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "toolchain/driver/build_runtimes_subcommand.h"
|
||||
|
||||
#include "llvm/TargetParser/Triple.h"
|
||||
#include "toolchain/driver/carbon_runtimes.h"
|
||||
#include "toolchain/driver/clang_runner.h"
|
||||
#include "toolchain/driver/clang_runtimes.h"
|
||||
|
||||
@@ -97,6 +98,7 @@ auto BuildRuntimesSubcommand::RunInternal(DriverEnv& driver_env)
|
||||
CARBON_RETURN_IF_ERROR(runtimes.Remove(Runtimes::ClangResourceDir));
|
||||
CARBON_RETURN_IF_ERROR(runtimes.Remove(Runtimes::LibUnwind));
|
||||
CARBON_RETURN_IF_ERROR(runtimes.Remove(Runtimes::Libcxx));
|
||||
CARBON_RETURN_IF_ERROR(runtimes.Remove(Runtimes::CarbonCore));
|
||||
}
|
||||
|
||||
ClangResourceDirBuilder resource_dir_builder(&runner, driver_env.thread_pool,
|
||||
@@ -108,10 +110,13 @@ auto BuildRuntimesSubcommand::RunInternal(DriverEnv& driver_env)
|
||||
ClangArchiveRuntimesBuilder<Runtimes::Libcxx> libcxx_builder(
|
||||
&runner, driver_env.thread_pool, llvm::Triple(features.target),
|
||||
&runtimes);
|
||||
CarbonPreludeBuilder prelude_builder(&driver_env, &runtimes,
|
||||
&options_.codegen_options);
|
||||
|
||||
CARBON_RETURN_IF_ERROR(std::move(resource_dir_builder).Wait());
|
||||
CARBON_RETURN_IF_ERROR(std::move(lib_unwind_builder).Wait());
|
||||
CARBON_RETURN_IF_ERROR(std::move(libcxx_builder).Wait());
|
||||
CARBON_RETURN_IF_ERROR(std::move(prelude_builder).Build());
|
||||
|
||||
return runtimes.base_path();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user