forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathScriptAssembly.cs
More file actions
114 lines (97 loc) · 4.48 KB
/
Copy pathScriptAssembly.cs
File metadata and controls
114 lines (97 loc) · 4.48 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEditor.Scripting.Compilers;
using UnityEditor.Compilation;
using UnityEditor.Modules;
namespace UnityEditor.Scripting.ScriptCompilation
{
// Settings that would be common for a group of ScriptAssembly's created for the same build target.
class ScriptAssemblySettings
{
public BuildTarget BuildTarget { get; set; }
public BuildTargetGroup BuildTargetGroup { get; set; }
public int Subtarget { get; set; }
public string OutputDirectory { get; set; }
public EditorScriptCompilationOptions CompilationOptions { get; set; }
public ScriptCompilerOptions PredefinedAssembliesCompilerOptions { get; set; }
public string[] ExtraGeneralDefines { get; set; }
public string[] AdditionalCompilerArguments { get; set; }
public ICompilationExtension CompilationExtension { get; set; }
public string ProjectRootNamespace { get; set; }
public string ProjectDirectory { get; set; } = ".";
public CodeOptimization EditorCodeOptimization { get; set; }
public ScriptAssemblySettings()
{
BuildTarget = BuildTarget.NoTarget;
BuildTargetGroup = BuildTargetGroup.Unknown;
Subtarget = 0;
PredefinedAssembliesCompilerOptions = new ScriptCompilerOptions();
ExtraGeneralDefines = new string[0];
AdditionalCompilerArguments = new string[0];
}
public bool BuildingForEditor
{
get { return (CompilationOptions & EditorScriptCompilationOptions.BuildingForEditor) == EditorScriptCompilationOptions.BuildingForEditor; }
}
public bool BuildingDevelopmentBuild
{
get { return (CompilationOptions & EditorScriptCompilationOptions.BuildingDevelopmentBuild) == EditorScriptCompilationOptions.BuildingDevelopmentBuild; }
}
public CodeOptimization CodeOptimization
{
get { return BuildingForEditor ? EditorCodeOptimization : BuildingDevelopmentBuild? CodeOptimization.Debug : CodeOptimization.Release; }
}
public bool BuildingWithoutScriptUpdater
{
get { return (CompilationOptions & EditorScriptCompilationOptions.BuildingWithoutScriptUpdater) == EditorScriptCompilationOptions.BuildingWithoutScriptUpdater; }
}
}
[DebuggerDisplay("{Filename}")]
class ScriptAssembly
{
public string OriginPath { get; set; }
public AssemblyFlags Flags { get; set; }
public BuildTarget BuildTarget { get; set; }
public string Filename { get; set; }
public string OutputDirectory { get; set; }
/// <summary>
/// References to dependencies that will be built.
/// </summary>
public ScriptAssembly[] ScriptAssemblyReferences { get; set; }
/// <summary>
///References to dependencies that that will *not* be built.
/// </summary>
public string[] References { get; set; }
public string[] Defines { get; set; }
public string[] Files { get; set; }
public string RootNamespace { get; set; }
public ScriptCompilerOptions CompilerOptions { get; set; }
public string GeneratedResponseFile { get; set; }
// Indicates whether the assembly had compile errors on last compilation
public bool HasCompileErrors { get; set; }
internal TargetAssemblyType TargetAssemblyType { get; set; }
public string AsmDefPath { get; set; }
public ScriptAssembly()
{
CompilerOptions = new ScriptCompilerOptions();
}
public string FullPath { get { return AssetPath.Combine(OutputDirectory, Filename); } }
public string[] GetAllReferences()
{
return References.Concat(ScriptAssemblyReferences.Select(a => a.FullPath)).ToArray();
}
public IEnumerable<ScriptAssembly> AllRecursiveScripAssemblyReferencesIncludingSelf() =>
ScriptAssemblyReferences
.SelectMany(a => a.AllRecursiveScripAssemblyReferencesIncludingSelf())
.Concat(new[] {this});
public string[] GetResponseFiles()
{
return new MicrosoftCSharpResponseFileProvider().Get(OriginPath).ToArray();
}
public bool SkipCodeGen { get; set; }
}
}