Class CompilationContextBuilder
Provides a fluent API for creating objects of type CompilationContext.
public class CompilationContextBuilder
- Inheritance
-
CompilationContextBuilder
- Inherited Members
- Extension Methods
Methods
AddSourceDirectory(string, bool)
Adds a directory containing Dassie source files to the compilation context.
public CompilationContextBuilder AddSourceDirectory(string path, bool recursive)
Parameters
pathstringThe path to the directory to add.
recursiveboolWheter to include source files from subdirectories.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
- ArgumentException
- ArgumentNullException
- ArgumentOutOfRangeException
- PathTooLongException
- DirectoryNotFoundException
- IOException
- UnauthorizedAccessException
AddSourceDocument(SourceDocument)
Adds a SourceDocument to the compilation context.
public CompilationContextBuilder AddSourceDocument(SourceDocument document)
Parameters
documentSourceDocumentThe document to add.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
AddSourceDocuments(IEnumerable<SourceDocument>)
Adds multiple SourceDocuments to the compilation context.
public CompilationContextBuilder AddSourceDocuments(IEnumerable<SourceDocument> documents)
Parameters
documentsIEnumerable<SourceDocument>The documents to add.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
AddSourceFile(string)
Adds Dassie source code from a file to the compilation context.
public CompilationContextBuilder AddSourceFile(string path)
Parameters
pathstringThe source file to add.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
- ArgumentException
- ArgumentNullException
- PathTooLongException
- DirectoryNotFoundException
- IOException
- UnauthorizedAccessException
- FileNotFoundException
- NotSupportedException
- SecurityException
AddSourceFiles(IEnumerable<string>)
Adds multiple Dassie source files to the compilation context.
public CompilationContextBuilder AddSourceFiles(IEnumerable<string> files)
Parameters
filesIEnumerable<string>The source files to add.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
- ArgumentException
- ArgumentNullException
- PathTooLongException
- DirectoryNotFoundException
- IOException
- UnauthorizedAccessException
- FileNotFoundException
- NotSupportedException
- SecurityException
AddSourceFromText(string)
Adds a string of Dassie source code to the compilation context.
public CompilationContextBuilder AddSourceFromText(string text)
Parameters
textstringThe source code to add.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
AddSourceFromText(string, string)
Adds a string of Dassie source code to the compilation context.
public CompilationContextBuilder AddSourceFromText(string text, string symbolicName)
Parameters
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
Build()
Builds a CompilationContext object with the specified data.
public CompilationContext Build()
Returns
- CompilationContext
A new instance of CompilationContext.
CreateBuilder()
Initializes a new compilation context builder.
public static CompilationContextBuilder CreateBuilder()
Returns
- CompilationContextBuilder
A new instance of CompilationContextBuilder.
RedirectCompilerMessages(Func<Severity, TextWriter>)
Allows redirecting compiler messages to any TextWriter.
public CompilationContextBuilder RedirectCompilerMessages(Func<Severity, TextWriter> messageResolver)
Parameters
messageResolverFunc<Severity, TextWriter>A resolver function that returns the TextWriter to write compiler messages to based on the severity of an error.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
WithConfiguration(DassieConfig)
Sets the compiler configuration for the compilation context.
public CompilationContextBuilder WithConfiguration(DassieConfig config)
Parameters
configDassieConfigThe configuration to use.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.
Exceptions
WithConfiguration(string)
Adds the compiler configuration for the compilation context from an XML configuration file.
public CompilationContextBuilder WithConfiguration(string configFile)
Parameters
configFilestringThe path to the configuration file.
Returns
- CompilationContextBuilder
The current instance of CompilationContextBuilder.