Skip to content

Latest commit

 

History

History
318 lines (282 loc) · 66.8 KB

Inno.Scripting.Compiler.md

File metadata and controls

318 lines (282 loc) · 66.8 KB

Inno.Scripting.Compiler

SDK 输入与 IDE 一致性

ScriptCompilerOptions.compilationEnvironment 是 Host 必须提供的 IScriptCompilationEnvironmentProvider。一次编译或投影只捕获一次 ScriptCompilationInputs,其中保存选定 SDK 身份、实际 framework references 与 SDK 生成的预定义符号。集合复制后只读;编译器在进入 Roslyn 前读取并冻结引用内容,内容哈希参与产物身份。

编译器不选择已安装 reference pack 的最高版本,也不引用 Build、MSBuild 或平台工程。标准 Host 使用 Build 的 SdkScriptCompilationEnvironment,复用现有 SDK resolver、进程执行及 Core IO 临时 owner。求值失败或取消会明确失败,不发布脚本产物,不改写用户 SDK 配置。

IDE 投影显式引用同一组 framework assemblies,并使用同一组符号。SDK 的隐式 framework references 与隐式符号注入关闭;目标仍为正常的 net10.0 SDK 工程。实际 IDE SDK 与捕获身份不一致时报告错误,要求在预期 SDK 选择下重新生成投影。

Authoring 标注与 Player 边界

编译器根据 ScriptingApiScope.Authoring 的导出清单,在语义绑定后、目标 Player references 绑定前移除纯创作标注使用、自定义派生标注类及相关 using。规则由清单与继承符号推导,不依赖标注的具体实现,也没有属性类型白名单。创作编译与 IDE 保留完整标注 API;Player IL 不保留纯创作标注引用。普通 SerializableProperty 不在此 scope,继续表达持久化契约。

Scripting 索引 · API · Reload

职责与边界

引擎与项目脚本使用 .NET 10、C# 14。运行时编译、源导入和 IDE 工程明确选择相同语言版本;IDE 工程由支持 .NET 10 的 Rider 或 Visual Studio 2026 使用所选 SDK 编译。内置 logical namespace analyzer 也运行于该 .NET 10 编译器宿主。

生成的 IDE 工程独立声明编译输入,并在 SDK 导入前禁用父目录的 Directory.Build.props/targets,保持与引擎编译一致的语言、引用和 Analyzer 契约。引擎仓库的 Solution 还原与 Task owner 规则只作用于根 InnoEngine.sln,不接管子目录中的 Project Solution。

Compiler 拥有 Roslyn、裁剪 reference assemblies、logical namespace analyzer、source fingerprint、runtime/editor artifact 和编译进度。它不拥有 active assembly generation,也不进入 Player。

内部实现:每次编译或 IDE 投影固定本次 framework metadata、编译器身份和语言选项。公开契约指纹描述 API 形状;产物指纹同时包含实际 framework reference 内容、Roslyn 与 emitter 身份及选项。相同契约在编译输入变化时仍选择独立产物,失败或取消不能发布不完整 reference。该缓存身份不是公开持久化协议。

程序集缓存和完整 generation 先在所属 Library 的私有 staging 中准备,再复用 Core IO 的 AtomicDirectory.Publish 发布到不存在的目标,或用 AtomicDirectory.Install 替换经校验无效的已有缓存。有效完整缓存直接复用;失效目标不能先用 best-effort 递归删除来替代事务。编译取消 token 贯穿发布,提交前失败或取消保留/恢复已有目录;临时 staging 清理与已发布产物替换是不同责任。Compiler 不添加平台分支、独立 retry 或另一套文件所有权管理器。

文件系统阻塞超过 Core 的既定有界等待后明确失败。安装后旧目录清理失败时,新缓存已完整提交,但编译操作仍报告 IO 失败且不激活 generation;调用方必须区分完整缓存与已激活运行代际。安装和恢复同时失败保留两次异常及旧树位置。下一次显式请求可以重新校验并复用完整产物,不能把失败转成静默成功。

用户源码先对与 IDE 相同的裁剪契约完成编译检查。只有通过后,生成注册代码的 emission 阶段才读取所属运行时程序集的完整元数据;这些实现引用不扩展用户 API,也不加入 IDE project。该顺序允许生成序列化访问和模块目录,同时继续拒绝标有 ScriptingApiIgnore 的成员。发行代码绑定所选 Support Pack,Editor 代码绑定当前 authoring Host。 框架参考程序集由本次 IScriptCompilationEnvironmentProvider 捕获的冻结输入明确提供;Compiler 不从安装根或候选 pack 中自行选择。标准 SDK Host 的求值、发布 Host 的输入准备和编译器的消费分别属于各自 owner,缺失输入必须在编译前明确失败。 生成实现侧 reference assembly 时以 Ref Pack 的程序集身份排除框架实现,不能按 DLL 所在目录判断:自包含 Editor 将引擎和 .NET DLL 放在同一目录,按目录过滤会在首次生成脚本 API 缓存时误删引擎依赖。

公开 API

  • ScriptCompiler, ScriptCompilerOptions:一次 fresh compilation 的入口与 project context;CompileAuthoringGenerationAsync(progress, cancellationToken, sourceSnapshot) 生成 Runtime + Editor 的可激活候选;可选 IAssetSourceSnapshot 是 owner 捕获编译输入的只读候选视图,省略时读取当前 Plugin compilation view,CompileRuntimeDeploymentAsync(targetRuntimeDirectory, ...) 只生成 Player 所需 Runtime closure,并将生成结果绑定到指定 Support Pack 的真实运行时程序集。
  • ScriptCompilationResult, ScriptCompilationProgress, ScriptCompilationStageTiming:确定性结果、阶段和 timing。
  • ScriptModuleDeployment:编译结果中的不可变模块产物描述,包含程序集路径、所属 domain/scope、程序集 scope 和显式模块依赖;集合复制后只读。ScriptCompilationResult.moduleDeployments 不携带加载器、ALC 或可执行回调。组合入口决定如何将这些产物激活到 ModuleHost。
  • ScriptDiagnostic, ScriptDiagnosticSeverity:源码定位诊断。
  • ScriptSourceAsset, ScriptAssemblyDefinitionAsset, ScriptAssemblyScope:由 common Asset Pipeline 导入的脚本模型。
  • LogicalScriptingApiAnalyzer:拒绝实现 namespace、global using 和未导出 API。

同一裁剪 reference 规则用于 authoring generation、runtime deployment 与 IDE project。Runtime deployment 先用当前裁剪 API 和 analyzer 验证逻辑 namespace、可见性与脚本规则,再把改写后的源码直接针对目标 Support Pack 的 Inno.* 实现程序集编译;目标程序集内容指纹属于增量缓存键,因此更换或修改 Pack 不会复用不兼容脚本产物。IDE 只为 Project 的 Runtime、Editor 和显式 .iasmdef assembly 生成源码工程;Project 工程之间通过 ProjectReference 连接。安装 Plugin 的源码按同一逻辑 API reference 图编译成 Library/IDE/PluginReferences 中的 metadata reference,供 Project 工程引用,不在 Project 根目录生成 Plugin 工程。这样 Plugin 类型的基类与用户源码中的 InnoEngine.* 类型属于同一引用图,不会把运行时代的 Inno.* 实现程序集泄漏到 IDE。Game Build 只调用 runtime deployment 入口,不解析 Editor API reference、不编译 .editor.cs,也不生成 Inno.EditorScripts.dll。取消或失败结果没有 activation artifact;缓存命中仍重放诊断。

Shader 创作扩展通过 InnoEditor.Rendering.Shaders 的逐类型 Editor scope 清单进入同一规则, 不在 Compiler 中增加 Shader 类型或程序集白名单。新增集成用例实际编译节点扩展,并读取生成 IDE reference 的公开 metadata: Editor 可见 IShaderNodeCompiler,Runtime 不可见;Runtime 脚本直接引用该命名空间必须编译失败。

Project Assets 的 ~ 目录是普通 authoring content,其中的 .cs 与 .iasmdef 进入 authoring generation 和 IDE project;runtime deployment 始终剔除该子树。只读 .iplugin Mount 中的 ~ 目录是 .isample,其脚本编译到独立的作者端临时程序集,供安装态样例场景的 Editor Play 使用,不进入插件运行程序集和 Player。Import Sample 完整保留原目录名和全部前导 ~,可写副本进入 Project authoring/Play 编译,仍从 runtime deployment 排除;CSharpSampleSourceRewriter 在导入事务的后台 stage 内用 Roslyn 重写显式 StableTypeId,并登记新旧类型身份供场景引用重映射;逐文件响应共同取消 token,不访问 live Editor state。

Compiler 为每个产物写入 Inno.AssetSource assembly metadata。Project assembly 写入 project,Plugin assembly 写入 manifest Plugin ID。编译和 IDE project 共用源码路径映射,将 CallerFilePath 编译为 <sourceId>::./<asset-local-path>;Assets.LocalPath 通过调用点的该字面量解析同源资源,不依赖 JIT、调用栈或调用者程序集反射。路径中的逗号和等号按 Roslyn PathMap 规则转义,使业务源码在 Project 开发态、安装态、CoreCLR 和 AOT 中保持一致。

脚本编译、generation 激活和 IDE 投影是有顺序但不同的责任。只有完整 Runtime + Editor + Plugin 候选编译成功后才能激活;IDE project 在激活成功后生成。IDE 文件写入失败只发布 INNO-IDE-PROJECTION Warning,不允许回滚或阻止已经验证成功的运行 generation。

实现与逻辑 reference 均从公开成员的 nullable metadata 生成可空类型,包括参数、返回值、字段、属性、事件、数组元素与嵌套泛型实参。生成期间的 NullabilityInfoContext 在结束时释放,不进入跨代缓存;这些注解属于已有公共契约内容指纹,改变注解会产生新的 API 缓存身份。不能在调用方用 null! 掩盖投影遗失的可空契约。

Sample 等输入事务持有共同 generation read lease 时,ScriptReloadHost.TryCompilePending 使用 GenerationCoordinator 的非阻塞准入检查:保留请求并返回 false,事务释放后再编译。Compiler 本身不判断 Sample 或平台类型,候选快照与活动快照复用同一个 source discovery / reference / Roslyn 链。

编译入口只在 owner thread 捕获 Asset/Plugin 源快照,随后明确把 API reference 生成、Roslyn、缓存读写与产物写入调度到后台。该边界同时用于 authoring 与 runtime deployment,不依赖 File.ReadAllTextAsync 恰好产生未完成 await;进度 observer 必须接受 owner/worker 回调。取消后调用方仍须等待返回操作 drain,再释放 generation 与源事务。 Reference 生成的串行准入及 Roslyn parse/emit 也接收本次取消 token;取消或生成失败清理未发布的临时 reference 文件,已完成的不可变 reference cache 可以继续复用。

Sample 候选编译

Frame owner 在源准备完成后启动编译验证,成功后才提交源事务。调用方持有 transaction 和 compiler 到验证、提交或取消清理全部完成;禁止在 callback 中激活候选 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;
}

当前源码公开 API 清单

此清单对应当前 SDK 求值与源码符号;内部类型不构成公开 API。

API 与源码 契约与参数 返回值 重要异常
public sealed class Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset : Inno.Assets.AssetObject Defines one project script assembly and its compilation policy. — —
public string Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.assemblyName { get; private set; } Gets the stable assembly name. — —
public Inno.Scripting.Compiler.ScriptAssemblyScope Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.scope { get; private set; } Gets the assembly API scope. — —
public string[] Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.references { get; private set; } Gets referenced script assembly names. — —
public string[] Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.defines { get; private set; } Gets preprocessor symbols applied to this assembly. — —
public bool Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.nullable { get; private set; } Gets whether nullable reference analysis is enabled. — —
public bool Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.allowUnsafe { get; private set; } Gets whether unsafe source is permitted. — —
public Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.ScriptAssemblyDefinitionAsset() Creates an empty definition asset for deserialization. — —
public Inno.Scripting.Compiler.ScriptAssemblyDefinitionAsset.ScriptAssemblyDefinitionAsset(string assemblyName, Inno.Scripting.Compiler.ScriptAssemblyScope scope, string[]? references = null, string[]? defines = null, bool nullable = true, bool allowUnsafe = false) Creates a configured script assembly definition for native asset export.
assemblyName: Stable managed assembly name.
scope: Runtime or Editor API scope.
references: Referenced script assembly names.
defines: Preprocessor symbols.
nullable: Whether nullable reference analysis is enabled.
allowUnsafe: Whether unsafe source is permitted.
— System.ArgumentException: Thrown when is empty.
public enum Inno.Scripting.Compiler.ScriptAssemblyScope : int Identifies whether a project script assembly can use editor-only APIs. — —
Inno.Scripting.Compiler.ScriptAssemblyScope.Runtime = 0 The assembly can use runtime scripting APIs only. — —
Inno.Scripting.Compiler.ScriptAssemblyScope.Editor = 1 The assembly can use runtime and editor scripting APIs. — —
public sealed class Inno.Scripting.Compiler.ScriptSourceAsset : Inno.Assets.AssetObject Describes an imported C# source snapshot and its parse diagnostics. — —
public Inno.Scripting.Compiler.ScriptAssemblyScope Inno.Scripting.Compiler.ScriptSourceAsset.scope { get; private set; } Gets the default assembly scope inferred for the source. — —
public string[] Inno.Scripting.Compiler.ScriptSourceAsset.declaredTypeNames { get; private set; } Gets syntax-level type names declared by the source. — —
public string[] Inno.Scripting.Compiler.ScriptSourceAsset.parseDiagnostics { get; private set; } Gets parse diagnostics associated with the source snapshot. — —
public Inno.Scripting.Compiler.ScriptSourceAsset.ScriptSourceAsset() Creates an empty script source asset for deserialization. — —
public sealed class Inno.Scripting.Compiler.CSharpSampleSourceRewriter : Inno.Assets.Pipeline.IAssetSampleSourceRewriter Gives imported C# sample scripts distinct type identities before their scene assets are remapped. — —
public void Inno.Scripting.Compiler.CSharpSampleSourceRewriter.Transform(Inno.Assets.Pipeline.AssetSampleTransformContext context) Rewrites explicit stable type identities in cloned C# scripts and registers their asset mappings.
context: The private sample import stage and its identity map.
— —
public Inno.Scripting.Compiler.CSharpSampleSourceRewriter.CSharpSampleSourceRewriter() Inherited or compiler-provided contract. — —
public sealed class Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer : Microsoft.CodeAnalysis.Diagnostics.DiagnosticAnalyzer Enforces logical scripting namespaces and rejects direct implementation namespace access. — —
public const string Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.directImplementationNamespaceDiagnosticId = "INNO2001" Diagnostic identifier for direct implementation namespace access. — —
public const string Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.missingLogicalNamespaceDiagnosticId = "INNO2002" Diagnostic identifier for a missing logical namespace import. — —
public const string Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.compilationWideUsingDiagnosticId = "INNO2003" Diagnostic identifier for a forbidden compilation-wide namespace import. — —
public override System.Collections.Immutable.ImmutableArray<Microsoft.CodeAnalysis.DiagnosticDescriptor> Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.SupportedDiagnostics { get; } Gets the complete compiler diagnostic set enforced by this analyzer. — —
public override void Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.Initialize(Microsoft.CodeAnalysis.Diagnostics.AnalysisContext context) Initializes owned resources and establishes the instance's active lifetime.
context: The context that supplies state and services for this operation.
— —
public Inno.Scripting.Compiler.LogicalScriptingApiAnalyzer.LogicalScriptingApiAnalyzer() Inherited or compiler-provided contract. — —
public sealed class Inno.Scripting.Compiler.ScriptCompilationResult Reports the outputs and diagnostics of one authoring-generation or runtime-deployment script compilation. — —
public bool Inno.Scripting.Compiler.ScriptCompilationResult.success { get; } Gets whether every discovered script assembly compiled or reused successfully. — —
public System.Collections.Generic.IReadOnlyList<Inno.Scripting.Compiler.ScriptDiagnostic> Inno.Scripting.Compiler.ScriptCompilationResult.diagnostics { get; } Gets all diagnostics produced by the compilation. — —
public string? Inno.Scripting.Compiler.ScriptCompilationResult.outputDirectory { get; } Gets the generation output directory when one was created. — —
public System.Collections.Generic.IReadOnlyList<Inno.Scripting.Compiler.ScriptCompilationStageTiming> Inno.Scripting.Compiler.ScriptCompilationResult.stageTimings { get; } Gets completed compiler stage timings in execution order. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptCompilationResult.runtimeAssemblyPaths { get; } Gets exact runtime-scope managed assemblies suitable for a deployed Player. — —
public System.Collections.Generic.IReadOnlyList<Inno.Scripting.Compiler.ScriptModuleDeployment> Inno.Scripting.Compiler.ScriptCompilationResult.moduleDeployments { get; } Gets the immutable module artifacts and dependency topology produced by this compilation. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptCompilationResult.compiledAssemblyNames { get; } Gets assembly names compiled during this request instead of reused from the artifact cache. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptCompilationResult.reusedAssemblyNames { get; } Gets assembly names reused from the deterministic artifact cache. — —
public static Inno.Scripting.Compiler.ScriptCompilationResult Inno.Scripting.Compiler.ScriptCompilationResult.Failure(Inno.Scripting.Compiler.ScriptDiagnostic diagnostic) Creates a failed result for an exception intercepted at an orchestration boundary.
diagnostic: The diagnostic describing why no candidate generation was produced.
A failed immutable result with no output directory or module deployments. —
public readonly record struct Inno.Scripting.Compiler.ScriptCompilationStageTiming : System.IEquatable<Inno.Scripting.Compiler.ScriptCompilationStageTiming> Describes the elapsed wall time of one completed script compilation stage. — —
public Inno.Scripting.Compiler.ScriptCompilationStageTiming.ScriptCompilationStageTiming(string stage, System.TimeSpan elapsed) Creates one immutable stage timing sample.
stage: The human-readable stage description.
elapsed: The wall time spent in the stage.
— System.ArgumentException: Thrown when is empty or contains only whitespace.
System.ArgumentOutOfRangeException: Thrown when is negative.
public string Inno.Scripting.Compiler.ScriptCompilationStageTiming.stage { get; } Gets the human-readable stage description. — —
public System.TimeSpan Inno.Scripting.Compiler.ScriptCompilationStageTiming.elapsed { get; } Gets the wall time spent in the stage. — —
public override string Inno.Scripting.Compiler.ScriptCompilationStageTiming.ToString() Returns the fully qualified type name of this instance. The fully qualified type name. —
public static bool Inno.Scripting.Compiler.ScriptCompilationStageTiming.operator !=(Inno.Scripting.Compiler.ScriptCompilationStageTiming left, Inno.Scripting.Compiler.ScriptCompilationStageTiming right) Inherited or compiler-provided contract. — —
public static bool Inno.Scripting.Compiler.ScriptCompilationStageTiming.operator ==(Inno.Scripting.Compiler.ScriptCompilationStageTiming left, Inno.Scripting.Compiler.ScriptCompilationStageTiming right) Inherited or compiler-provided contract. — —
public override int Inno.Scripting.Compiler.ScriptCompilationStageTiming.GetHashCode() Returns the hash code for this instance. A 32-bit signed integer that is the hash code for this instance. —
public override bool Inno.Scripting.Compiler.ScriptCompilationStageTiming.Equals(object obj) Indicates whether this instance and a specified object are equal.
obj: The object to compare with the current instance.
if and this instance are the same type and represent the same value; otherwise, . —
public bool Inno.Scripting.Compiler.ScriptCompilationStageTiming.Equals(Inno.Scripting.Compiler.ScriptCompilationStageTiming other) Indicates whether the current object is equal to another object of the same type.
other: An object to compare with this object.
if the current object is equal to the parameter; otherwise, . —
public sealed record Inno.Scripting.Compiler.ScriptDiagnostic : System.IEquatable<Inno.Scripting.Compiler.ScriptDiagnostic> Represents one source-oriented script compilation diagnostic.
id: The stable compiler, analyzer, or reload diagnostic identifier.
severity: The presentation severity of the diagnostic.
message: The human-readable diagnostic message.
filePath: The source path associated with the diagnostic, or for a project-level diagnostic.
line: The one-based source line, or zero when no source location is available.
column: The one-based source column, or zero when no source location is available.
— —
public Inno.Scripting.Compiler.ScriptDiagnostic.ScriptDiagnostic(string id, Inno.Core.Diagnostics.DiagnosticSeverity severity, string message, string? filePath, int line, int column) Represents one source-oriented script compilation diagnostic.
id: The stable compiler, analyzer, or reload diagnostic identifier.
severity: The presentation severity of the diagnostic.
message: The human-readable diagnostic message.
filePath: The source path associated with the diagnostic, or for a project-level diagnostic.
line: The one-based source line, or zero when no source location is available.
column: The one-based source column, or zero when no source location is available.
— —
public string Inno.Scripting.Compiler.ScriptDiagnostic.id { get; init; } The stable compiler, analyzer, or reload diagnostic identifier. — —
public Inno.Core.Diagnostics.DiagnosticSeverity Inno.Scripting.Compiler.ScriptDiagnostic.severity { get; init; } The presentation severity of the diagnostic. — —
public string Inno.Scripting.Compiler.ScriptDiagnostic.message { get; init; } The human-readable diagnostic message. — —
public string? Inno.Scripting.Compiler.ScriptDiagnostic.filePath { get; init; } The source path associated with the diagnostic, or for a project-level diagnostic. — —
public int Inno.Scripting.Compiler.ScriptDiagnostic.line { get; init; } The one-based source line, or zero when no source location is available. — —
public int Inno.Scripting.Compiler.ScriptDiagnostic.column { get; init; } The one-based source column, or zero when no source location is available. — —
public override string Inno.Scripting.Compiler.ScriptDiagnostic.ToString() Returns a string that represents the current object. A string that represents the current object. —
public static bool Inno.Scripting.Compiler.ScriptDiagnostic.operator !=(Inno.Scripting.Compiler.ScriptDiagnostic? left, Inno.Scripting.Compiler.ScriptDiagnostic? right) Inherited or compiler-provided contract. — —
public static bool Inno.Scripting.Compiler.ScriptDiagnostic.operator ==(Inno.Scripting.Compiler.ScriptDiagnostic? left, Inno.Scripting.Compiler.ScriptDiagnostic? right) Inherited or compiler-provided contract. — —
public override int Inno.Scripting.Compiler.ScriptDiagnostic.GetHashCode() Serves as the default hash function. A hash code for the current object. —
public override bool Inno.Scripting.Compiler.ScriptDiagnostic.Equals(object? obj) Determines whether the specified object is equal to the current object.
obj: The object to compare with the current object.
if the specified object is equal to the current object; otherwise, . —
public bool Inno.Scripting.Compiler.ScriptDiagnostic.Equals(Inno.Scripting.Compiler.ScriptDiagnostic? other) Indicates whether the current object is equal to another object of the same type.
other: An object to compare with this object.
if the current object is equal to the parameter; otherwise, . —
public void Inno.Scripting.Compiler.ScriptDiagnostic.Deconstruct(out string id, out Inno.Core.Diagnostics.DiagnosticSeverity severity, out string message, out string? filePath, out int line, out int column) Inherited or compiler-provided contract. — —
public sealed class Inno.Scripting.Compiler.ScriptModuleDeployment Describes the immutable assembly artifacts and dependency topology of one compiled script module. The receiving host chooses how these artifacts enter its module catalog. — —
public string Inno.Scripting.Compiler.ScriptModuleDeployment.moduleName { get; } Gets the logical module name used to resolve dependencies within this compiled generation. — —
public string Inno.Scripting.Compiler.ScriptModuleDeployment.mainAssemblyPath { get; } Gets the absolute path of the module's primary assembly artifact. — —
public Inno.Extensibility.Modules.AssemblyDomain Inno.Scripting.Compiler.ScriptModuleDeployment.domain { get; } Gets the ownership domain of this module's assemblies. — —
public Inno.Extensibility.Modules.AssemblyScope Inno.Scripting.Compiler.ScriptModuleDeployment.scope { get; } Gets the dependency scope used for assemblies without an explicit scope override. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptModuleDeployment.preloadAssemblyPaths { get; } Gets the additional assembly artifacts that belong to this same module generation. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptModuleDeployment.upstreamModuleNames { get; } Gets the logical names of modules that supply managed dependencies to this module. — —
public System.Collections.Generic.IReadOnlyDictionary<string, Inno.Extensibility.Modules.AssemblyScope> Inno.Scripting.Compiler.ScriptModuleDeployment.assemblyScopes { get; } Gets explicit scopes keyed by assembly simple name, with case-insensitive lookup. — —
public interface Inno.Scripting.Compiler.IScriptCompilationEnvironmentProvider Supplies the host-selected framework contract for one compilation or IDE projection operation. — —
Inno.Scripting.Compiler.ScriptCompilationInputs Inno.Scripting.Compiler.IScriptCompilationEnvironmentProvider.Capture(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) Captures current SDK inputs without choosing a framework inside the scripting compiler.
cancellationToken: Cancels input preparation before any script artifact is published.
Complete immutable inputs; missing or inconsistent SDK inputs must fail explicitly. —
public sealed class Inno.Scripting.Compiler.ScriptCompilationInputs Describes framework references and predefined symbols selected by the authoring host's SDK. — —
public Inno.Scripting.Compiler.ScriptCompilationInputs.ScriptCompilationInputs(string sdkIdentity, System.Collections.Generic.IEnumerable<string> frameworkReferences, System.Collections.Generic.IEnumerable<string> predefinedSymbols) Freezes a complete C# 14 and .NET 10 reference contract without retaining SDK objects.
sdkIdentity: The exact SDK identity that evaluated this contract.
frameworkReferences: Absolute framework assembly paths selected by SDK reference resolution.
predefinedSymbols: Framework and configuration symbols produced by SDK target execution.
— System.ArgumentException: The identity, reference set or a reference path is invalid.
System.ArgumentNullException: A collection is null.
public string Inno.Scripting.Compiler.ScriptCompilationInputs.sdkIdentity { get; } Gets the exact SDK identity used for IDE consistency checks and artifact identity. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptCompilationInputs.frameworkReferences { get; } Gets the SDK-selected framework paths, whose content is frozen before Roslyn compilation. — —
public System.Collections.Generic.IReadOnlyList<string> Inno.Scripting.Compiler.ScriptCompilationInputs.predefinedSymbols { get; } Gets SDK-produced symbols shared by runtime compilation and IDE projects. — —
public readonly record struct Inno.Scripting.Compiler.ScriptCompilationProgress : System.IEquatable<Inno.Scripting.Compiler.ScriptCompilationProgress> Describes monotonic progress through one script compilation.
fraction: The completed fraction in the inclusive range from zero to one.
stage: The current human-readable compiler stage.
— —
public Inno.Scripting.Compiler.ScriptCompilationProgress.ScriptCompilationProgress(float fraction, string stage) Describes monotonic progress through one script compilation.
fraction: The completed fraction in the inclusive range from zero to one.
stage: The current human-readable compiler stage.
— —
public float Inno.Scripting.Compiler.ScriptCompilationProgress.fraction { get; init; } The completed fraction in the inclusive range from zero to one. — —
public string Inno.Scripting.Compiler.ScriptCompilationProgress.stage { get; init; } The current human-readable compiler stage. — —
public override string Inno.Scripting.Compiler.ScriptCompilationProgress.ToString() Returns the fully qualified type name of this instance. The fully qualified type name. —
public static bool Inno.Scripting.Compiler.ScriptCompilationProgress.operator !=(Inno.Scripting.Compiler.ScriptCompilationProgress left, Inno.Scripting.Compiler.ScriptCompilationProgress right) Inherited or compiler-provided contract. — —
public static bool Inno.Scripting.Compiler.ScriptCompilationProgress.operator ==(Inno.Scripting.Compiler.ScriptCompilationProgress left, Inno.Scripting.Compiler.ScriptCompilationProgress right) Inherited or compiler-provided contract. — —
public override int Inno.Scripting.Compiler.ScriptCompilationProgress.GetHashCode() Returns the hash code for this instance. A 32-bit signed integer that is the hash code for this instance. —
public override bool Inno.Scripting.Compiler.ScriptCompilationProgress.Equals(object obj) Indicates whether this instance and a specified object are equal.
obj: The object to compare with the current instance.
if and this instance are the same type and represent the same value; otherwise, . —
public bool Inno.Scripting.Compiler.ScriptCompilationProgress.Equals(Inno.Scripting.Compiler.ScriptCompilationProgress other) Indicates whether the current object is equal to another object of the same type.
other: An object to compare with this object.
if the current object is equal to the parameter; otherwise, . —
public void Inno.Scripting.Compiler.ScriptCompilationProgress.Deconstruct(out float fraction, out string stage) Inherited or compiler-provided contract. — —
public sealed class Inno.Scripting.Compiler.ScriptCompiler Produces deterministic runtime and editor script artifacts from one authoring snapshot. — —
public Inno.Scripting.Compiler.ScriptCompiler.ScriptCompiler(Inno.Scripting.Compiler.ScriptCompilerOptions options, Inno.Assets.Pipeline.AssetPipeline assets, Inno.Plugins.Authoring.PluginEnvironment plugins) Creates a compiler over explicit authoring services owned by one host.
options: The project and derived-cache locations used by compilation.
assets: The authoring asset pipeline supplying committed source artifacts.
plugins: The Plugin environment supplying the candidate Plugin source generation.
— System.ArgumentNullException: Thrown when an owner argument is .
System.ArgumentException: Thrown when the project root is empty.
public void Inno.Scripting.Compiler.ScriptCompiler.GenerateProjectFiles() Regenerates IDE project files from the current source graph and logical API references. — System.InvalidOperationException: Thrown when the authoring asset pipeline is not initialized.
public System.Threading.Tasks.ValueTask<Inno.Scripting.Compiler.ScriptCompilationResult> Inno.Scripting.Compiler.ScriptCompiler.CompileAuthoringGenerationAsync(System.IProgress<Inno.Scripting.Compiler.ScriptCompilationProgress>? progress = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken), Inno.Assets.Pipeline.IAssetSourceSnapshot? sourceSnapshot = null) Compiles a complete runtime and editor candidate generation without activating it.
progress: Optional observer for monotonic compiler progress.
cancellationToken: The token that cancels compilation before an artifact generation is committed.
sourceSnapshot: Optional isolated authoring sources. Capture on its owner thread and keep its transaction alive until compilation drains; null selects the current Plugin candidate or active sources.
约束:Source discovery captures live inputs on the owner thread. Reference generation, Roslyn and artifact writes run in the background; progress observers must accept callbacks from either thread. Retain the source generation until the returned operation drains, including after cancellation. Complete cache trees use Core IO atomic publication and replacement. A committed cache remains valid if cleanup of its previous tree fails; compilation does not activate either generation.
The immutable diagnostics and artifacts produced by the compilation attempt. System.OperationCanceledException: Thrown when cancellationToken is canceled.
System.IO.IOException: Artifact publication fails, or cleanup fails after a complete cache tree commits.
System.UnauthorizedAccessException: The filesystem continues denying artifact access after the bounded Core IO wait.
System.AggregateException: Cache replacement and restoration both fail; the exception identifies the preserved previous tree.
public System.Threading.Tasks.ValueTask<Inno.Scripting.Compiler.ScriptCompilationResult> Inno.Scripting.Compiler.ScriptCompiler.CompileRuntimeDeploymentAsync(string targetRuntimeDirectory, System.IProgress<Inno.Scripting.Compiler.ScriptCompilationProgress>? progress = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) Compiles only the runtime assembly closure required by a deployed Player and binds it to that Player runtime.
targetRuntimeDirectory: The verified Player Support Pack directory whose runtime assemblies will execute the emitted scripts.
progress: Optional observer for monotonic compiler progress.
cancellationToken: The token that cancels compilation before an artifact generation is committed.
约束:Complete cache trees use Core IO atomic publication and replacement. Cancellation before commit preserves the previous tree; cancellation does not undo a committed cache. Cleanup failure after commit preserves the installed tree and remaining backup without activating a generation.
The immutable diagnostics and runtime-only artifacts produced by the compilation attempt. System.OperationCanceledException: Thrown when cancellationToken is canceled.
System.ArgumentException: Thrown when targetRuntimeDirectory is empty.
System.IO.DirectoryNotFoundException: Thrown when targetRuntimeDirectory does not exist.
System.IO.InvalidDataException: Thrown when the target runtime has no valid Inno runtime assembly closure.
System.IO.IOException: Artifact publication fails, or cleanup fails after a complete cache tree commits.
System.UnauthorizedAccessException: The filesystem continues denying artifact access after the bounded Core IO wait.
System.AggregateException: Cache replacement and restoration both fail; the exception identifies the preserved previous tree.
public int Inno.Scripting.Compiler.ScriptCompiler.CollectArtifacts(System.Collections.Generic.IEnumerable<string?> retainedDirectories) Removes unreferenced compiler generations while retaining the supplied active directories.
retainedDirectories: The generation directories that remain reachable from active runtime sessions.
The number of obsolete generation directories removed from the compiler cache. —
public sealed class Inno.Scripting.Compiler.ScriptCompilerOptions Identifies the project and derived-cache locations used by one script compiler. — —
public required string Inno.Scripting.Compiler.ScriptCompilerOptions.projectRootDirectory { get; init; } Gets the project root containing Assets and Library. — —
public required Inno.Scripting.Compiler.IScriptCompilationEnvironmentProvider Inno.Scripting.Compiler.ScriptCompilerOptions.compilationEnvironment { get; init; } Gets the host-owned source of SDK framework inputs for each operation. — —
public Inno.Scripting.Compiler.ScriptCompilerOptions.ScriptCompilerOptions() Inherited or compiler-provided contract. — —

项目依赖

工程 边界
Inno.Core.Collections 实现依赖;不传递 compile surface
Inno.Core.IO 实现依赖;不传递 compile surface
Inno.Extensibility.Modules 公开签名依赖
Inno.Scripting.Api 实现依赖;不传递 compile surface
Inno.Assets 公开签名依赖
Inno.Assets.Pipeline 公开签名依赖
Inno.Plugins.Authoring 公开签名依赖
Inno.Core.Diagnostics 公开签名依赖
Inno.Runtime.Generators 实现依赖;不传递 compile surface
Inno.Core.Serialization.Generators 实现依赖;不传递 compile surface