sun::moon_bundling::MoonWriter
class · Source (opens in a new tab)
class sun::moon_bundling::MoonWriterCreates .moon bundle files containing multiple modules.
Types
- sun::moon_bundling::MoonWriter::ModuleData (private)
- sun::moon_bundling::MoonWriter::PendingArchive (private)
Public Functions
- MoonWriter
- addModule
- addNativeArchive
- declareNativeRequirements
- getError
- inheritContract
- setHasTests
- setLibraryId
- setVersionName
- write
MoonWriter
public · function · Source (opens in a new tab)
sun::moon_bundling::MoonWriter::MoonWriter(std::string bundleHash)param
bundleHash: The bundle's input hash (see driver/input_hash.h), computed before its code was compiled so the compiler could spell every exported symbol with the$hash$_prefix. Recorded in each module's metadata, for importers and for skipping a build whose inputs are unchanged.
Related: driver/input_hash.h
addModule
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::addModule(llvm::Module &module, const moon::ModuleMetadata &metadata)Add a compiled module to the bundle.
param
-
module: The compiled LLVM module -
metadata: Module metadata (protobuf) including AST nodes
addNativeArchive
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::addNativeArchive(std::string archiveSetHash, std::string name, std::string data)Carry a native static library inside the bundle.
param
-
archiveSetHash: Hash the archive's symbols are prefixed with -
name: File name recorded in the bundle (e.g. "libssl.a") -
data: Raw archive contents, symbols already renamed
declareNativeRequirements
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::declareNativeRequirements(const std::vector< std::string > &cpuFeatures, const std::vector< std::string > &runtimeServices)Records additional producer-declared requirements for packaged archives.
getError
public · function · Source (opens in a new tab)
const std::string & sun::moon_bundling::MoonWriter::getError() constGet error message if write failed.
inheritContract
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::inheritContract(const abi::BundleContract &contract)Retains all requirements of code embedded from a validated dependency.
Related: abi::BundleContract
setHasTests
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::setHasTests(bool present)Records the producing entrypoint's tests, excluding imported libraries.
setLibraryId
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::setLibraryId(const std::string &libraryId)Sets the producing library identity after adding emitted code.
setVersionName
public · function · Source (opens in a new tab)
void sun::moon_bundling::MoonWriter::setVersionName(const std::string &name)Sets an optional human-readable name without changing compatibility.
write
public · function · Source (opens in a new tab)
bool sun::moon_bundling::MoonWriter::write(const std::filesystem::path &outputPath)Write the bundle to disk.
param
outputPath: Path to write the .moon file
return: true on success
Private Fields
- blobIndexByModule_
- blobs_
- bundleHash_
- contract_
- error_
- hasTests_
- modules_
- nativeArchives_
- versionName_
blobIndexByModule_
private · variable · Source (opens in a new tab)
std::unordered_map<const llvm::Module*, size_t> sun::moon_bundling::MoonWriter::blobIndexByModule_No documentation comment.
blobs_
private · variable · Source (opens in a new tab)
std::vector<std::string> sun::moon_bundling::MoonWriter::blobs_No documentation comment.
bundleHash_
private · variable · Source (opens in a new tab)
std::string sun::moon_bundling::MoonWriter::bundleHash_No documentation comment.
contract_
private · variable · Source (opens in a new tab)
abi::BundleContract sun::moon_bundling::MoonWriter::contract_No documentation comment.
Related: abi::BundleContract
error_
private · variable · Source (opens in a new tab)
std::string sun::moon_bundling::MoonWriter::error_No documentation comment.
hasTests_
private · variable · Source (opens in a new tab)
bool sun::moon_bundling::MoonWriter::hasTests_ = falseNo documentation comment.
modules_
private · variable · Source (opens in a new tab)
std::vector<ModuleData> sun::moon_bundling::MoonWriter::modules_No documentation comment.
Related: ModuleData
nativeArchives_
private · variable · Source (opens in a new tab)
std::vector<PendingArchive> sun::moon_bundling::MoonWriter::nativeArchives_No documentation comment.
Related: PendingArchive
versionName_
private · variable · Source (opens in a new tab)
std::string sun::moon_bundling::MoonWriter::versionName_No documentation comment.