Skip to content
Project referenceDevelopmentEngine ccf7d03f
Authored
  • SDK-bound script compilation, logical API projection and immutable candidate artifacts.

The compiler owns Roslyn compilation, trimmed reference assemblies, logical namespace diagnostics, source fingerprints, IDE projects and immutable Runtime/Editor script artifacts. It does not own the active assembly generation and is not part of Player execution.

Use the scripts command for ordinary authoring. Compilation architecture explains how IDE facades and real CLR emission agree.

The host must supply ScriptCompilerOptions.compilationEnvironment. Each compile or projection operation captures one ScriptCompilationInputs: the selected SDK identity, actual framework references and SDK-defined conditional symbols. Collections are copied and read-only; reference bytes are frozen before Roslyn uses them.

The compiler does not select the newest installed reference pack, invoke Build/MSBuild itself or change user SDK configuration. The standard host supplies SdkScriptCompilationEnvironment through the existing SDK resolver and owned process/temporary-file mechanisms. Missing inputs, evaluation failure and cancellation fail before publication.

An API-shape fingerprint is different from an artifact identity. The latter also includes actual framework reference contents, compiler/emitter identity and language options. Unchanged API signatures do not authorize reusing an artifact from different compiler inputs.

Prepare caches and complete generations in private staging under the owning Library. Publish to a missing destination atomically, or transactionally replace a verified invalid cache. Reuse an already valid complete cache. Cancellation propagates through publication; failure before commit preserves or restores the previous directory.

Filesystem blocking beyond Core IO’s bounded wait fails explicitly. If old-directory cleanup fails after a complete new cache commits, compilation still reports the IO failure and does not activate a generation. If installation and restoration both fail, preserve both errors and the previous-tree location. A later explicit request can validate a complete artifact; it cannot retroactively turn the earlier failure into success.

CollectArtifacts retains the directories still reachable by active sessions. Cache cleanup, generation activation and temporary staging retirement have distinct owners; do not delete an active generation to force recompilation.

An owner-frame loop can validate an isolated sample import before committing its source transaction. The caller retains the transaction and compiler through validation, commit or cancellation cleanup. The validation callback compiles the supplied frozen source candidate; it must not activate a generation.

using System;
using Inno.Assets.Pipeline;
using Inno.Scripting.Compiler;
static bool AdvanceSampleImport(
AssetSampleImportTransaction import,
ScriptCompiler compiler,
ref bool validationStarted
) {
if (!validationStarted)
{
if (!import.Advance())
return false;
import.BeginValidation(async (
sources,
cancellationToken
) =>
{
ScriptCompilationResult result = await compiler.CompileAuthoringGenerationAsync(
cancellationToken: cancellationToken, sourceSnapshot: sources).ConfigureAwait(false);
if (!result.success)
throw new InvalidOperationException("Sample validation failed.");
});
validationStarted = true;
}
if (!import.isValidationComplete)
return false;
import.Commit();
return true;
}

The function advances one already owned import; its false result means the operation needs another owner-frame opportunity, not that the transaction failed. Handle exceptions and dispose the transaction through its actual owner. See sample import for source activation and rollback boundaries.

Browse exact types and members.

Project: Inno.Scripting.Compiler
Source: src/runtime/scripting/Inno.Scripting.Compiler/Inno.Scripting.Compiler.csproj

Type API Description
CSharpSampleSourceRewriter engine Gives imported C# sample scripts distinct type identities before their scene assets are remapped.
IScriptCompilationEnvironmentProvider engine Supplies the host-selected framework contract for one compilation or IDE projection operation.
LogicalScriptingApiAnalyzer engine Enforces logical scripting namespaces and rejects direct implementation namespace access.
ScriptAssemblyDefinitionAsset engine Defines one project script assembly and its compilation policy.
ScriptAssemblyScope engine Identifies whether a project script assembly can use editor-only APIs.
ScriptCompilationInputs engine Describes framework references and predefined symbols selected by the authoring host’s SDK.
ScriptCompilationProgress engine Describes monotonic progress through one script compilation.
ScriptCompilationResult engine Reports the outputs and diagnostics of one authoring-generation or runtime-deployment script compilation.
ScriptCompilationStageTiming engine Describes the elapsed wall time of one completed script compilation stage.
ScriptCompiler engine Produces deterministic runtime and editor script artifacts from one authoring snapshot.
ScriptCompilerOptions engine Identifies the project and derived-cache locations used by one script compiler.
ScriptDiagnostic engine Represents one source-oriented script compilation diagnostic.
ScriptModuleDeployment engine Describes the immutable assembly artifacts and dependency topology of one compiled script module. The receiving host chooses how these artifacts enter its module catalog.
ScriptSourceAsset engine Describes an imported C# source snapshot and its parse diagnostics.