예제 #1
0
        private static List <string> GetDepDlls(UnityPluginConfig pluginConfig)
        {
            var dlls = new List <string>();

            pluginConfig.unityPlugins
            .Append(UnityPluginUtil.GetUnityEngineStub())
            .Where(p => p.enable).ToList()
            .ForEach(plugin => {
                if (plugin.pluginState == UnityPlugin.PluginState.convert)
                {
                    if (plugin.convertedPath.convertedDLLPath != null && File.Exists(plugin.convertedPath.convertedDLLPath))
                    {
                        dlls.Add(plugin.convertedPath.convertedDLLPath);
                    }
                }
                else
                {
                    if (plugin.stubPath.stubDLLPath != null && File.Exists(plugin.stubPath.stubDLLPath))
                    {
                        dlls.Add(plugin.stubPath.stubDLLPath);
                    }
                }
            });

            return(dlls);
        }
            private void OnEnable()
            {
                unityPluginConfig       = DirectoryUtil.CreateScriptableObject <UnityPluginConfig>("preset/plugins-script", false);
                unityPluginConfigEditor = Editor.CreateEditor(unityPluginConfig) as UnityPluginConfigEditor;

                projectScriptExportConfig       = DirectoryUtil.CreateScriptableObject <ProjectExportConfig>("preset/project-script", false);
                projectScriptExportConfigEditor = Editor.CreateEditor(projectScriptExportConfig) as ProjectExportConfigEditor;

                // scenes
                hierarchyExportConfig       = DirectoryUtil.CreateScriptableObject <HierarchyExportConfig>("quickexport/hierarchy", false);
                hierarchyExportConfigEditor = Editor.CreateEditor(hierarchyExportConfig) as HierarchyExportConfigEditor;
                sceneExportConfig           = DirectoryUtil.CreateScriptableObject <ExportSceneList>("quickexport/scenes", false);
                sceneExportEditor           = Editor.CreateEditor(sceneExportConfig) as ExportSceneListEditor;

                directoryExportConfig = DirectoryUtil.CreateScriptableObject <ExportDirectoryList>("quickexport/directories", false);
                directoryExportEditor = Editor.CreateEditor(directoryExportConfig) as ExportDirectoryListEditor;

                globalConfig       = DirectoryUtil.CreateScriptableObject <GlobalConfig>("bridge/entry/GlobalConfig", false);
                globalConfigEditor = Editor.CreateEditor(globalConfig) as GlobalConfigEditor;

                rawResourceExportConfig       = DirectoryUtil.CreateScriptableObject <RawResourceExportConfig>("quickexport/rawres", false);
                rawResourceExportConfigEditor = Editor.CreateEditor(rawResourceExportConfig) as RawResourceExportConfigEditor;

                BeefBall.DoInstallationCheck();

                ConfigManager.Init();
            }
        public static List <string> GetLibs(UnityPluginConfig pluginConfig)
        {
            var libs = new List <string>();

            pluginConfig.unityPlugins.ForEach(p => {
                libs.AddRange(GetLib(p));
            });

            return(libs);
        }
        public static List <string> GetSources(UnityPluginConfig pluginConfig)
        {
            var sources = new List <string>();

            pluginConfig.unityPlugins.ForEach(p => {
                if (!p.enable)
                {
                    return;
                }

                sources.AddRange(GetSource(p));
            });

            return(sources);
        }
        public static List <string> GetExcludes(UnityPluginConfig pluginConfig)
        {
            var excludes = new List <string>();

            pluginConfig.unityPlugins.ForEach(p => {
                var e = GetExclude(p);

                if (e != null)
                {
                    excludes.AddRange(e);
                }
            });

            return(excludes);
        }
예제 #6
0
        private static void ConfigureBridgeOptionsForProject(ref BridgeOptions bridgeOptions, ProjectExportConfig projectConfig, UnityPluginConfig pluginConfig)
        {
            bridgeOptions.ProjectProperties = new ProjectProperties();

            bridgeOptions.BridgeLocation = references["Bridge"]["Bridge.dll"];
            bridgeOptions.Lib            = build["Output"]["minigame-adaptor-project.dll"];
            bridgeOptions.ReferencesPath = references["Bridge"].FullPath;
            bridgeOptions.ProjectProperties.Configuration = configs["Text"]["bridge.json"].PathToAssets();

            bridgeOptions.Folder            = Path.GetFullPath(".");
            bridgeOptions.Sources           = ProjectExportUtil.GetProjectSources(projectConfig).FilesListToLine();
            bridgeOptions.ExcludeSubFolders = ProjectExportUtil.GetBridgeExcludes(projectConfig, pluginConfig).FilesListToLine();

            bridgeOptions.Rebuild         = true;
            bridgeOptions.Recursive       = true;
            bridgeOptions.Name            = "minigame-adaptor-project";
            bridgeOptions.OutputLocation  = bridgeOptions.Folder;
            bridgeOptions.DefaultFileName = Path.GetFileNameWithoutExtension(bridgeOptions.Lib);
            bridgeOptions.ProjectProperties.AssemblyName    = bridgeOptions.DefaultFileName;
            bridgeOptions.ProjectProperties.DefineConstants = projectConfig.defineMacros.Join(";");
        }
        public static List <string> GetBridgeExcludes(ProjectExportConfig projectConfig, UnityPluginConfig pluginConfig)
        {
            var projectExcludes = GetProjectExcludes(projectConfig);
            // Debug.Log(projectExcludes.Join(";"));

            var pluginsExcludes = new List <string>();
            var pluginsRoot     = new List <UnityEngine.Object>();
            var pluginsStubCs   = new List <string>();

            pluginConfig.unityPlugins.ForEach(p => {
                // 忽略插件生成的stub.cs
                if (p.stubPath.stubCSPath != null && File.Exists(p.stubPath.stubCSPath))
                {
                    pluginsStubCs.Add(p.stubPath.stubCSPath.PathToAssets());
                }
                // 忽略插件生成的ref.cs
                if (p.stubPath.stubRefCSPath != null && File.Exists(p.stubPath.stubRefCSPath))
                {
                    pluginsStubCs.Add(p.stubPath.stubRefCSPath.PathToAssets());
                }
                //  忽略插件源码
                if (p.enable)
                {
                    pluginsRoot.Add(p.pluginPath.pluginRoot);
                }
            });

            // unity stub
            var unityStub = UnityPluginUtil.GetUnityEngineStub();

            pluginsStubCs.Add(unityStub.stubPath.stubCSPath.PathToAssets());

            var pluginsFiles = UnityPluginUtil.GetPluginFilesFromConfig(pluginsRoot);

            if (pluginsFiles != null)
            {
                pluginsExcludes.AddRange(pluginsFiles);
                // Debug.Log(pluginsExcludes.Join(";"));
            }
            pluginsExcludes.AddRange(pluginsStubCs);
            // Debug.Log(pluginsStubCs.Join(";"));


            projectExcludes.AddRange(pluginsExcludes);

            return(projectExcludes);
        }