Compilerclass
Given a folder of .cs files, this will produce (and load) an assembly
Methods12
Showing 12 methods
public void AddReference(string referenceName)
Add a reference to this compiler. This might be a system dll, or an assembly name from a fellow compiler.
| Parameter | Type | Description |
|---|---|---|
| referenceName | string | — |
void—public void AddSourcePath(string fullPath)
Add an extra source path. Useful for situations where you want to combine multiple addons into one.
| Parameter | Type | Description |
|---|---|---|
| fullPath | string | — |
void—public int DependencyIndex(int depth = 0)
| Parameter | Type | Description |
|---|---|---|
| depth = 0 | int | — |
int—public virtual sealed void Dispose()
void—public Sandbox.Compiler.Configuration GetConfiguration()
public bool HasReference(string referenceName, bool deep = False)
Returns true if `Sandbox.Compiler._references` contains the given reference assembly name. If `deep` is true, referenced compilers are searched too.
| Parameter | Type | Description |
|---|---|---|
| referenceName | string | — |
| deep = False | bool | — |
bool—public void MarkForRecompile()
Recompile this as soon as is appropriate
void—public void NotifyFastHotload(System.Version fastHotloadedVersion)
| Parameter | Type | Description |
|---|---|---|
| fastHotloadedVersion | Version | — |
void—public void SetConfiguration(Sandbox.Compiler.Configuration newConfig)
| Parameter | Type | Description |
|---|---|---|
| newConfig | Configuration | — |
void—public static Microsoft.CodeAnalysis.SyntaxTree StripDisabledTextTrivia(Microsoft.CodeAnalysis.SyntaxTree tree)
Strips out disabled text trivia from the syntax tree. This is stuff like `#if false` blocks that are not compiled.
| Parameter | Type | Description |
|---|---|---|
| tree | SyntaxTree | — |
SyntaxTree—public void UpdateFromArchive(Sandbox.CodeArchive a)
Fill this compiler from a code archive
| Parameter | Type | Description |
|---|---|---|
| a | CodeArchive | — |
void—public void WatchForChanges()
Watch the filesystem for changes to our c# files, and trigger a recompile if they change.
void—No results match this filter.
Properties12
Showing 12 properties
public string Sandbox.Compiler.AssemblyName { get; set; }
Generated assembly name, without an extension. This will be "package.{Name}".
string—public Microsoft.CodeAnalysis.Emit.EmitResult Sandbox.Compiler.BuildResult { get; set; }
Results for the assembly build. This can contain warnings or errors.
EmitResult—public bool Sandbox.Compiler.BuildSuccess { get; set; }
Accesses Output.Successful
bool—public Microsoft.CodeAnalysis.Diagnostic[] Sandbox.Compiler.Diagnostics { get; set; }
A list of warnings and errors created by the last build
Diagnostic[]—public Sandbox.BaseFileSystem Sandbox.Compiler.FileSystem { get; set; }
An aggregate of all the filesystem this compiler has
public System.Text.StringBuilder Sandbox.Compiler.GeneratedCode { get; set; }
Global namespaces
StringBuilder—public Sandbox.CompileGroup Sandbox.Compiler.Group { get; set; }
Each compiler must belong to a compile group
public bool Sandbox.Compiler.IsBuilding { get; set; }
Is this compiler currently building?
bool—public string Sandbox.Compiler.Name { get; set; }
Name of the project this compiler was created for. This could be something like "base" or "org.ident".
string—public bool Sandbox.Compiler.NeedsBuild { get; set; }
Returns true if this compiler is pending a build, or currently building.
bool—public Sandbox.CompilerOutput Sandbox.Compiler.Output { get; set; }
The output from the previous build
public bool Sandbox.Compiler.UseAbsoluteSourcePaths { get; set; }
During development we use absolute source paths so that debugging works better. In a packed/release build it's good to use relative paths instead, just to avoid exposing the builder's file system.
bool—No results match this filter.