GetUserAssemblies() private static method

private static GetUserAssemblies ( string strippedAssemblyDir ) : string[]
strippedAssemblyDir string
return string[]
Ejemplo n.º 1
0
 public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules)
 {
     string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir);
     nativeClasses = !PlayerSettings.stripEngineCode ? (HashSet <string>)null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies);
     if (nativeClasses != null)
     {
         CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses);
     }
     nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses);
     if (nativeClasses != null && icallsListFile != null)
     {
         HashSet <string> modulesFromIcalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile);
         int classId = BaseObjectTools.StringToClassID("GlobalGameManager");
         using (HashSet <string> .Enumerator enumerator = modulesFromIcalls.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 foreach (int moduleClass in ModuleMetadata.GetModuleClasses(enumerator.Current))
                 {
                     if (BaseObjectTools.IsDerivedFromClassID(moduleClass, classId))
                     {
                         nativeClasses.Add(BaseObjectTools.ClassIDToString(moduleClass));
                     }
                 }
             }
         }
         nativeModules.UnionWith((IEnumerable <string>)modulesFromIcalls);
     }
     new AssemblyReferenceChecker().CollectReferencesFromRoots(strippedAssemblyDir, (IEnumerable <string>)userAssemblies, true, 0.0f, true);
 }
Ejemplo n.º 2
0
        public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules)
        {
            string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir);
            nativeClasses = ((!PlayerSettings.stripEngineCode) ? null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies));
            if (nativeClasses != null)
            {
                CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses);
            }
            nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses);
            if (nativeClasses != null && icallsListFile != null)
            {
                HashSet <string> modulesFromICalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile);
                int derivedFromClassID             = BaseObjectTools.StringToClassID("GlobalGameManager");
                foreach (string current in modulesFromICalls)
                {
                    int[] moduleClasses = ModuleMetadata.GetModuleClasses(current);
                    int[] array         = moduleClasses;
                    for (int i = 0; i < array.Length; i++)
                    {
                        int num = array[i];
                        if (BaseObjectTools.IsDerivedFromClassID(num, derivedFromClassID))
                        {
                            nativeClasses.Add(BaseObjectTools.ClassIDToString(num));
                        }
                    }
                }
                nativeModules.UnionWith(modulesFromICalls);
            }
            AssemblyReferenceChecker assemblyReferenceChecker = new AssemblyReferenceChecker();

            assemblyReferenceChecker.CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true);
        }
Ejemplo n.º 3
0
        public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, out HashSet <string> nativeClasses, out HashSet <string> nativeModules, BuildReport buildReport)
        {
            StrippingInfo buildReportData = StrippingInfo.GetBuildReportData(buildReport);

            string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir);
            nativeClasses = ((!PlayerSettings.stripEngineCode) ? null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies, buildReportData));
            if (nativeClasses != null)
            {
                CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses);
            }
            nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses, buildReportData);
            if (nativeClasses != null && icallsListFile != null)
            {
                HashSet <string> modulesFromICalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile);
                foreach (string current in modulesFromICalls)
                {
                    if (!nativeModules.Contains(current) && buildReportData != null)
                    {
                        buildReportData.RegisterDependency(current, "Required by Scripts");
                    }
                    int[] moduleClasses = ModuleMetadata.GetModuleClasses(current);
                    int[] array         = moduleClasses;
                    for (int i = 0; i < array.Length; i++)
                    {
                        int num = array[i];
                        if (BaseObjectTools.IsDerivedFromClassID(num, CodeStrippingUtils.gameManagerClassId))
                        {
                            string text = BaseObjectTools.ClassIDToString(num);
                            nativeClasses.Add(text);
                            if (buildReportData != null)
                            {
                                buildReportData.RegisterDependency(text, "Required by Module");
                            }
                        }
                    }
                }
                nativeModules.UnionWith(modulesFromICalls);
            }
            AssemblyReferenceChecker assemblyReferenceChecker = new AssemblyReferenceChecker();

            assemblyReferenceChecker.CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true);
            if (buildReportData != null)
            {
                foreach (string current2 in nativeModules)
                {
                    buildReportData.AddModule(current2);
                }
                buildReportData.AddModule("Core");
            }
        }
Ejemplo n.º 4
0
        public static void GenerateDependencies(string strippedAssemblyDir, string icallsListFile, RuntimeClassRegistry rcr, bool doStripping, out HashSet <UnityType> nativeClasses, out HashSet <string> nativeModules, IIl2CppPlatformProvider platformProvider)
        {
            StrippingInfo strippingInfo = (platformProvider != null) ? StrippingInfo.GetBuildReportData(platformProvider.buildReport) : null;

            string[] userAssemblies = CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir);
            nativeClasses = ((!doStripping) ? null : CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, userAssemblies, strippingInfo));
            if (nativeClasses != null)
            {
                CodeStrippingUtils.ExcludeModuleManagers(ref nativeClasses);
            }
            nativeModules = CodeStrippingUtils.GetNativeModulesToRegister(nativeClasses, strippingInfo);
            if (nativeClasses != null && icallsListFile != null)
            {
                HashSet <string> modulesFromICalls = CodeStrippingUtils.GetModulesFromICalls(icallsListFile);
                foreach (string current in modulesFromICalls)
                {
                    if (!nativeModules.Contains(current))
                    {
                        if (strippingInfo != null)
                        {
                            strippingInfo.RegisterDependency(StrippingInfo.ModuleName(current), "Required by Scripts");
                        }
                    }
                    UnityType[] moduleTypes = ModuleMetadata.GetModuleTypes(current);
                    UnityType[] array       = moduleTypes;
                    for (int i = 0; i < array.Length; i++)
                    {
                        UnityType unityType = array[i];
                        if (unityType.IsDerivedFrom(CodeStrippingUtils.GameManagerTypeInfo))
                        {
                            nativeClasses.Add(unityType);
                        }
                    }
                }
                nativeModules.UnionWith(modulesFromICalls);
            }
            bool flag = true;

            if (platformProvider != null)
            {
                while (flag)
                {
                    flag = false;
                    foreach (string current2 in nativeModules.ToList <string>())
                    {
                        string moduleWhitelist = CodeStrippingUtils.GetModuleWhitelist(current2, platformProvider.moduleStrippingInformationFolder);
                        if (File.Exists(moduleWhitelist))
                        {
                            foreach (string current3 in CodeStrippingUtils.GetDependentModules(moduleWhitelist))
                            {
                                if (!nativeModules.Contains(current3))
                                {
                                    nativeModules.Add(current3);
                                    flag = true;
                                }
                                if (strippingInfo != null)
                                {
                                    string text = StrippingInfo.ModuleName(current2);
                                    strippingInfo.RegisterDependency(StrippingInfo.ModuleName(current3), "Required by " + text);
                                    if (strippingInfo.icons.ContainsKey(text))
                                    {
                                        strippingInfo.SetIcon("Required by " + text, strippingInfo.icons[text]);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            AssemblyReferenceChecker assemblyReferenceChecker = new AssemblyReferenceChecker();

            assemblyReferenceChecker.CollectReferencesFromRoots(strippedAssemblyDir, userAssemblies, true, 0f, true);
            if (strippingInfo != null)
            {
                foreach (string current4 in nativeModules)
                {
                    strippingInfo.AddModule(StrippingInfo.ModuleName(current4));
                }
                strippingInfo.AddModule(StrippingInfo.ModuleName("Core"));
            }
            if (nativeClasses != null && strippingInfo != null)
            {
                CodeStrippingUtils.InjectCustomDependencies(platformProvider.target, strippingInfo, nativeClasses, nativeModules);
            }
        }
Ejemplo n.º 5
0
        public static void WriteModuleAndClassRegistrationFile(string strippedAssemblyDir, string outputDir, RuntimeClassRegistry rcr)
        {
            HashSet <string> hashSet = (PlayerSettings.strippingLevel != StrippingLevel.Disabled) ? CodeStrippingUtils.GenerateNativeClassList(rcr, strippedAssemblyDir, CodeStrippingUtils.GetUserAssemblies(strippedAssemblyDir)) : null;

            if (hashSet != null)
            {
                CodeStrippingUtils.ExcludeModuleManagers(ref hashSet);
            }
            HashSet <string> nativeModules = (hashSet != null) ? CodeStrippingUtils.GetRequiredStrippableModules(hashSet) : CodeStrippingUtils.GetAllStrippableModules();
            string           file          = Path.Combine(outputDir, "UnityClassRegistration.cpp");

            CodeStrippingUtils.WriteModuleAndClassRegistrationFile(file, nativeModules, hashSet);
        }