Api Sandbox Compiler
class

Compiler

public sealed class Compiler

Given a folder of .cs files, this will produce (and load) an assembly

Properties

Name Type Description
Group CompileGroup Each compiler must belong to a compile group
Output CompilerOutput The output from the previous build
IsBuilding Boolean Is this compiler currently building?
NeedsBuild Boolean Returns true if this compiler is pending a build, or currently building.
Name String Name of the project this compiler was created for. This could be something like "base" or "org.ident".
UseAbsoluteSourcePaths Boolean 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.
Diagnostics Diagnostic[] A list of warnings and errors created by the last build
AssemblyName String Generated assembly name, without an extension. This will be "package.{Name}".
GeneratedCode StringBuilder Global namespaces
FileSystem BaseFileSystem An aggregate of all the filesystem this compiler has
BuildResult EmitResult Results for the assembly build. This can contain warnings or errors.
BuildSuccess Boolean Accesses Output.Successful

Methods

Void UpdateFromArchive(CodeArchive a)

Fill this compiler from a code archive

Void AddSourcePath(String fullPath)

Add an extra source path. Useful for situations where you want to combine multiple addons into one.

Void SetConfiguration(Configuration newConfig)
Configuration GetConfiguration()
Void NotifyFastHotload(Version fastHotloadedVersion)
virtual Void Dispose()
Int32 DependencyIndex(Int32 depth = 0)
Void MarkForRecompile()

Recompile this as soon as is appropriate

Void AddReference(String referenceName)

Add a reference to this compiler. This might be a system dll, or an assembly name from a fellow compiler.

Boolean HasReference(String referenceName, Boolean deep = False)

Returns true if _references contains the given reference assembly name. If is true, referenced compilers are searched too.

static SyntaxTree StripDisabledTextTrivia(SyntaxTree tree)

Strips out disabled text trivia from the syntax tree. This is stuff like `#if false` blocks that are not compiled.

tree
Void WatchForChanges()

Watch the filesystem for changes to our c# files, and trigger a recompile if they change.

Assembly: Sandbox.Compiling Namespace: Sandbox Full Name: Sandbox.Compiler