コード例 #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>();
    }
コード例 #2
0
 public CustomScriptOptinalUnityAssembly(string displayName, OptionalUnityReferences optionalUnityReferences, string additinalInformationWhenEnabled = "")
     : this()
 {
     DisplayName                     = displayName;
     OptionalUnityReferences         = optionalUnityReferences;
     AdditinalInformationWhenEnabled = additinalInformationWhenEnabled;
 }
コード例 #3
0
 public CustomScriptOptinalUnityAssembly(string displayName, OptionalUnityReferences optionalUnityReferences, string additinalInformationWhenEnabled = "")
 {
     this                                 = default(CustomScriptOptinalUnityAssembly);
     this.DisplayName                     = displayName;
     this.OptionalUnityReferences         = optionalUnityReferences;
     this.AdditinalInformationWhenEnabled = additinalInformationWhenEnabled;
 }
コード例 #4
0
        public static CustomScriptAssembly FromCustomScriptAssemblyData(string path, CustomScriptAssemblyData customScriptAssemblyData)
        {
            CustomScriptAssembly result;

            if (customScriptAssemblyData == null)
            {
                result = null;
            }
            else
            {
                string pathPrefix = path.Substring(0, path.Length - AssetPath.GetFileName(path).Length);
                CustomScriptAssembly customScriptAssembly = new CustomScriptAssembly();
                customScriptAssembly.Name       = customScriptAssemblyData.name;
                customScriptAssembly.References = customScriptAssemblyData.references;
                customScriptAssembly.FilePath   = path;
                customScriptAssembly.PathPrefix = pathPrefix;
                customScriptAssemblyData.optionalUnityReferences = (customScriptAssemblyData.optionalUnityReferences ?? new string[0]);
                string[] optionalUnityReferences = customScriptAssemblyData.optionalUnityReferences;
                for (int i = 0; i < optionalUnityReferences.Length; i++)
                {
                    string value = optionalUnityReferences[i];
                    OptionalUnityReferences optionalUnityReferences2 = (OptionalUnityReferences)Enum.Parse(typeof(OptionalUnityReferences), value);
                    customScriptAssembly.OptionalUnityReferences |= optionalUnityReferences2;
                }
                if (customScriptAssemblyData.includePlatforms != null && customScriptAssemblyData.includePlatforms.Length > 0)
                {
                    customScriptAssembly.IncludePlatforms = (from name in customScriptAssemblyData.includePlatforms
                                                             select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>();
                }
                if (customScriptAssemblyData.excludePlatforms != null && customScriptAssemblyData.excludePlatforms.Length > 0)
                {
                    customScriptAssembly.ExcludePlatforms = (from name in customScriptAssemblyData.excludePlatforms
                                                             select CustomScriptAssembly.GetPlatformFromName(name)).ToArray <CustomScriptAssemblyPlatform>();
                }
                result = customScriptAssembly;
            }
            return(result);
        }