Compilerclass

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

objectCompiler
Namespace
Sandbox
Assembly
Sandbox.Compiling
Declaration
public sealed class Sandbox.Compiler

Methods12

Showing 12 methods

public void AddReference(string referenceName)PUBLIC

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

ParameterTypeDescription
referenceNamestring
Returns:void

public void AddSourcePath(string fullPath)PUBLIC

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

ParameterTypeDescription
fullPathstring
Returns:void

public int DependencyIndex(int depth = 0)PUBLIC

ParameterTypeDescription
depth = 0int
Returns:int

public virtual sealed void Dispose()PUBLICVIRTUAL

Returns:void

public bool HasReference(string referenceName, bool deep = False)PUBLIC

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

ParameterTypeDescription
referenceNamestring
deep = Falsebool
Returns:bool

public void MarkForRecompile()PUBLIC

Recompile this as soon as is appropriate

Returns:void

public void NotifyFastHotload(System.Version fastHotloadedVersion)PUBLIC

ParameterTypeDescription
fastHotloadedVersionVersion
Returns:void

public static Microsoft.CodeAnalysis.SyntaxTree StripDisabledTextTrivia(Microsoft.CodeAnalysis.SyntaxTree tree)PUBLICSTATIC

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

ParameterTypeDescription
treeSyntaxTree
Returns:SyntaxTree

public void UpdateFromArchive(Sandbox.CodeArchive a)PUBLICPER-FRAME

Fill this compiler from a code archive

ParameterTypeDescription
aCodeArchive
Returns:void

public void WatchForChanges()PUBLIC

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

Returns:void

Properties12

Showing 12 properties

public string Sandbox.Compiler.AssemblyName { get; set; }PUBLICGETSET

Generated assembly name, without an extension. This will be "package.{Name}".

Returns:string

public Microsoft.CodeAnalysis.Emit.EmitResult Sandbox.Compiler.BuildResult { get; set; }PUBLICGETSET

Results for the assembly build. This can contain warnings or errors.

Returns:EmitResult

public bool Sandbox.Compiler.BuildSuccess { get; set; }PUBLICGETSET

Accesses Output.Successful

Returns:bool

public Microsoft.CodeAnalysis.Diagnostic[] Sandbox.Compiler.Diagnostics { get; set; }PUBLICGETSET

A list of warnings and errors created by the last build

Returns:Diagnostic[]

public System.Text.StringBuilder Sandbox.Compiler.GeneratedCode { get; set; }PUBLICGETSET

Global namespaces

Returns:StringBuilder

public bool Sandbox.Compiler.IsBuilding { get; set; }PUBLICGETSET

Is this compiler currently building?

Returns:bool

public string Sandbox.Compiler.Name { get; set; }PUBLICGETSET

Name of the project this compiler was created for. This could be something like "base" or "org.ident".

Returns:string

public bool Sandbox.Compiler.NeedsBuild { get; set; }PUBLICGETSET

Returns true if this compiler is pending a build, or currently building.

Returns:bool

public bool Sandbox.Compiler.UseAbsoluteSourcePaths { get; set; }PUBLICGETSET

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.

Returns:bool

On this page

Methodspublic System.Void AddReference(System.String referenceName)public System.Void AddSourcePath(System.String fullPath)public System.Int32 DependencyIndex(System.Int32 depth = 0)public virtual sealed System.Void Dispose()public Sandbox.Compiler.Configuration GetConfiguration()public System.Boolean HasReference(System.String referenceName, System.Boolean deep = False)public System.Void MarkForRecompile()public System.Void NotifyFastHotload(System.Version fastHotloadedVersion)public System.Void SetConfiguration(Sandbox.Compiler.Configuration newConfig)public static Microsoft.CodeAnalysis.SyntaxTree StripDisabledTextTrivia(Microsoft.CodeAnalysis.SyntaxTree tree)public System.Void UpdateFromArchive(Sandbox.CodeArchive a)public System.Void WatchForChanges()Propertiespublic System.String Sandbox.Compiler.AssemblyName { get; set; }public Microsoft.CodeAnalysis.Emit.EmitResult Sandbox.Compiler.BuildResult { get; set; }public System.Boolean Sandbox.Compiler.BuildSuccess { get; set; }public Microsoft.CodeAnalysis.Diagnostic[] Sandbox.Compiler.Diagnostics { get; set; }public Sandbox.BaseFileSystem Sandbox.Compiler.FileSystem { get; set; }public System.Text.StringBuilder Sandbox.Compiler.GeneratedCode { get; set; }public Sandbox.CompileGroup Sandbox.Compiler.Group { get; set; }public System.Boolean Sandbox.Compiler.IsBuilding { get; set; }public System.String Sandbox.Compiler.Name { get; set; }public System.Boolean Sandbox.Compiler.NeedsBuild { get; set; }public Sandbox.CompilerOutput Sandbox.Compiler.Output { get; set; }public System.Boolean Sandbox.Compiler.UseAbsoluteSourcePaths { get; set; }Metadata