ModuleRoots

class ModuleRoots(    val fileManager: FileManager,     modulePath: String,     withFailures: (List<String>) -> Unit) : Iterable<ModuleRoot>

ModuleRoots encapsulates the Avail module path. The Avail module path specifies bindings between logical root names and locations of Avail modules. A logical root name should typically belong to a vendor of Avail modules, ergo a domain name or registered trademark suffices nicely.

The format of an Avail module path is described by the following simple grammar:

modulePath ::= binding ++ ";" ;
binding ::= logicalRoot "=" objectRepository ("," sourceDirectory) ;
logicalRoot ::= [^=;]+ ;
objectRepository ::= [^;]+ ;
sourceDirectory ::= [^;]+ ;

logicalRoot represents a logical root name. objectRepository represents the absolute path of a binary module repository. sourceDirectory represents the absolute path of a package, i.e., a directory containing source modules, and may be sometimes be omitted (e.g., when compilation is not required).

Author

Todd L Smith

Richard Arriaga

Parameters

fileManager

The associated FileManager.

modulePath

An Avail module path.

withFailures

A lambda that accepts List of the string ModuleRoots that failed to resolve.

Throws

If the Avail module path is malformed.

Constructors

Link copied to clipboard
fun ModuleRoots(    fileManager: FileManager,     modulePath: String,     withFailures: (List<String>) -> Unit)

Construct a new ModuleRoots from the specified Avail roots path.

Functions

Link copied to clipboard
fun addRoot(    rootName: String,     location: String,     withFailures: (List<String>) -> Unit)

Create and add a root to the rootMap.

Link copied to clipboard
fun clearRoots()

Clear the root map.

Link copied to clipboard
open fun forEach(p0: Consumer<in ModuleRoot>)
Link copied to clipboard
open operator override fun iterator(): Iterator<ModuleRoot>
Link copied to clipboard
fun moduleRootFor(rootName: String): ModuleRoot?

Answer the module root bound to the specified logical root name.

Link copied to clipboard
fun moduleRootTreesThen(withResults: (List<ResolverReference>, List<Triple<String, ErrorCode, Throwable?>>) -> Unit)

Retrieve all of the root ResolverReferences for each ModuleRoot in this ModuleRoots and pass them to the provided function.

Link copied to clipboard
fun removeRoot(name: String)

Fully remove the provided ModuleRoot.name.

Link copied to clipboard
open fun spliterator(): Spliterator<ModuleRoot>
Link copied to clipboard
fun writeOn(writer: JSONWriter)

Write a JSON encoding of the module roots to the specified JSONWriter.

Link copied to clipboard
fun writePathsOn(writer: JSONWriter)

Write a JSON object whose fields are the module roots and whose values are JSON arrays containing path information.

Properties

Link copied to clipboard
val fileManager: FileManager

The associated FileManager.

Link copied to clipboard
val modulePath: String

The Avail module path.

Link copied to clipboard
val roots: Set<ModuleRoot>

The module roots in the order that they are specified in the Avail module path.