-
Notifications
You must be signed in to change notification settings - Fork 17
Compilation Tags
#Compilation Tags
Compilation Tags may be added to source code, as comments, to further specify code generation and compilation options.
###Downloading Tags:
The following tags specify the external source code files, assemblies and other dependencies needed for compilation. Note: The REPL, by default, uses CSharp_FastCompiler to compile scripts. However if more than one source file is specified compilation is performed by CompileEngine.
| Tag | Description |
|---|---|
| //WorkOffline | Indicates the compiler doesn't need to load referenced assemblies. It overrides other tags. |
| //O2Tag_OnlyAddReferencedAssemblies | must begin first line of code. clears all references and forces explicit referencing via //O2Ref |
| //O2Ref:{filePath} | specifies a required referenced assembly |
| //O2Download:{filePath} | NON-FUNCTIONAL. specifies a file to download |
| //02Dir:{directoryPath} | includes source of all .cs files in directory, recursively, ignoring git directories, in compilation |
| //NuGet:{name} | forces download of nuget package |
Local Script Folders is the term for the folders searched by
CompileEngine.findFileOnLocalScriptFolder. These are searched for the files specified by the tag argument.
- DI
LocalScriptsFolder
-
CompileEngine.LocalFoldersToAddToFileMappings(recursive) CompileEngine.LocalFoldersToSearchForCodeFilesEnvironment.CurrentDirectory-
ExecutingAssemblyparentFolder -
CallingAssemblyparentFolder -
EntryAssemblyparentFolder - DI
ToolsOrApis
###Code Generation Tags:
| Tag | Description |
|---|---|
| //O2Include:{fileName} | the comment line is replaced with the contents of the file, if found. |
| //DontSetInvocationParametersToDynamic | does not generate dynamic types in generated source |
| //using {namespace} | injects using statement |
| //generateDebugSymbols | generates source files for compiled code |
###REPL Threading Tags
The REPL maintains a continuously generated Assembly which has a single class with a single public method whose source is the REPL CLI stack. The threading of Compilation of the REPL Assembly is modified by the O2 compilation tags, //StaThread and //MtaThread.
- StaThread executes compilation on a STA thread (see STA threading and COM and WindowsForms interactions)
- MtaThread executes compilation on an MTA thread
- not providing a tag executes compilation as a regular delegate invoke
| Tag | Description |
|---|---|
| //StaThread | executes compilation on a STA thread |
| //MtaThread | MtaThread executes compilation on an MTA thread |