sun::moon_bundling::MoonBuilder
class · Source (opens in a new tab)
class sun::moon_bundling::MoonBuilderCompiles source modules and packages them into a reusable Moon library.
Types
- sun::moon_bundling::MoonBuilder::LoadedInputs (public)
- sun::moon_bundling::MoonBuilder::NativeSymbols (public)
- sun::moon_bundling::MoonBuilder::ExportMetadata (public)
- sun::moon_bundling::MoonBuilder::CompiledBundle (public)
Public Functions
build
public · function · static · Source (opens in a new tab)
MoonBuildReport sun::moon_bundling::MoonBuilder::build(const std::string &entrypoint, const std::filesystem::path &outputPath, const MoonBuildOptions &options={})Build outputPath from entrypoint.
A bundle already there and built from the same inputs is left alone (see input_hash.h) unless options.forceRebuild or debug output asks for the work anyway. Throws SunError on manifest, proto import, compilation, bundle write, or debug output failure.
Related: MoonBuildReport, MoonBuildOptions, input_hash.h, SunError
defaultOutputPath
public · function · static · Source (opens in a new tab)
std::filesystem::path sun::moon_bundling::MoonBuilder::defaultOutputPath(const std::string &entrypoint)Default output path for an entrypoint: <entrypoint without .sun>.moon.
Private Functions
- collectMetadata
- compile
- isUpToDate
- loadInputs
- packageNativeArchives
- prepareNativeSymbols
- readExistingReport
- writeBundle
- writeDebugJson
collectMetadata
private · function · static · Source (opens in a new tab)
MoonBuilder::ExportMetadata sun::moon_bundling::MoonBuilder::collectMetadata(const sun::ast::BlockExprAST &program, sun::semantic_analysis::SemanticAnalyzer &analyzer, const std::string &inputHash, uint32_t staticInitOrder)Returns validated exports with bundle-local source identifiers.
Related: ExportMetadata, sun::ast::BlockExprAST, sun::semantic_analysis::SemanticAnalyzer
compile
private · function · static · Source (opens in a new tab)
MoonBuilder::CompiledBundle sun::moon_bundling::MoonBuilder::compile(const LoadedInputs &inputs, const NativeSymbols &symbols, const std::string &entrypoint, const MoonBuildOptions &options)Compiles prepared inputs and returns the driver and its export metadata.
Related: CompiledBundle, LoadedInputs, NativeSymbols, MoonBuildOptions
isUpToDate
private · function · static · Source (opens in a new tab)
bool sun::moon_bundling::MoonBuilder::isUpToDate(const std::string &inputHash, const std::filesystem::path &outputPath, const MoonBuildOptions &options)Checks whether the existing output matches the inputs and needs no rebuild.
Related: MoonBuildOptions
loadInputs
private · function · static · Source (opens in a new tab)
MoonBuilder::LoadedInputs sun::moon_bundling::MoonBuilder::loadInputs(const std::string &entrypoint, const MoonBuildOptions &options)Resolves and loads inputs, generates sources, and computes build hashes.
Related: LoadedInputs, MoonBuildOptions
packageNativeArchives
private · function · static · Source (opens in a new tab)
std::vector< std::string > sun::moon_bundling::MoonBuilder::packageNativeArchives(MoonWriter &writer, const LoadedInputs &inputs, const NativeSymbols &symbols, const std::vector< std::string > &inheritedPaths)Adds archives to the writer and returns inherited archive names.
Related: MoonWriter, LoadedInputs, NativeSymbols
prepareNativeSymbols
private · function · static · Source (opens in a new tab)
MoonBuilder::NativeSymbols sun::moon_bundling::MoonBuilder::prepareNativeSymbols(const LoadedInputs &inputs)Computes native symbol renames and warns about duplicate definitions.
Related: NativeSymbols, LoadedInputs
readExistingReport
private · function · static · Source (opens in a new tab)
MoonBuildReport sun::moon_bundling::MoonBuilder::readExistingReport(const std::filesystem::path &bundlePath, const std::string &ownArchiveSetHash, MoonBuildReport report)Adds cached exports and inherited archives to the supplied input report.
Related: MoonBuildReport
writeBundle
private · function · static · Source (opens in a new tab)
std::vector< std::string > sun::moon_bundling::MoonBuilder::writeBundle(const LoadedInputs &inputs, const NativeSymbols &symbols, CompiledBundle &compiled, const std::filesystem::path &outputPath, const MoonBuildOptions &options)Writes compiled code and archives, returning inherited archive names.
Related: LoadedInputs, NativeSymbols, CompiledBundle, MoonBuildOptions
writeDebugJson
private · function · static · Source (opens in a new tab)
void sun::moon_bundling::MoonBuilder::writeDebugJson(const std::filesystem::path &outputPath, const std::filesystem::path &debugFolder)Writes the bundle's JSON representation into the debug directory.