Exemple #1
0
 private static void SetImportSettings(BuildTarget platform, string[] assemblyPaths, OdinAssemblyImportSettings importSettings)
 {
     foreach (var path in assemblyPaths)
     {
         AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, path, importSettings);
     }
 }
        public static void OnPreprocessBuild()
        {
            var scriptingBackend  = AssemblyImportSettingsUtilities.GetCurrentScriptingBackend();
            var activeBuildTarget = EditorUserBuildSettings.activeBuildTarget;
            var compileForAOT     = scriptingBackend == ScriptingImplementation.IL2CPP || !AssemblyImportSettingsUtilities.JITPlatforms.Contains(activeBuildTarget);

            // The EditorOnly dll should aways have the same import settings. But lets just make sure.
            AssemblyImportSettingsUtilities.SetAssemblyImportSettings(EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

            if (compileForAOT)
            {
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
            }
            else
            {
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
            }

            if (compileForAOT)
            {
                // Generates dll that contains all serialized generic type variants needed at runtime.
                List <Type> types;
                if (AOTSupportUtilities.ScanProjectForSerializedTypes(out types))
                {
                    AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "OdinAOTSupport", types);
                }
            }
        }
Exemple #3
0
 private static void ApplyImportSettings(BuildTarget platform, string[] assemblyPaths, OdinAssemblyImportSettings importSettings)
 {
     for (int i = 0; i < assemblyPaths.Length; i++)
     {
         AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, assemblyPaths[i], importSettings);
     }
 }
Exemple #4
0
 private static void SetImportSettings(BuildTarget platform, string[] assemblyPaths, OdinAssemblyImportSettings importSettings)
 {
     foreach (var path in assemblyPaths)
     {
         var p = path.Replace('\\', '/');
         AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, p, importSettings);
     }
 }
        public static void OnPreprocessBuild()
        {
            BuildTarget platform = EditorUserBuildSettings.activeBuildTarget;

            try
            {
                // The EditorOnly dll should aways have the same import settings. But lets just make sure.
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

                if (AssemblyImportSettingsUtilities.IsJITSupported(
                        platform,
                        AssemblyImportSettingsUtilities.GetCurrentScriptingBackend(),
                        AssemblyImportSettingsUtilities.GetCurrentApiCompatibilityLevel()))
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                }
                else
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);

                    uNodeAOTScanMethod = "MaxyGames.uNode.Editors.uNodeEditorInitializer".ToType().GetMethod("AOTScan", new Type[] { typeof(List <Type>).MakeByRefType() });
                    // Generates dll that contains all serialized generic type variants needed at runtime.
                    object[]    param = new object[] { null };
                    bool        flag  = (bool)uNodeAOTScanMethod.Invoke(null, param);
                    List <Type> types = param[0] as List <Type>;
                    if (flag)
                    {
                        AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "OdinAOTSupport", types);
                    }
                }
            }
            finally
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }
Exemple #6
0
        public static void OnPreprocessBuild()
        {
            BuildTarget platform = EditorUserBuildSettings.activeBuildTarget;

            try
            {
                // The EditorOnly dll should aways have the same import settings. But lets just make sure.
                AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, EditorAssemblyPath, OdinAssemblyImportSettings.IncludeInEditorOnly);

                if (AssemblyImportSettingsUtilities.IsJITSupported(
                        platform,
                        AssemblyImportSettingsUtilities.GetCurrentScriptingBackend(),
                        AssemblyImportSettingsUtilities.GetCurrentApiCompatibilityLevel()))
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                }
                else
                {
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, AOTAssemblyPath, OdinAssemblyImportSettings.IncludeInBuildOnly);
                    AssemblyImportSettingsUtilities.SetAssemblyImportSettings(platform, JITAssemblyPath, OdinAssemblyImportSettings.ExcludeFromAll);

                    // Generates dll that contains all serialized generic type variants needed at runtime.
                    List <Type> types;
                    if (AOTSupportUtilities.ScanProjectForSerializedTypes(out types))
                    {
                        types.Add(typeof(DataFormat));
                        AOTSupportUtilities.GenerateDLL(GenerateAssembliesDir, "Lasm.Bolt.UniversalSaver.OdinAOTSupport", types);
                    }
                }
            }
            finally
            {
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
        }