AvailBuilder

class AvailBuilder(val runtime: AvailRuntime)

An AvailBuilder compiles and installs into an Avail runtime a target module and each of its dependencies.

Author

Todd L Smith

Leslie Schultz

Mark van Gulik

Parameters

runtime

The AvailRuntime in which to load modules and execute commands.

Constructors

Link copied to clipboard
constructor(runtime: AvailRuntime)

Construct an AvailBuilder for the provided runtime.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

An EntryPoint represents a compiled command. It is used to disambiguate commands.

Link copied to clipboard
class LoadedModule(val name: ResolvedModuleName, sourceDigest: ByteArray, module: A_Module, version: ModuleVersion, compilation: ModuleCompilation)

A LoadedModule holds state about what the builder knows about a currently loaded Avail module.

Properties

Link copied to clipboard

How to handle problems during a build.

Link copied to clipboard

A Graph of ResolvedModuleNames, representing the relationships between all modules currently loaded or involved in the current build action. Modules are only added here after they have been locally traced successfully.

Link copied to clipboard

A function for polling for abort requests.

Link copied to clipboard

The runtime into which the builder will install the target module and its dependencies.

Link copied to clipboard

true iff the current build should stop, false otherwise.

Link copied to clipboard

The reason why the current build should stop, or null if a stop is not currently requested.

Link copied to clipboard

The text interface for the builder and downstream components.

Functions

Link copied to clipboard
fun attemptCommand(command: String, onAmbiguity: (List<AvailBuilder.CompiledCommand>, (AvailBuilder.CompiledCommand?) -> Unit) -> Unit, onSuccess: (AvailObject, (() -> Unit) -> Unit) -> Unit, onFailure: () -> Unit)

Attempt to unambiguously parse a command. Each currently loaded module that defines at least one entry point takes a shot at parsing the command. If more than one is successful, report the ambiguity via the onFailure continuation. If none are successful, report the failure. If there was exactly one, compile it into a function and invoke it in a new fiber. If the function evaluation succeeds, run the onSuccess continuation with the function's result, except that if the function has static type ⊤ always pass nil instead of the actual value returned by the function. If the function evaluation failed, report the failure.

Link copied to clipboard
fun buildTarget(target: ModuleName, localTracker: CompilerProgressReporter, globalTracker: GlobalProgressReporter, problemHandler: ProblemHandler)

Build the target and its dependencies. Block the current Thread until it's done.

Link copied to clipboard
fun buildTargetThen(target: ModuleName, localTracker: CompilerProgressReporter, globalTracker: GlobalProgressReporter, problemHandler: ProblemHandler, originalAfterAll: () -> Unit)
fun buildTargetThen(targets: Set<ModuleName>, localTracker: CompilerProgressReporter, globalTracker: GlobalProgressReporter, problemHandler: ProblemHandler, originalAfterAll: () -> Unit)

Build the target and its dependencies.

Link copied to clipboard
fun cancel()

Cancel the build at the next convenient stopping point for each module.

Link copied to clipboard

Check any invariants of the builder that should hold when it is idle.

Link copied to clipboard
fun generateDocumentation(target: ModuleName, documentationPath: Path, problemHandler: ProblemHandler)

Generate Stacks documentation for the target and its dependencies.

Link copied to clipboard
fun generateGraph(target: ResolvedModuleName, destinationFile: File, problemHandler: ProblemHandler)

Generate a graph.

Link copied to clipboard

Look up the currently loaded module with the specified resolved module name. Return null if the module is not currently loaded.

Link copied to clipboard

Return a list of modules that are currently loaded. The returned list is a snapshot of the state and does not change due to subsequent loads or unloads.

Link copied to clipboard

Record a new party to notify about module loading and unloading.

Link copied to clipboard
fun traceDirectoriesThen(action: (ResolvedModuleName, ModuleVersion, () -> Unit) -> Unit, afterAll: () -> Unit)

Scan all module files in all visible source directories, passing each ResolvedModuleName and corresponding ModuleVersion to the provided function.

Link copied to clipboard

Unload the target module and its dependents. If null is provided, unload all modules.

Link copied to clipboard

No longer notify the specified party about module loading and unloading.