s&box docs

public sealed class Sandbox.Compiler

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

Broader workflow and conceptual references connected to this API.

Methods

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.

public void AddSourcePath(string fullPath)

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

public virtual sealed void Dispose()

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.

Parameters

  • deep: Default: False

public void MarkForRecompile()

Recompile this as soon as is appropriate

public void NotifyFastHotload(System.Version fastHotloadedVersion)

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.

public void UpdateFromArchive(Sandbox.CodeArchive a)

Fill this compiler from a code archive

public void WatchForChanges()

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

Properties

Showing 12 properties

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

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

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

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

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

Accesses Output.Successful

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

A list of warnings and errors created by the last build

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

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?

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

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

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

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.

Metadata

FieldValue
NamespaceSandbox
Typeclass
AssemblySandbox.Compiling
Doc IDT:Sandbox.Compiler

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