forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnityCodeGenHelpers.cs
More file actions
44 lines (34 loc) · 1.69 KB
/
Copy pathUnityCodeGenHelpers.cs
File metadata and controls
44 lines (34 loc) · 1.69 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
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
using System.Collections.Generic;
namespace UnityEditor.Scripting.ScriptCompilation
{
internal static class UnityCodeGenHelpers
{
const string k_CompilerSuffix = ".Compiler";
const string k_CodeGenSuffix = ".CodeGen";
const string k_CompilerTestsSuffix = ".Compiler.Tests";
const string k_CodeGenTestsSuffix = ".CodeGen.Tests";
const string k_CodeGenPrefix = "Unity.";
public static bool IsCodeGen(string assemblyName)
{
var name = AssetPath.GetAssemblyNameWithoutExtension(assemblyName);
if (name.StartsWith(k_CodeGenPrefix, StringComparison.OrdinalIgnoreCase) && name.EndsWith(k_CompilerSuffix, StringComparison.OrdinalIgnoreCase))
return true;
if (name.StartsWith(k_CodeGenPrefix, StringComparison.OrdinalIgnoreCase) && name.EndsWith(k_CodeGenSuffix, StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
public static bool IsCodeGenTest(string assemblyName)
{
var name = AssetPath.GetAssemblyNameWithoutExtension(assemblyName);
if (name.StartsWith(k_CodeGenPrefix, StringComparison.OrdinalIgnoreCase) && name.EndsWith(k_CompilerTestsSuffix, StringComparison.OrdinalIgnoreCase))
return true;
if (name.StartsWith(k_CodeGenPrefix, StringComparison.OrdinalIgnoreCase) && name.EndsWith(k_CodeGenTestsSuffix, StringComparison.OrdinalIgnoreCase))
return true;
return false;
}
}
}