public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
 {
     string[] moduleNames = ModuleMetadata.GetModuleNames();
     for (int i = 0; i < moduleNames.Length; i++)
     {
         string text = moduleNames[i];
         ModuleIncludeSetting moduleIncludeSettingForModule = ModuleMetadata.GetModuleIncludeSettingForModule(text);
         if (moduleIncludeSettingForModule == ModuleIncludeSetting.ForceInclude)
         {
             nativeModules.Add(text);
             UnityType[] moduleTypes = ModuleMetadata.GetModuleTypes(text);
             UnityType[] array       = moduleTypes;
             for (int j = 0; j < array.Length; j++)
             {
                 UnityType unityType = array[j];
                 nativeClasses.Add(unityType);
                 if (strippingInfo != null)
                 {
                     strippingInfo.RegisterDependency(unityType.name, "Force included module");
                     strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), unityType.name);
                 }
             }
             if (strippingInfo != null)
             {
                 strippingInfo.RegisterDependency(StrippingInfo.ModuleName(text), "Force included module");
             }
         }
         else if (moduleIncludeSettingForModule == ModuleIncludeSetting.ForceExclude)
         {
             if (nativeModules.Contains(text))
             {
                 nativeModules.Remove(text);
                 UnityType[] moduleTypes2 = ModuleMetadata.GetModuleTypes(text);
                 UnityType[] array2       = moduleTypes2;
                 for (int k = 0; k < array2.Length; k++)
                 {
                     UnityType item = array2[k];
                     if (nativeClasses.Contains(item))
                     {
                         nativeClasses.Remove(item);
                     }
                 }
                 if (strippingInfo != null)
                 {
                     strippingInfo.modules.Remove(StrippingInfo.ModuleName(text));
                 }
             }
         }
     }
 }
示例#2
0
        public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
        {
            if (AssemblyStripper.UseUnityLinkerEngineModuleStripping)
            {
                throw new NotSupportedException("Don't want to rely on this method when UnityLinker EMS is used");
            }

            // Apply manual stripping overrides
            foreach (var module in ModuleMetadata.GetModuleNames())
            {
                var includeSetting = ModuleMetadata.GetModuleIncludeSettingForModule(module);
                if (includeSetting == ModuleIncludeSetting.ForceInclude)
                {
                    nativeModules.Add(module);
                    if (nativeClasses != null)
                    {
                        var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                        foreach (var klass in moduleClasses)
                        {
                            nativeClasses.Add(klass);
                            if (strippingInfo != null)
                            {
                                strippingInfo.RegisterDependency(klass.name, "Force included module");
                                strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), klass.name);
                            }
                        }
                    }

                    if (strippingInfo != null)
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), "Force included module");
                    }
                }
                else if (includeSetting == ModuleIncludeSetting.ForceExclude)
                {
                    if (nativeModules.Contains(module))
                    {
                        nativeModules.Remove(module);

                        if (strippingInfo != null)
                        {
                            strippingInfo.modules.Remove(StrippingInfo.ModuleName(module));
                        }
                    }
                }
            }
        }
        public static void ApplyManualStrippingOverrides(HashSet <UnityType> nativeClasses, HashSet <string> nativeModules, StrippingInfo strippingInfo)
        {
            // Apply manual stripping overrides
            foreach (var module in ModuleMetadata.GetModuleNames())
            {
                var includeSetting = ModuleMetadata.GetModuleIncludeSettingForModule(module);
                if (includeSetting == ModuleIncludeSetting.ForceInclude)
                {
                    nativeModules.Add(module);
                    var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                    foreach (var klass in moduleClasses)
                    {
                        nativeClasses.Add(klass);
                        if (strippingInfo != null)
                        {
                            strippingInfo.RegisterDependency(klass.name, "Force included module");
                            strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), klass.name);
                        }
                    }

                    if (strippingInfo != null)
                    {
                        strippingInfo.RegisterDependency(StrippingInfo.ModuleName(module), "Force included module");
                    }
                }
                else if (includeSetting == ModuleIncludeSetting.ForceExclude)
                {
                    if (nativeModules.Contains(module))
                    {
                        nativeModules.Remove(module);
                        var moduleClasses = ModuleMetadata.GetModuleTypes(module);
                        foreach (var klass in moduleClasses)
                        {
                            if (nativeClasses.Contains(klass))
                            {
                                nativeClasses.Remove(klass);
                            }
                        }

                        if (strippingInfo != null)
                        {
                            strippingInfo.modules.Remove(StrippingInfo.ModuleName(module));
                        }
                    }
                }
            }
        }