Beispiel #1
0
    public AsmDefDescription(NPath path, string packageSource)
    {
        Path          = path;
        PackageSource = packageSource;
        Json          = JObject.Parse(path.ReadAllText());

        Name            = Json["name"].Value <string>();
        IncludedAsmRefs = AsmDefConfigFile.AsmRefs.Where(desc => desc.Reference == Name).ToList();

        AllowUnsafeCode    = Json["allowUnsafeCode"]?.Value <bool>() == true;
        AutoReferenced     = Json["autoReferenced"]?.Value <bool>() == true;
        NoEngineReferences = Json["noEngineReferences"]?.Value <bool>() == true;
        OverrideReferences = Json["overrideReferences"]?.Value <bool>() == true;

        DefineConstraints       = Json["defineConstraints"]?.Values <string>().ToArray() ?? Array.Empty <string>();
        OptionalUnityReferences = Json["optionalUnityReferences"]?.Values <string>()?.ToArray() ?? Array.Empty <string>();
        PrecompiledReferences   = Json["precompiledReferences"]?.Values <string>()?.ToArray() ?? Array.Empty <string>();

        IsTestAsmDef = DefineConstraints.Contains("UNITY_INCLUDE_TESTS") || OptionalUnityReferences.Contains("TestAssemblies") || PrecompiledReferences.Contains("nunit.framework.dll");
        IsILPostProcessorAssembly = Name.EndsWith(".CodeGen") && !DefineConstraints.Contains("!NET_DOTS");

        var shouldIgnoreEditorPlatform = IsTestAsmDef || IsILPostProcessorAssembly;

        IncludePlatforms = ReadPlatformList(shouldIgnoreEditorPlatform, Json["includePlatforms"]);
        ExcludePlatforms = ReadPlatformList(shouldIgnoreEditorPlatform, Json["excludePlatforms"]);

        NamedReferences = Json["references"]?.Values <string>().Select(AsmDefConfigFile.GetRealAsmDefName).ToArray() ?? Array.Empty <string>();
    }
Beispiel #2
0
 public bool NeedsEntryPointAdded()
 {
     return(!DefineConstraints.Contains("UNITY_DOTS_ENTRYPOINT") && References.All(r => r.NeedsEntryPointAdded()));
 }