Repository navigation
Expand file tree
/
Copy pathScriptAssemblyDefinitionAsset.cs
More file actions
98 lines (88 loc) · 2.86 KB
/
Copy pathScriptAssemblyDefinitionAsset.cs
File metadata and controls
98 lines (88 loc) · 2.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using Inno.Assets;
using Inno.Extensibility.Types;
using Inno.Core.Serialization;
namespace Inno.Scripting.Compiler;
/// <summary>
/// Defines one project script assembly and its compilation policy.
/// </summary>
[StableTypeId("038c096e-81e9-41dd-a8fb-fd0200ca2acb")]
public sealed class ScriptAssemblyDefinitionAsset : AssetObject
{
/// <summary>
/// Gets the stable assembly name.
/// </summary>
[SerializableProperty]
public string assemblyName { get; private set; } = string.Empty;
/// <summary>
/// Gets the assembly API scope.
/// </summary>
[SerializableProperty]
public ScriptAssemblyScope scope { get; private set; }
/// <summary>
/// Gets referenced script assembly names.
/// </summary>
[SerializableProperty]
public string[] references { get; private set; } = [];
/// <summary>
/// Gets preprocessor symbols applied to this assembly.
/// </summary>
[SerializableProperty]
public string[] defines { get; private set; } = [];
/// <summary>
/// Gets whether nullable reference analysis is enabled.
/// </summary>
[SerializableProperty]
public bool nullable { get; private set; } = true;
/// <summary>
/// Gets whether unsafe source is permitted.
/// </summary>
[SerializableProperty]
public bool allowUnsafe { get; private set; }
/// <summary>
/// Creates an empty definition asset for deserialization.
/// </summary>
public ScriptAssemblyDefinitionAsset()
{
}
/// <summary>
/// Creates a configured script assembly definition for native asset export.
/// </summary>
/// <param name="assemblyName">
/// Stable managed assembly name.
/// </param>
/// <param name="scope">
/// Runtime or Editor API scope.
/// </param>
/// <param name="references">
/// Referenced script assembly names.
/// </param>
/// <param name="defines">
/// Preprocessor symbols.
/// </param>
/// <param name="nullable">
/// Whether nullable reference analysis is enabled.
/// </param>
/// <param name="allowUnsafe">
/// Whether unsafe source is permitted.
/// </param>
/// <exception cref="ArgumentException">
/// Thrown when <paramref name="assemblyName"/> is empty.
/// </exception>
public ScriptAssemblyDefinitionAsset(
string assemblyName,
ScriptAssemblyScope scope,
string[]? references = null,
string[]? defines = null,
bool nullable = true,
bool allowUnsafe = false
) {
ArgumentException.ThrowIfNullOrWhiteSpace(assemblyName);
this.assemblyName = assemblyName;
this.scope = scope;
this.references = references is null ? [] : [.. references];
this.defines = defines is null ? [] : [.. defines];
this.nullable = nullable;
this.allowUnsafe = allowUnsafe;
}
}