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
constructor(fileManager: FileManager, modulePath: String, withFailures: (List<String>) -> Unit)

Construct a new ModuleRoots from the specified Avail roots path.

Properties

Link copied to clipboard

The associated FileManager.

Link copied to clipboard

The Avail module path.

Link copied to clipboard

The module roots in the order that they are specified in the Avail module 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

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
inline fun <T, R> Iterable<T>.mapToSet(destination: MutableSet<R> = mutableSetOf(), transform: (T) -> R): MutableSet<R>

Transform the receiver via the supplied function and collect the results into an optionally provided set. Answer the result set.

Link copied to clipboard

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

Link copied to clipboard

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
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.