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> GetProjectLibs(ProjectExportConfig projectConfig, List <string> excludesGlob) { List <string> sources = GetProjectFilesFromConfig(projectConfig.project.libs, "/*.dll"); var ignoreCase = ConfigManager.configEntry.projectExportConfig.globIgnoreCase; var excludes = PathUtil.GetFiles(excludesGlob, ignoreCase).ToList(); List <string> result = new List <string>(); foreach (var source in sources) { bool isExclude = false; foreach (var exclude in excludes) { if (exclude.Equals(source)) { isExclude = true; break; } } if (!isExclude) { result.Add(source); } } return(result); }
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); }
private static Compilation BuildDLL(ProjectExportConfig config) { // var sources = config.project.AllSources().ToList(); // var references = config.project.AllReferences().ToList(); var sources = ProjectExportUtil.GetProjectSourcesWithoutExcludes(config); var excludes = new List <string>(); excludes.Add("**/*~/**/*.dll"); excludes.Add("**/[Ee]ditor/**/*.dll"); excludes.Add("**/script-export/**/*.dll"); var references = ProjectExportUtil.GetProjectLibs(config, excludes); references.AddRange(UnityPluginUtil.GetUnityEngineLibs()); // references.AddRange(DLLProc.SystemDLLPath()); // references.AddRange(DLLProc.UnityEngineDLLPath()); // references.AddRange(DLLProc.SystemDLLPath()); Debug.Log("Building Assembly for sources[" + sources.Count + "], references[" + references.Count + "]"); return(DLLProc.BuildDLL("WAGameUnityProject", sources, config.defineMacros, references, true)); }
// public static List <string> GetProjectSourcesWithoutExcludes(ProjectExportConfig projectConfig) { List <string> sources = GetProjectSources(projectConfig); List <string> excludes = GetProjectExcludes(projectConfig); List <string> result = new List <string>(); foreach (var source in sources) { bool isExclude = false; foreach (var exclude in excludes) { if (exclude.Equals(source)) { isExclude = true; break; } } if (!isExclude) { result.Add(source); } } return(result); }
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 void OnStart(ProjectExportConfig config) { }
public static List <string> GetProjectExcludes(ProjectExportConfig projectConfig) { return(GetProjectFilesFromConfig(projectConfig.project.excludes)); }
// [MenuItem("test/Test Project Export Config Util")] // public static void TestProjectExportConfigUtil() { // var project = ConfigManager.configEntry.projectExportConfig; // Debug.Log(GetProjectSources(project)); // Debug.Log(GetProjectExcludes(project)); // Debug.Log(GetProjectLibs(project)); // var plugin = ConfigManager.configEntry.unityPluginConfig; // // Debug.Log(GetBridgeExcludes(project, plugin)); // var path = Path.Combine(Path.GetFullPath("."), "1.txt"); // Debug.Log(path); // wxFileUtil.WriteData(new FileStream(path, FileMode.Create, FileAccess.Write), GetBridgeExcludes(project, plugin).FilesListToLine()); // // Debug.Log("Exclude: " + GetExclude(plugins[0])); // // var exc1 = GetExcludes(plugins); // // var exc2 = GetExcludes(ConfigManager.configEntry.unityPluginConfig); // // Debug.Log("Excludes1: " + exc1); // // Debug.Log("Excludes2: " + exc2); // // Debug.Log(exc1 == exc2); // // Debug.Log("Source: " + GetSource(plugins[0])); // // var src1 = GetExcludes(plugins); // // var src2 = GetExcludes(ConfigManager.configEntry.unityPluginConfig); // // Debug.Log("Excludes1: " + exc1); // // Debug.Log("Excludes2: " + exc2); // // Debug.Log(src1 == src2); // // Debug.Log("Lib: " + GetLib(plugins[0])); // // var lib1 = GetLibs(plugins); // // var lib2 = GetLibs(ConfigManager.configEntry.unityPluginConfig); // // Debug.Log("Excludes1: " + lib2); // // Debug.Log("Excludes2: " + lib2); // // Debug.Log(lib1 == lib2); // } // public static List<string> GetProjectFinalSources(ProjectExportConfig projectConfig, UnityPluginConfig pluginConfig) { // var src = GetProjectSources(projectConfig); // var exc = GetBridgeExcludes(projectConfig, pluginConfig); // var pluginRoots = PathUtil.GetFiles( // pluginConfig.unityPlugins // .Select(p => { // var path = p.pluginPath.pluginRoot.PathAtAssets() + "/**"; // return path; // }) // ); // return src.Except(exc).Except(pluginRoots).ToList(); // } public static List <string> GetProjectSources(ProjectExportConfig projectConfig) { return(GetProjectFilesFromConfig(projectConfig.project.sources, "/*.cs")); }