diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
index 4d60456..102c02a 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs
@@ -8,49 +8,49 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class AssetBundleBuilder
- {
- private readonly BuildContext _buildContext = new BuildContext();
+ public class AssetBundleBuilder
+ {
+ private readonly BuildContext _buildContext = new BuildContext();
- ///
- /// 构建资源包
- ///
- public BuildResult Run(BuildParameters buildParameters, List buildPipeline, bool enableLog)
- {
- // 检测构建参数是否为空
- if (buildParameters == null)
- throw new Exception($"{nameof(buildParameters)} is null !");
+ ///
+ /// 构建资源包
+ ///
+ public BuildResult Run(BuildParameters buildParameters, List buildPipeline, bool enableLog)
+ {
+ // 检测构建参数是否为空
+ if (buildParameters == null)
+ throw new Exception($"{nameof(buildParameters)} is null !");
- // 检测构建参数是否为空
- if (buildPipeline.Count == 0)
- throw new Exception($"Build pipeline is empty !");
+ // 检测构建参数是否为空
+ if (buildPipeline.Count == 0)
+ throw new Exception($"Build pipeline is empty !");
- // 清空旧数据
- _buildContext.ClearAllContext();
+ // 清空旧数据
+ _buildContext.ClearAllContext();
- // 构建参数
- var buildParametersContext = new BuildParametersContext(buildParameters);
- _buildContext.SetContextObject(buildParametersContext);
+ // 构建参数
+ var buildParametersContext = new BuildParametersContext(buildParameters);
+ _buildContext.SetContextObject(buildParametersContext);
- // 初始化日志
- BuildLogger.InitLogger(enableLog);
+ // 初始化日志
+ BuildLogger.InitLogger(enableLog);
- // 执行构建流程
- Debug.Log($"Begin to build package : {buildParameters.PackageName} by {buildParameters.BuildPipeline}");
- var buildResult = BuildRunner.Run(buildPipeline, _buildContext);
- if (buildResult.Success)
- {
- buildResult.OutputPackageDirectory = buildParametersContext.GetPackageOutputDirectory();
- BuildLogger.Log("Resource pipeline build success");
- }
- else
- {
- BuildLogger.Error($"{buildParameters.BuildPipeline} build failed !");
- BuildLogger.Error($"An error occurred in build task {buildResult.FailedTask}");
- BuildLogger.Error(buildResult.ErrorInfo);
- }
+ // 执行构建流程
+ Debug.Log($"Begin to build package : {buildParameters.PackageName} by {buildParameters.BuildPipeline}");
+ var buildResult = BuildRunner.Run(buildPipeline, _buildContext);
+ if (buildResult.Success)
+ {
+ buildResult.OutputPackageDirectory = buildParametersContext.GetPackageOutputDirectory();
+ BuildLogger.Log("Resource pipeline build success");
+ }
+ else
+ {
+ BuildLogger.Error($"{buildParameters.BuildPipeline} build failed !");
+ BuildLogger.Error($"An error occurred in build task {buildResult.FailedTask}");
+ BuildLogger.Error(buildResult.ErrorInfo);
+ }
- return buildResult;
- }
- }
+ return buildResult;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs
index a366f42..45cd531 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderHelper.cs
@@ -6,23 +6,23 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public static class AssetBundleBuilderHelper
- {
- ///
- /// 获取默认的输出根路录
- ///
- public static string GetDefaultBuildOutputRoot()
- {
- string projectPath = EditorTools.GetProjectPath();
- return $"{projectPath}/Bundles";
- }
+ public static class AssetBundleBuilderHelper
+ {
+ ///
+ /// 获取默认的输出根路录
+ ///
+ public static string GetDefaultBuildOutputRoot()
+ {
+ string projectPath = EditorTools.GetProjectPath();
+ return $"{projectPath}/Bundles";
+ }
- ///
- /// 获取流文件夹路径
- ///
- public static string GetStreamingAssetsRoot()
- {
- return $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.DefaultYooFolderName}/";
- }
- }
+ ///
+ /// 获取流文件夹路径
+ ///
+ public static string GetStreamingAssetsRoot()
+ {
+ return $"{Application.dataPath}/StreamingAssets/{YooAssetSettingsData.Setting.DefaultYooFolderName}/";
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
index 77bcc6d..78e4abd 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderSetting.cs
@@ -4,90 +4,90 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public static class AssetBundleBuilderSetting
- {
- // EBuildPipeline
- public static EBuildPipeline GetPackageBuildPipeline(string packageName)
- {
- string key = $"{Application.productName}_{packageName}_{nameof(EBuildPipeline)}";
- return (EBuildPipeline)EditorPrefs.GetInt(key, (int)EBuildPipeline.BuiltinBuildPipeline);
- }
- public static void SetPackageBuildPipeline(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{nameof(EBuildPipeline)}";
- EditorPrefs.SetInt(key, (int)buildPipeline);
- }
+ public static class AssetBundleBuilderSetting
+ {
+ // EBuildPipeline
+ public static EBuildPipeline GetPackageBuildPipeline(string packageName)
+ {
+ string key = $"{Application.productName}_{packageName}_{nameof(EBuildPipeline)}";
+ return (EBuildPipeline)EditorPrefs.GetInt(key, (int)EBuildPipeline.BuiltinBuildPipeline);
+ }
+ public static void SetPackageBuildPipeline(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{nameof(EBuildPipeline)}";
+ EditorPrefs.SetInt(key, (int)buildPipeline);
+ }
- // EBuildMode
- public static EBuildMode GetPackageBuildMode(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
- return (EBuildMode)EditorPrefs.GetInt(key, (int)EBuildMode.ForceRebuild);
- }
- public static void SetPackageBuildMode(string packageName, EBuildPipeline buildPipeline, EBuildMode buildMode)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
- EditorPrefs.SetInt(key, (int)buildMode);
- }
+ // EBuildMode
+ public static EBuildMode GetPackageBuildMode(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
+ return (EBuildMode)EditorPrefs.GetInt(key, (int)EBuildMode.ForceRebuild);
+ }
+ public static void SetPackageBuildMode(string packageName, EBuildPipeline buildPipeline, EBuildMode buildMode)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildMode)}";
+ EditorPrefs.SetInt(key, (int)buildMode);
+ }
- // ECompressOption
- public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(ECompressOption)}";
- return (ECompressOption)EditorPrefs.GetInt(key, (int)ECompressOption.LZ4);
- }
- public static void SetPackageCompressOption(string packageName, EBuildPipeline buildPipeline, ECompressOption compressOption)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(ECompressOption)}";
- EditorPrefs.SetInt(key, (int)compressOption);
- }
+ // ECompressOption
+ public static ECompressOption GetPackageCompressOption(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(ECompressOption)}";
+ return (ECompressOption)EditorPrefs.GetInt(key, (int)ECompressOption.LZ4);
+ }
+ public static void SetPackageCompressOption(string packageName, EBuildPipeline buildPipeline, ECompressOption compressOption)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(ECompressOption)}";
+ EditorPrefs.SetInt(key, (int)compressOption);
+ }
- // EFileNameStyle
- public static EFileNameStyle GetPackageFileNameStyle(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EFileNameStyle)}";
- return (EFileNameStyle)EditorPrefs.GetInt(key, (int)EFileNameStyle.HashName);
- }
- public static void SetPackageFileNameStyle(string packageName, EBuildPipeline buildPipeline, EFileNameStyle fileNameStyle)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EFileNameStyle)}";
- EditorPrefs.SetInt(key, (int)fileNameStyle);
- }
+ // EFileNameStyle
+ public static EFileNameStyle GetPackageFileNameStyle(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EFileNameStyle)}";
+ return (EFileNameStyle)EditorPrefs.GetInt(key, (int)EFileNameStyle.HashName);
+ }
+ public static void SetPackageFileNameStyle(string packageName, EBuildPipeline buildPipeline, EFileNameStyle fileNameStyle)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EFileNameStyle)}";
+ EditorPrefs.SetInt(key, (int)fileNameStyle);
+ }
- // EBuildinFileCopyOption
- public static EBuildinFileCopyOption GetPackageBuildinFileCopyOption(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
- return (EBuildinFileCopyOption)EditorPrefs.GetInt(key, (int)EBuildinFileCopyOption.None);
- }
- public static void SetPackageBuildinFileCopyOption(string packageName, EBuildPipeline buildPipeline, EBuildinFileCopyOption buildinFileCopyOption)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
- EditorPrefs.SetInt(key, (int)buildinFileCopyOption);
- }
+ // EBuildinFileCopyOption
+ public static EBuildinFileCopyOption GetPackageBuildinFileCopyOption(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
+ return (EBuildinFileCopyOption)EditorPrefs.GetInt(key, (int)EBuildinFileCopyOption.None);
+ }
+ public static void SetPackageBuildinFileCopyOption(string packageName, EBuildPipeline buildPipeline, EBuildinFileCopyOption buildinFileCopyOption)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_{nameof(EBuildinFileCopyOption)}";
+ EditorPrefs.SetInt(key, (int)buildinFileCopyOption);
+ }
- // BuildFileCopyParams
- public static string GetPackageBuildinFileCopyParams(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
- return EditorPrefs.GetString(key, string.Empty);
- }
- public static void SetPackageBuildinFileCopyParams(string packageName, EBuildPipeline buildPipeline, string buildinFileCopyParams)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
- EditorPrefs.SetString(key, buildinFileCopyParams);
- }
+ // BuildFileCopyParams
+ public static string GetPackageBuildinFileCopyParams(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
+ return EditorPrefs.GetString(key, string.Empty);
+ }
+ public static void SetPackageBuildinFileCopyParams(string packageName, EBuildPipeline buildPipeline, string buildinFileCopyParams)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_BuildFileCopyParams";
+ EditorPrefs.SetString(key, buildinFileCopyParams);
+ }
- // EncyptionClassName
- public static string GetPackageEncyptionClassName(string packageName, EBuildPipeline buildPipeline)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
- return EditorPrefs.GetString(key, string.Empty);
- }
- public static void SetPackageEncyptionClassName(string packageName, EBuildPipeline buildPipeline, string encyptionClassName)
- {
- string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
- EditorPrefs.SetString(key, encyptionClassName);
- }
- }
+ // EncyptionClassName
+ public static string GetPackageEncyptionClassName(string packageName, EBuildPipeline buildPipeline)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
+ return EditorPrefs.GetString(key, string.Empty);
+ }
+ public static void SetPackageEncyptionClassName(string packageName, EBuildPipeline buildPipeline, string encyptionClassName)
+ {
+ string key = $"{Application.productName}_{packageName}_{buildPipeline}_EncyptionClassName";
+ EditorPrefs.SetString(key, encyptionClassName);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
index e46a764..d6ea3ea 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilderWindow.cs
@@ -9,153 +9,153 @@ using UnityEngine.UIElements;
namespace YooAsset.Editor
{
- public class AssetBundleBuilderWindow : EditorWindow
- {
- [MenuItem("YooAsset/AssetBundle Builder", false, 102)]
- public static void OpenWindow()
- {
- AssetBundleBuilderWindow window = GetWindow("AssetBundle Builder", true, WindowsDefine.DockedWindowTypes);
- window.minSize = new Vector2(800, 600);
- }
+ public class AssetBundleBuilderWindow : EditorWindow
+ {
+ [MenuItem("YooAsset/AssetBundle Builder", false, 102)]
+ public static void OpenWindow()
+ {
+ AssetBundleBuilderWindow window = GetWindow("AssetBundle Builder", true, WindowsDefine.DockedWindowTypes);
+ window.minSize = new Vector2(800, 600);
+ }
- private string _buildPackage;
- private EBuildPipeline _buildPipeline;
+ private string _buildPackage;
+ private EBuildPipeline _buildPipeline;
- private Toolbar _toolbar;
- private ToolbarMenu _packageMenu;
- private ToolbarMenu _pipelineMenu;
- private VisualElement _container;
+ private Toolbar _toolbar;
+ private ToolbarMenu _packageMenu;
+ private ToolbarMenu _pipelineMenu;
+ private VisualElement _container;
- public void CreateGUI()
- {
- try
- {
- VisualElement root = this.rootVisualElement;
+ public void CreateGUI()
+ {
+ try
+ {
+ VisualElement root = this.rootVisualElement;
- // 加载布局文件
- var visualAsset = UxmlLoader.LoadWindowUXML();
- if (visualAsset == null)
- return;
+ // 加载布局文件
+ var visualAsset = UxmlLoader.LoadWindowUXML();
+ if (visualAsset == null)
+ return;
- visualAsset.CloneTree(root);
- _toolbar = root.Q("Toolbar");
- _container = root.Q("Container");
+ visualAsset.CloneTree(root);
+ _toolbar = root.Q("Toolbar");
+ _container = root.Q("Container");
- // 检测构建包裹
- var packageNames = GetBuildPackageNames();
- if (packageNames.Count == 0)
- {
- var label = new Label();
- label.text = "Not found any package";
- label.style.width = 100;
- _toolbar.Add(label);
- return;
- }
+ // 检测构建包裹
+ var packageNames = GetBuildPackageNames();
+ if (packageNames.Count == 0)
+ {
+ var label = new Label();
+ label.text = "Not found any package";
+ label.style.width = 100;
+ _toolbar.Add(label);
+ return;
+ }
- // 构建包裹
- {
- _buildPackage = packageNames[0];
- _packageMenu = new ToolbarMenu();
- _packageMenu.style.width = 200;
- foreach (var packageName in packageNames)
- {
- _packageMenu.menu.AppendAction(packageName, PackageMenuAction, PackageMenuFun, packageName);
- }
- _toolbar.Add(_packageMenu);
- }
+ // 构建包裹
+ {
+ _buildPackage = packageNames[0];
+ _packageMenu = new ToolbarMenu();
+ _packageMenu.style.width = 200;
+ foreach (var packageName in packageNames)
+ {
+ _packageMenu.menu.AppendAction(packageName, PackageMenuAction, PackageMenuFun, packageName);
+ }
+ _toolbar.Add(_packageMenu);
+ }
- // 构建管线
- {
- _pipelineMenu = new ToolbarMenu();
- _pipelineMenu.style.width = 200;
- _pipelineMenu.menu.AppendAction(EBuildPipeline.BuiltinBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.BuiltinBuildPipeline);
- _pipelineMenu.menu.AppendAction(EBuildPipeline.ScriptableBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.ScriptableBuildPipeline);
- _pipelineMenu.menu.AppendAction(EBuildPipeline.RawFileBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.RawFileBuildPipeline);
- _toolbar.Add(_pipelineMenu);
- }
+ // 构建管线
+ {
+ _pipelineMenu = new ToolbarMenu();
+ _pipelineMenu.style.width = 200;
+ _pipelineMenu.menu.AppendAction(EBuildPipeline.BuiltinBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.BuiltinBuildPipeline);
+ _pipelineMenu.menu.AppendAction(EBuildPipeline.ScriptableBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.ScriptableBuildPipeline);
+ _pipelineMenu.menu.AppendAction(EBuildPipeline.RawFileBuildPipeline.ToString(), PipelineMenuAction, PipelineMenuFun, EBuildPipeline.RawFileBuildPipeline);
+ _toolbar.Add(_pipelineMenu);
+ }
- RefreshBuildPipelineView();
- }
- catch (Exception e)
- {
- Debug.LogError(e.ToString());
- }
- }
+ RefreshBuildPipelineView();
+ }
+ catch (Exception e)
+ {
+ Debug.LogError(e.ToString());
+ }
+ }
- private void RefreshBuildPipelineView()
- {
- // 清空扩展区域
- _container.Clear();
+ private void RefreshBuildPipelineView()
+ {
+ // 清空扩展区域
+ _container.Clear();
- _buildPipeline = AssetBundleBuilderSetting.GetPackageBuildPipeline(_buildPackage);
- _packageMenu.text = _buildPackage;
- _pipelineMenu.text = _buildPipeline.ToString();
+ _buildPipeline = AssetBundleBuilderSetting.GetPackageBuildPipeline(_buildPackage);
+ _packageMenu.text = _buildPackage;
+ _pipelineMenu.text = _buildPipeline.ToString();
- var buildTarget = EditorUserBuildSettings.activeBuildTarget;
- if (_buildPipeline == EBuildPipeline.BuiltinBuildPipeline)
- {
- var viewer = new BuiltinBuildPipelineViewer(_buildPackage, buildTarget, _container);
- }
- else if (_buildPipeline == EBuildPipeline.ScriptableBuildPipeline)
- {
- var viewer = new ScriptableBuildPipelineViewer(_buildPackage, buildTarget, _container);
- }
- else if (_buildPipeline == EBuildPipeline.RawFileBuildPipeline)
- {
- var viewer = new RawfileBuildpipelineViewer(_buildPackage, buildTarget, _container);
- }
- else
- {
- throw new System.NotImplementedException(_buildPipeline.ToString());
- }
- }
- private List GetBuildPackageNames()
- {
- List result = new List();
- foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
- {
- result.Add(package.PackageName);
- }
- return result;
- }
+ var buildTarget = EditorUserBuildSettings.activeBuildTarget;
+ if (_buildPipeline == EBuildPipeline.BuiltinBuildPipeline)
+ {
+ var viewer = new BuiltinBuildPipelineViewer(_buildPackage, buildTarget, _container);
+ }
+ else if (_buildPipeline == EBuildPipeline.ScriptableBuildPipeline)
+ {
+ var viewer = new ScriptableBuildPipelineViewer(_buildPackage, buildTarget, _container);
+ }
+ else if (_buildPipeline == EBuildPipeline.RawFileBuildPipeline)
+ {
+ var viewer = new RawfileBuildpipelineViewer(_buildPackage, buildTarget, _container);
+ }
+ else
+ {
+ throw new System.NotImplementedException(_buildPipeline.ToString());
+ }
+ }
+ private List GetBuildPackageNames()
+ {
+ List result = new List();
+ foreach (var package in AssetBundleCollectorSettingData.Setting.Packages)
+ {
+ result.Add(package.PackageName);
+ }
+ return result;
+ }
- private void PackageMenuAction(DropdownMenuAction action)
- {
- var packageName = (string)action.userData;
- if (_buildPackage != packageName)
- {
- _buildPackage = packageName;
- RefreshBuildPipelineView();
- }
- }
- private DropdownMenuAction.Status PackageMenuFun(DropdownMenuAction action)
- {
- var packageName = (string)action.userData;
- if (_buildPackage == packageName)
- return DropdownMenuAction.Status.Checked;
- else
- return DropdownMenuAction.Status.Normal;
- }
+ private void PackageMenuAction(DropdownMenuAction action)
+ {
+ var packageName = (string)action.userData;
+ if (_buildPackage != packageName)
+ {
+ _buildPackage = packageName;
+ RefreshBuildPipelineView();
+ }
+ }
+ private DropdownMenuAction.Status PackageMenuFun(DropdownMenuAction action)
+ {
+ var packageName = (string)action.userData;
+ if (_buildPackage == packageName)
+ return DropdownMenuAction.Status.Checked;
+ else
+ return DropdownMenuAction.Status.Normal;
+ }
- private void PipelineMenuAction(DropdownMenuAction action)
- {
- var pipelineType = (EBuildPipeline)action.userData;
- if (_buildPipeline != pipelineType)
- {
- _buildPipeline = pipelineType;
- AssetBundleBuilderSetting.SetPackageBuildPipeline(_buildPackage, pipelineType);
- RefreshBuildPipelineView();
- }
- }
- private DropdownMenuAction.Status PipelineMenuFun(DropdownMenuAction action)
- {
- var pipelineType = (EBuildPipeline)action.userData;
- if (_buildPipeline == pipelineType)
- return DropdownMenuAction.Status.Checked;
- else
- return DropdownMenuAction.Status.Normal;
- }
- }
+ private void PipelineMenuAction(DropdownMenuAction action)
+ {
+ var pipelineType = (EBuildPipeline)action.userData;
+ if (_buildPipeline != pipelineType)
+ {
+ _buildPipeline = pipelineType;
+ AssetBundleBuilderSetting.SetPackageBuildPipeline(_buildPackage, pipelineType);
+ RefreshBuildPipelineView();
+ }
+ }
+ private DropdownMenuAction.Status PipelineMenuFun(DropdownMenuAction action)
+ {
+ var pipelineType = (EBuildPipeline)action.userData;
+ if (_buildPipeline == pipelineType)
+ return DropdownMenuAction.Status.Checked;
+ else
+ return DropdownMenuAction.Status.Normal;
+ }
+ }
}
#endif
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
index 663f66e..761b212 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
@@ -3,98 +3,98 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public static class AssetBundleSimulateBuilder
- {
- ///
- /// 模拟构建
- ///
- public static string SimulateBuild(string buildPipelineName, string packageName)
- {
- if (buildPipelineName == EBuildPipeline.BuiltinBuildPipeline.ToString())
- {
- BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
- buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
- buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
- buildParameters.BuildPipeline = buildPipelineName;
- buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
- buildParameters.BuildMode = EBuildMode.SimulateBuild;
- buildParameters.PackageName = packageName;
- buildParameters.PackageVersion = "Simulate";
- buildParameters.FileNameStyle = EFileNameStyle.HashName;
- buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
- buildParameters.BuildinFileCopyParams = string.Empty;
+ public static class AssetBundleSimulateBuilder
+ {
+ ///
+ /// 模拟构建
+ ///
+ public static string SimulateBuild(string buildPipelineName, string packageName)
+ {
+ if (buildPipelineName == EBuildPipeline.BuiltinBuildPipeline.ToString())
+ {
+ BuiltinBuildParameters buildParameters = new BuiltinBuildParameters();
+ buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
+ buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
+ buildParameters.BuildPipeline = buildPipelineName;
+ buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
+ buildParameters.BuildMode = EBuildMode.SimulateBuild;
+ buildParameters.PackageName = packageName;
+ buildParameters.PackageVersion = "Simulate";
+ buildParameters.FileNameStyle = EFileNameStyle.HashName;
+ buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
+ buildParameters.BuildinFileCopyParams = string.Empty;
- BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
- var buildResult = pipeline.Run(buildParameters, false);
- if (buildResult.Success)
- {
- string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
- return manifestFilePath;
- }
- else
- {
- return null;
- }
- }
- else if (buildPipelineName == EBuildPipeline.ScriptableBuildPipeline.ToString())
- {
- ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
- buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
- buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
- buildParameters.BuildPipeline = buildPipelineName;
- buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
- buildParameters.BuildMode = EBuildMode.SimulateBuild;
- buildParameters.PackageName = packageName;
- buildParameters.PackageVersion = "Simulate";
- buildParameters.FileNameStyle = EFileNameStyle.HashName;
- buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
- buildParameters.BuildinFileCopyParams = string.Empty;
+ BuiltinBuildPipeline pipeline = new BuiltinBuildPipeline();
+ var buildResult = pipeline.Run(buildParameters, false);
+ if (buildResult.Success)
+ {
+ string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
+ return manifestFilePath;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if (buildPipelineName == EBuildPipeline.ScriptableBuildPipeline.ToString())
+ {
+ ScriptableBuildParameters buildParameters = new ScriptableBuildParameters();
+ buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
+ buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
+ buildParameters.BuildPipeline = buildPipelineName;
+ buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
+ buildParameters.BuildMode = EBuildMode.SimulateBuild;
+ buildParameters.PackageName = packageName;
+ buildParameters.PackageVersion = "Simulate";
+ buildParameters.FileNameStyle = EFileNameStyle.HashName;
+ buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
+ buildParameters.BuildinFileCopyParams = string.Empty;
- ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
- var buildResult = pipeline.Run(buildParameters, true);
- if (buildResult.Success)
- {
- string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
- return manifestFilePath;
- }
- else
- {
- return null;
- }
- }
- else if (buildPipelineName == EBuildPipeline.RawFileBuildPipeline.ToString())
- {
- RawFileBuildParameters buildParameters = new RawFileBuildParameters();
- buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
- buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
- buildParameters.BuildPipeline = buildPipelineName;
- buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
- buildParameters.BuildMode = EBuildMode.SimulateBuild;
- buildParameters.PackageName = packageName;
- buildParameters.PackageVersion = "Simulate";
- buildParameters.FileNameStyle = EFileNameStyle.HashName;
- buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
- buildParameters.BuildinFileCopyParams = string.Empty;
+ ScriptableBuildPipeline pipeline = new ScriptableBuildPipeline();
+ var buildResult = pipeline.Run(buildParameters, true);
+ if (buildResult.Success)
+ {
+ string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
+ return manifestFilePath;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if (buildPipelineName == EBuildPipeline.RawFileBuildPipeline.ToString())
+ {
+ RawFileBuildParameters buildParameters = new RawFileBuildParameters();
+ buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
+ buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
+ buildParameters.BuildPipeline = buildPipelineName;
+ buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
+ buildParameters.BuildMode = EBuildMode.SimulateBuild;
+ buildParameters.PackageName = packageName;
+ buildParameters.PackageVersion = "Simulate";
+ buildParameters.FileNameStyle = EFileNameStyle.HashName;
+ buildParameters.BuildinFileCopyOption = EBuildinFileCopyOption.None;
+ buildParameters.BuildinFileCopyParams = string.Empty;
- RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
- var buildResult = pipeline.Run(buildParameters, true);
- if (buildResult.Success)
- {
- string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
- return manifestFilePath;
- }
- else
- {
- return null;
- }
- }
- else
- {
- throw new System.NotImplementedException(buildPipelineName);
- }
- }
- }
+ RawFileBuildPipeline pipeline = new RawFileBuildPipeline();
+ var buildResult = pipeline.Run(buildParameters, true);
+ if (buildResult.Success)
+ {
+ string manifestFileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string manifestFilePath = $"{buildResult.OutputPackageDirectory}/{manifestFileName}";
+ return manifestFilePath;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else
+ {
+ throw new System.NotImplementedException(buildPipelineName);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs
index f7f8ef1..d33ed14 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildAssetInfo.cs
@@ -5,155 +5,155 @@ using System.Linq;
namespace YooAsset.Editor
{
- public class BuildAssetInfo
- {
- private bool _isAddAssetTags = false;
- private readonly HashSet _referenceBundleNames = new HashSet();
+ public class BuildAssetInfo
+ {
+ private bool _isAddAssetTags = false;
+ private readonly HashSet _referenceBundleNames = new HashSet();
- ///
- /// 收集器类型
- ///
- public ECollectorType CollectorType { private set; get; }
+ ///
+ /// 收集器类型
+ ///
+ public ECollectorType CollectorType { private set; get; }
- ///
- /// 资源包完整名称
- ///
- public string BundleName { private set; get; }
+ ///
+ /// 资源包完整名称
+ ///
+ public string BundleName { private set; get; }
- ///
- /// 可寻址地址
- ///
- public string Address { private set; get; }
+ ///
+ /// 可寻址地址
+ ///
+ public string Address { private set; get; }
- ///
- /// 资源路径
- ///
- public string AssetPath { private set; get; }
+ ///
+ /// 资源路径
+ ///
+ public string AssetPath { private set; get; }
- ///
- /// 资源GUID
- ///
- public string AssetGUID { private set; get; }
+ ///
+ /// 资源GUID
+ ///
+ public string AssetGUID { private set; get; }
- ///
- /// 资源类型
- ///
- public System.Type AssetType { private set; get; }
+ ///
+ /// 资源类型
+ ///
+ public System.Type AssetType { private set; get; }
- ///
- /// 资源的分类标签
- ///
- public readonly List AssetTags = new List();
+ ///
+ /// 资源的分类标签
+ ///
+ public readonly List AssetTags = new List();
- ///
- /// 依赖的所有资源
- /// 注意:包括零依赖资源和冗余资源(资源包名无效)
- ///
- public List AllDependAssetInfos { private set; get; }
+ ///
+ /// 依赖的所有资源
+ /// 注意:包括零依赖资源和冗余资源(资源包名无效)
+ ///
+ public List AllDependAssetInfos { private set; get; }
- public BuildAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath)
- {
- CollectorType = collectorType;
- BundleName = bundleName;
- Address = address;
- AssetPath = assetPath;
+ public BuildAssetInfo(ECollectorType collectorType, string bundleName, string address, string assetPath)
+ {
+ CollectorType = collectorType;
+ BundleName = bundleName;
+ Address = address;
+ AssetPath = assetPath;
- AssetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
- AssetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
- }
- public BuildAssetInfo(string assetPath)
- {
- CollectorType = ECollectorType.None;
- BundleName = string.Empty;
- Address = string.Empty;
- AssetPath = assetPath;
+ AssetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
+ AssetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
+ }
+ public BuildAssetInfo(string assetPath)
+ {
+ CollectorType = ECollectorType.None;
+ BundleName = string.Empty;
+ Address = string.Empty;
+ AssetPath = assetPath;
- AssetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
- AssetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
- }
+ AssetGUID = UnityEditor.AssetDatabase.AssetPathToGUID(assetPath);
+ AssetType = UnityEditor.AssetDatabase.GetMainAssetTypeAtPath(assetPath);
+ }
- ///
- /// 设置所有依赖的资源
- ///
- public void SetDependAssetInfos(List dependAssetInfos)
- {
- if (AllDependAssetInfos != null)
- throw new System.Exception("Should never get here !");
+ ///
+ /// 设置所有依赖的资源
+ ///
+ public void SetDependAssetInfos(List dependAssetInfos)
+ {
+ if (AllDependAssetInfos != null)
+ throw new System.Exception("Should never get here !");
- AllDependAssetInfos = dependAssetInfos;
- }
+ AllDependAssetInfos = dependAssetInfos;
+ }
- ///
- /// 设置为统一的着色器包名
- ///
- public void SetShaderBundleName(string packageName, bool uniqueBundleName)
- {
- // 获取着色器打包规则结果
- PackRuleResult shaderPackRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
- BundleName = shaderPackRuleResult.GetBundleName(packageName, uniqueBundleName);
- }
+ ///
+ /// 设置为统一的着色器包名
+ ///
+ public void SetShaderBundleName(string packageName, bool uniqueBundleName)
+ {
+ // 获取着色器打包规则结果
+ PackRuleResult shaderPackRuleResult = DefaultPackRule.CreateShadersPackRuleResult();
+ BundleName = shaderPackRuleResult.GetBundleName(packageName, uniqueBundleName);
+ }
- ///
- /// 添加资源的分类标签
- /// 说明:原始定义的资源分类标签
- ///
- public void AddAssetTags(List tags)
- {
- if (_isAddAssetTags)
- throw new Exception("Should never get here !");
- _isAddAssetTags = true;
+ ///
+ /// 添加资源的分类标签
+ /// 说明:原始定义的资源分类标签
+ ///
+ public void AddAssetTags(List tags)
+ {
+ if (_isAddAssetTags)
+ throw new Exception("Should never get here !");
+ _isAddAssetTags = true;
- foreach (var tag in tags)
- {
- if (AssetTags.Contains(tag) == false)
- {
- AssetTags.Add(tag);
- }
- }
- }
+ foreach (var tag in tags)
+ {
+ if (AssetTags.Contains(tag) == false)
+ {
+ AssetTags.Add(tag);
+ }
+ }
+ }
- ///
- /// 添加关联的资源包名称
- ///
- public void AddReferenceBundleName(string bundleName)
- {
- if (string.IsNullOrEmpty(bundleName))
- throw new Exception("Should never get here !");
+ ///
+ /// 添加关联的资源包名称
+ ///
+ public void AddReferenceBundleName(string bundleName)
+ {
+ if (string.IsNullOrEmpty(bundleName))
+ throw new Exception("Should never get here !");
- if (_referenceBundleNames.Contains(bundleName) == false)
- _referenceBundleNames.Add(bundleName);
- }
+ if (_referenceBundleNames.Contains(bundleName) == false)
+ _referenceBundleNames.Add(bundleName);
+ }
- ///
- /// 资源包名是否存在
- ///
- public bool HasBundleName()
- {
- if (string.IsNullOrEmpty(BundleName))
- return false;
- else
- return true;
- }
+ ///
+ /// 资源包名是否存在
+ ///
+ public bool HasBundleName()
+ {
+ if (string.IsNullOrEmpty(BundleName))
+ return false;
+ else
+ return true;
+ }
- ///
- /// 判断是否为冗余资源
- ///
- public bool IsRedundancyAsset()
- {
- if (HasBundleName())
- return false;
+ ///
+ /// 判断是否为冗余资源
+ ///
+ public bool IsRedundancyAsset()
+ {
+ if (HasBundleName())
+ return false;
- return _referenceBundleNames.Count > 1;
- }
+ return _referenceBundleNames.Count > 1;
+ }
- ///
- /// 获取关联资源包的数量
- ///
- public int GetReferenceBundleCount()
- {
- return _referenceBundleNames.Count;
- }
- }
+ ///
+ /// 获取关联资源包的数量
+ ///
+ public int GetReferenceBundleCount()
+ {
+ return _referenceBundleNames.Count;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
index 969e2e8..ac0111b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildBundleInfo.cs
@@ -6,171 +6,171 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class BuildBundleInfo
- {
- #region 补丁文件的关键信息
- ///
- /// Unity引擎生成的哈希值(构建内容的哈希值)
- ///
- public string PackageUnityHash { set; get; }
+ public class BuildBundleInfo
+ {
+ #region 补丁文件的关键信息
+ ///
+ /// Unity引擎生成的哈希值(构建内容的哈希值)
+ ///
+ public string PackageUnityHash { set; get; }
- ///
- /// Unity引擎生成的CRC
- ///
- public uint PackageUnityCRC { set; get; }
+ ///
+ /// Unity引擎生成的CRC
+ ///
+ public uint PackageUnityCRC { set; get; }
- ///
- /// 文件哈希值
- ///
- public string PackageFileHash { set; get; }
+ ///
+ /// 文件哈希值
+ ///
+ public string PackageFileHash { set; get; }
- ///
- /// 文件哈希值
- ///
- public string PackageFileCRC { set; get; }
+ ///
+ /// 文件哈希值
+ ///
+ public string PackageFileCRC { set; get; }
- ///
- /// 文件哈希值
- ///
- public long PackageFileSize { set; get; }
+ ///
+ /// 文件哈希值
+ ///
+ public long PackageFileSize { set; get; }
- ///
- /// 构建输出的文件路径
- ///
- public string BuildOutputFilePath { set; get; }
+ ///
+ /// 构建输出的文件路径
+ ///
+ public string BuildOutputFilePath { set; get; }
- ///
- /// 补丁包的源文件路径
- ///
- public string PackageSourceFilePath { set; get; }
+ ///
+ /// 补丁包的源文件路径
+ ///
+ public string PackageSourceFilePath { set; get; }
- ///
- /// 补丁包的目标文件路径
- ///
- public string PackageDestFilePath { set; get; }
+ ///
+ /// 补丁包的目标文件路径
+ ///
+ public string PackageDestFilePath { set; get; }
- ///
- /// 加密生成文件的路径
- /// 注意:如果未加密该路径为空
- ///
- public string EncryptedFilePath { set; get; }
- #endregion
+ ///
+ /// 加密生成文件的路径
+ /// 注意:如果未加密该路径为空
+ ///
+ public string EncryptedFilePath { set; get; }
+ #endregion
- ///
- /// 参与构建的资源列表
- /// 注意:不包含零依赖资源和冗余资源
- ///
- public readonly List MainAssets = new List();
+ ///
+ /// 参与构建的资源列表
+ /// 注意:不包含零依赖资源和冗余资源
+ ///
+ public readonly List MainAssets = new List();
- ///
- /// 资源包名称
- ///
- public string BundleName { private set; get; }
+ ///
+ /// 资源包名称
+ ///
+ public string BundleName { private set; get; }
- ///
- /// 加密文件
- ///
- public bool Encrypted { set; get; }
+ ///
+ /// 加密文件
+ ///
+ public bool Encrypted { set; get; }
- public BuildBundleInfo(string bundleName)
- {
- BundleName = bundleName;
- }
+ public BuildBundleInfo(string bundleName)
+ {
+ BundleName = bundleName;
+ }
- ///
- /// 添加一个打包资源
- ///
- public void PackAsset(BuildAssetInfo assetInfo)
- {
- if (IsContainsAsset(assetInfo.AssetPath))
- throw new System.Exception($"Should never get here ! Asset is existed : {assetInfo.AssetPath}");
+ ///
+ /// 添加一个打包资源
+ ///
+ public void PackAsset(BuildAssetInfo assetInfo)
+ {
+ if (IsContainsAsset(assetInfo.AssetPath))
+ throw new System.Exception($"Should never get here ! Asset is existed : {assetInfo.AssetPath}");
- MainAssets.Add(assetInfo);
- }
+ MainAssets.Add(assetInfo);
+ }
- ///
- /// 是否包含指定资源
- ///
- public bool IsContainsAsset(string assetPath)
- {
- foreach (var assetInfo in MainAssets)
- {
- if (assetInfo.AssetPath == assetPath)
- {
- return true;
- }
- }
- return false;
- }
+ ///
+ /// 是否包含指定资源
+ ///
+ public bool IsContainsAsset(string assetPath)
+ {
+ foreach (var assetInfo in MainAssets)
+ {
+ if (assetInfo.AssetPath == assetPath)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
- ///
- /// 获取构建的资源路径列表
- ///
- public string[] GetAllMainAssetPaths()
- {
- return MainAssets.Select(t => t.AssetPath).ToArray();
- }
+ ///
+ /// 获取构建的资源路径列表
+ ///
+ public string[] GetAllMainAssetPaths()
+ {
+ return MainAssets.Select(t => t.AssetPath).ToArray();
+ }
- ///
- /// 获取该资源包内的所有资源(包括零依赖资源和冗余资源)
- ///
- public List GetAllBuiltinAssetPaths()
- {
- var packAssets = GetAllMainAssetPaths();
- List result = new List(packAssets);
- foreach (var assetInfo in MainAssets)
- {
- if (assetInfo.AllDependAssetInfos == null)
- continue;
- foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
- {
- // 注意:依赖资源里只添加零依赖资源和冗余资源
- if (dependAssetInfo.HasBundleName() == false)
- {
- if (result.Contains(dependAssetInfo.AssetPath) == false)
- result.Add(dependAssetInfo.AssetPath);
- }
- }
- }
- return result;
- }
+ ///
+ /// 获取该资源包内的所有资源(包括零依赖资源和冗余资源)
+ ///
+ public List GetAllBuiltinAssetPaths()
+ {
+ var packAssets = GetAllMainAssetPaths();
+ List result = new List(packAssets);
+ foreach (var assetInfo in MainAssets)
+ {
+ if (assetInfo.AllDependAssetInfos == null)
+ continue;
+ foreach (var dependAssetInfo in assetInfo.AllDependAssetInfos)
+ {
+ // 注意:依赖资源里只添加零依赖资源和冗余资源
+ if (dependAssetInfo.HasBundleName() == false)
+ {
+ if (result.Contains(dependAssetInfo.AssetPath) == false)
+ result.Add(dependAssetInfo.AssetPath);
+ }
+ }
+ }
+ return result;
+ }
- ///
- /// 创建AssetBundleBuild类
- ///
- public UnityEditor.AssetBundleBuild CreatePipelineBuild()
- {
- // 注意:我们不在支持AssetBundle的变种机制
- AssetBundleBuild build = new AssetBundleBuild();
- build.assetBundleName = BundleName;
- build.assetBundleVariant = string.Empty;
- build.assetNames = GetAllMainAssetPaths();
- return build;
- }
+ ///
+ /// 创建AssetBundleBuild类
+ ///
+ public UnityEditor.AssetBundleBuild CreatePipelineBuild()
+ {
+ // 注意:我们不在支持AssetBundle的变种机制
+ AssetBundleBuild build = new AssetBundleBuild();
+ build.assetBundleName = BundleName;
+ build.assetBundleVariant = string.Empty;
+ build.assetNames = GetAllMainAssetPaths();
+ return build;
+ }
- ///
- /// 获取所有写入补丁清单的资源
- ///
- public BuildAssetInfo[] GetAllManifestAssetInfos()
- {
- return MainAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
- }
+ ///
+ /// 获取所有写入补丁清单的资源
+ ///
+ public BuildAssetInfo[] GetAllManifestAssetInfos()
+ {
+ return MainAssets.Where(t => t.CollectorType == ECollectorType.MainAssetCollector).ToArray();
+ }
- ///
- /// 创建PackageBundle类
- ///
- internal PackageBundle CreatePackageBundle()
- {
- PackageBundle packageBundle = new PackageBundle();
- packageBundle.BundleName = BundleName;
- packageBundle.UnityCRC = PackageUnityCRC;
- packageBundle.FileHash = PackageFileHash;
- packageBundle.FileCRC = PackageFileCRC;
- packageBundle.FileSize = PackageFileSize;
- packageBundle.Encrypted = Encrypted;
- return packageBundle;
- }
- }
+ ///
+ /// 创建PackageBundle类
+ ///
+ internal PackageBundle CreatePackageBundle()
+ {
+ PackageBundle packageBundle = new PackageBundle();
+ packageBundle.BundleName = BundleName;
+ packageBundle.UnityCRC = PackageUnityCRC;
+ packageBundle.FileHash = PackageFileHash;
+ packageBundle.FileCRC = PackageFileCRC;
+ packageBundle.FileSize = PackageFileSize;
+ packageBundle.Encrypted = Encrypted;
+ return packageBundle;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs
index 784eb5e..a15833e 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildMapContext.cs
@@ -6,106 +6,106 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class BuildMapContext : IContextObject
- {
- ///
- /// 资源包集合
- ///
- private readonly Dictionary _bundleInfoDic = new Dictionary(10000);
+ public class BuildMapContext : IContextObject
+ {
+ ///
+ /// 资源包集合
+ ///
+ private readonly Dictionary _bundleInfoDic = new Dictionary(10000);
- ///
- /// 冗余的资源列表
- ///
- public readonly List RedundancyInfos = new List(1000);
+ ///
+ /// 冗余的资源列表
+ ///
+ public readonly List RedundancyInfos = new List(1000);
- ///
- /// 参与构建的资源总数
- /// 说明:包括主动收集的资源以及其依赖的所有资源
- ///
- public int AssetFileCount;
+ ///
+ /// 参与构建的资源总数
+ /// 说明:包括主动收集的资源以及其依赖的所有资源
+ ///
+ public int AssetFileCount;
- ///
- /// 资源收集命令
- ///
- public CollectCommand Command { set; get; }
+ ///
+ /// 资源收集命令
+ ///
+ public CollectCommand Command { set; get; }
- ///
- /// 资源包信息列表
- ///
- public Dictionary.ValueCollection Collection
- {
- get
- {
- return _bundleInfoDic.Values;
- }
- }
+ ///
+ /// 资源包信息列表
+ ///
+ public Dictionary.ValueCollection Collection
+ {
+ get
+ {
+ return _bundleInfoDic.Values;
+ }
+ }
- ///
- /// 添加一个打包资源
- ///
- public void PackAsset(BuildAssetInfo assetInfo)
- {
- string bundleName = assetInfo.BundleName;
- if (string.IsNullOrEmpty(bundleName))
- throw new Exception("Should never get here !");
+ ///
+ /// 添加一个打包资源
+ ///
+ public void PackAsset(BuildAssetInfo assetInfo)
+ {
+ string bundleName = assetInfo.BundleName;
+ if (string.IsNullOrEmpty(bundleName))
+ throw new Exception("Should never get here !");
- if (_bundleInfoDic.TryGetValue(bundleName, out BuildBundleInfo bundleInfo))
- {
- bundleInfo.PackAsset(assetInfo);
- }
- else
- {
- BuildBundleInfo newBundleInfo = new BuildBundleInfo(bundleName);
- newBundleInfo.PackAsset(assetInfo);
- _bundleInfoDic.Add(bundleName, newBundleInfo);
- }
- }
+ if (_bundleInfoDic.TryGetValue(bundleName, out BuildBundleInfo bundleInfo))
+ {
+ bundleInfo.PackAsset(assetInfo);
+ }
+ else
+ {
+ BuildBundleInfo newBundleInfo = new BuildBundleInfo(bundleName);
+ newBundleInfo.PackAsset(assetInfo);
+ _bundleInfoDic.Add(bundleName, newBundleInfo);
+ }
+ }
- ///
- /// 是否包含资源包
- ///
- public bool IsContainsBundle(string bundleName)
- {
- return _bundleInfoDic.ContainsKey(bundleName);
- }
+ ///
+ /// 是否包含资源包
+ ///
+ public bool IsContainsBundle(string bundleName)
+ {
+ return _bundleInfoDic.ContainsKey(bundleName);
+ }
- ///
- /// 获取资源包信息,如果没找到返回NULL
- ///
- public BuildBundleInfo GetBundleInfo(string bundleName)
- {
- if (_bundleInfoDic.TryGetValue(bundleName, out BuildBundleInfo result))
- {
- return result;
- }
- throw new Exception($"Should never get here ! Not found bundle : {bundleName}");
- }
+ ///
+ /// 获取资源包信息,如果没找到返回NULL
+ ///
+ public BuildBundleInfo GetBundleInfo(string bundleName)
+ {
+ if (_bundleInfoDic.TryGetValue(bundleName, out BuildBundleInfo result))
+ {
+ return result;
+ }
+ throw new Exception($"Should never get here ! Not found bundle : {bundleName}");
+ }
- ///
- /// 获取构建管线里需要的数据
- ///
- public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
- {
- List builds = new List(_bundleInfoDic.Count);
- foreach (var bundleInfo in _bundleInfoDic.Values)
- {
- builds.Add(bundleInfo.CreatePipelineBuild());
- }
- return builds.ToArray();
- }
+ ///
+ /// 获取构建管线里需要的数据
+ ///
+ public UnityEditor.AssetBundleBuild[] GetPipelineBuilds()
+ {
+ List builds = new List(_bundleInfoDic.Count);
+ foreach (var bundleInfo in _bundleInfoDic.Values)
+ {
+ builds.Add(bundleInfo.CreatePipelineBuild());
+ }
+ return builds.ToArray();
+ }
- ///
- /// 创建着色器信息类
- ///
- public void CreateShadersBundleInfo(string shadersBundleName)
- {
- if (IsContainsBundle(shadersBundleName) == false)
- {
- var shaderBundleInfo = new BuildBundleInfo(shadersBundleName);
- _bundleInfoDic.Add(shadersBundleName, shaderBundleInfo);
- }
- }
- }
+ ///
+ /// 创建着色器信息类
+ ///
+ public void CreateShadersBundleInfo(string shadersBundleName)
+ {
+ if (IsContainsBundle(shadersBundleName) == false)
+ {
+ var shaderBundleInfo = new BuildBundleInfo(shadersBundleName);
+ _bundleInfoDic.Add(shadersBundleName, shaderBundleInfo);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
index 4691dc8..4472e67 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
@@ -6,204 +6,204 @@ using UnityEditor;
namespace YooAsset.Editor
{
- ///
- /// 构建参数
- ///
- public abstract class BuildParameters
- {
- ///
- /// 构建输出的根目录
- ///
- public string BuildOutputRoot;
+ ///
+ /// 构建参数
+ ///
+ public abstract class BuildParameters
+ {
+ ///
+ /// 构建输出的根目录
+ ///
+ public string BuildOutputRoot;
- ///
- /// 内置文件的根目录
- ///
- public string BuildinFileRoot;
+ ///
+ /// 内置文件的根目录
+ ///
+ public string BuildinFileRoot;
- ///
- /// 构建管线
- ///
- public string BuildPipeline;
+ ///
+ /// 构建管线
+ ///
+ public string BuildPipeline;
- ///
- /// 构建的平台
- ///
- public BuildTarget BuildTarget;
+ ///
+ /// 构建的平台
+ ///
+ public BuildTarget BuildTarget;
- ///
- /// 构建模式
- ///
- public EBuildMode BuildMode;
+ ///
+ /// 构建模式
+ ///
+ public EBuildMode BuildMode;
- ///
- /// 构建的包裹名称
- ///
- public string PackageName;
+ ///
+ /// 构建的包裹名称
+ ///
+ public string PackageName;
- ///
- /// 构建的包裹版本
- ///
- public string PackageVersion;
+ ///
+ /// 构建的包裹版本
+ ///
+ public string PackageVersion;
- ///
- /// 验证构建结果
- ///
- public bool VerifyBuildingResult = false;
+ ///
+ /// 验证构建结果
+ ///
+ public bool VerifyBuildingResult = false;
- ///
- /// 资源包名称样式
- ///
- public EFileNameStyle FileNameStyle;
+ ///
+ /// 资源包名称样式
+ ///
+ public EFileNameStyle FileNameStyle;
- ///
- /// 内置文件的拷贝选项
- ///
- public EBuildinFileCopyOption BuildinFileCopyOption;
+ ///
+ /// 内置文件的拷贝选项
+ ///
+ public EBuildinFileCopyOption BuildinFileCopyOption;
- ///
- /// 内置文件的拷贝参数
- ///
- public string BuildinFileCopyParams;
+ ///
+ /// 内置文件的拷贝参数
+ ///
+ public string BuildinFileCopyParams;
- ///
- /// 资源包加密服务类
- ///
- public IEncryptionServices EncryptionServices;
+ ///
+ /// 资源包加密服务类
+ ///
+ public IEncryptionServices EncryptionServices;
- private string _pipelineOutputDirectory = string.Empty;
- private string _packageOutputDirectory = string.Empty;
- private string _packageRootDirectory = string.Empty;
- private string _buildinRootDirectory = string.Empty;
+ private string _pipelineOutputDirectory = string.Empty;
+ private string _packageOutputDirectory = string.Empty;
+ private string _packageRootDirectory = string.Empty;
+ private string _buildinRootDirectory = string.Empty;
- ///
- /// 检测构建参数是否合法
- ///
- public virtual void CheckBuildParameters()
- {
- // 检测当前是否正在构建资源包
- if (UnityEditor.BuildPipeline.isBuildingPlayer)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.ThePipelineIsBuiding, "The pipeline is buiding, please try again after finish !");
- throw new Exception(message);
- }
+ ///
+ /// 检测构建参数是否合法
+ ///
+ public virtual void CheckBuildParameters()
+ {
+ // 检测当前是否正在构建资源包
+ if (UnityEditor.BuildPipeline.isBuildingPlayer)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.ThePipelineIsBuiding, "The pipeline is buiding, please try again after finish !");
+ throw new Exception(message);
+ }
- // 检测是否有未保存场景
- if (BuildMode != EBuildMode.SimulateBuild)
- {
- if (EditorTools.HasDirtyScenes())
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.FoundUnsavedScene, "Found unsaved scene !");
- throw new Exception(message);
- }
- }
+ // 检测是否有未保存场景
+ if (BuildMode != EBuildMode.SimulateBuild)
+ {
+ if (EditorTools.HasDirtyScenes())
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.FoundUnsavedScene, "Found unsaved scene !");
+ throw new Exception(message);
+ }
+ }
- // 检测构建参数合法性
- if (BuildTarget == BuildTarget.NoTarget)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NoBuildTarget, "Please select the build target platform !");
- throw new Exception(message);
- }
- if (string.IsNullOrEmpty(PackageName))
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.PackageNameIsNullOrEmpty, "Package name is null or empty !");
- throw new Exception(message);
- }
- if (string.IsNullOrEmpty(PackageVersion))
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.PackageVersionIsNullOrEmpty, "Package version is null or empty !");
- throw new Exception(message);
- }
- if (string.IsNullOrEmpty(BuildOutputRoot))
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildOutputRootIsNullOrEmpty, "Build output root is null or empty !");
- throw new Exception(message);
- }
- if (string.IsNullOrEmpty(BuildinFileRoot))
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildinFileRootIsNullOrEmpty, "Buildin file root is null or empty !");
- throw new Exception(message);
- }
+ // 检测构建参数合法性
+ if (BuildTarget == BuildTarget.NoTarget)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NoBuildTarget, "Please select the build target platform !");
+ throw new Exception(message);
+ }
+ if (string.IsNullOrEmpty(PackageName))
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.PackageNameIsNullOrEmpty, "Package name is null or empty !");
+ throw new Exception(message);
+ }
+ if (string.IsNullOrEmpty(PackageVersion))
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.PackageVersionIsNullOrEmpty, "Package version is null or empty !");
+ throw new Exception(message);
+ }
+ if (string.IsNullOrEmpty(BuildOutputRoot))
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildOutputRootIsNullOrEmpty, "Build output root is null or empty !");
+ throw new Exception(message);
+ }
+ if (string.IsNullOrEmpty(BuildinFileRoot))
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildinFileRootIsNullOrEmpty, "Buildin file root is null or empty !");
+ throw new Exception(message);
+ }
- // 强制构建删除包裹目录
- if (BuildMode == EBuildMode.ForceRebuild)
- {
- string packageRootDirectory = GetPackageRootDirectory();
- if (EditorTools.DeleteDirectory(packageRootDirectory))
- {
- BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
- }
- }
+ // 强制构建删除包裹目录
+ if (BuildMode == EBuildMode.ForceRebuild)
+ {
+ string packageRootDirectory = GetPackageRootDirectory();
+ if (EditorTools.DeleteDirectory(packageRootDirectory))
+ {
+ BuildLogger.Log($"Delete package root directory: {packageRootDirectory}");
+ }
+ }
- // 检测包裹输出目录是否存在
- if (BuildMode != EBuildMode.SimulateBuild)
- {
- string packageOutputDirectory = GetPackageOutputDirectory();
- if (Directory.Exists(packageOutputDirectory))
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
- throw new Exception(message);
- }
- }
+ // 检测包裹输出目录是否存在
+ if (BuildMode != EBuildMode.SimulateBuild)
+ {
+ string packageOutputDirectory = GetPackageOutputDirectory();
+ if (Directory.Exists(packageOutputDirectory))
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.PackageOutputDirectoryExists, $"Package outout directory exists: {packageOutputDirectory}");
+ throw new Exception(message);
+ }
+ }
- // 如果输出目录不存在
- string pipelineOutputDirectory = GetPipelineOutputDirectory();
- if (EditorTools.CreateDirectory(pipelineOutputDirectory))
- {
- BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
- }
- }
+ // 如果输出目录不存在
+ string pipelineOutputDirectory = GetPipelineOutputDirectory();
+ if (EditorTools.CreateDirectory(pipelineOutputDirectory))
+ {
+ BuildLogger.Log($"Create pipeline output directory: {pipelineOutputDirectory}");
+ }
+ }
- ///
- /// 获取构建管线的输出目录
- ///
- ///
- public virtual string GetPipelineOutputDirectory()
- {
- if (string.IsNullOrEmpty(_pipelineOutputDirectory))
- {
- _pipelineOutputDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}/{YooAssetSettings.OutputFolderName}";
- }
- return _pipelineOutputDirectory;
- }
+ ///
+ /// 获取构建管线的输出目录
+ ///
+ ///
+ public virtual string GetPipelineOutputDirectory()
+ {
+ if (string.IsNullOrEmpty(_pipelineOutputDirectory))
+ {
+ _pipelineOutputDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}/{YooAssetSettings.OutputFolderName}";
+ }
+ return _pipelineOutputDirectory;
+ }
- ///
- /// 获取本次构建的补丁输出目录
- ///
- public virtual string GetPackageOutputDirectory()
- {
- if (string.IsNullOrEmpty(_packageOutputDirectory))
- {
- _packageOutputDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}/{PackageVersion}";
- }
- return _packageOutputDirectory;
- }
+ ///
+ /// 获取本次构建的补丁输出目录
+ ///
+ public virtual string GetPackageOutputDirectory()
+ {
+ if (string.IsNullOrEmpty(_packageOutputDirectory))
+ {
+ _packageOutputDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}/{PackageVersion}";
+ }
+ return _packageOutputDirectory;
+ }
- ///
- /// 获取本次构建的补丁根目录
- ///
- public virtual string GetPackageRootDirectory()
- {
- if (string.IsNullOrEmpty(_packageRootDirectory))
- {
- _packageRootDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}";
- }
- return _packageRootDirectory;
- }
+ ///
+ /// 获取本次构建的补丁根目录
+ ///
+ public virtual string GetPackageRootDirectory()
+ {
+ if (string.IsNullOrEmpty(_packageRootDirectory))
+ {
+ _packageRootDirectory = $"{BuildOutputRoot}/{BuildTarget}/{PackageName}";
+ }
+ return _packageRootDirectory;
+ }
- ///
- /// 获取内置资源的根目录
- ///
- public virtual string GetBuildinRootDirectory()
- {
- if (string.IsNullOrEmpty(_buildinRootDirectory))
- {
- _buildinRootDirectory = $"{BuildinFileRoot}/{PackageName}";
- }
- return _buildinRootDirectory;
- }
- }
+ ///
+ /// 获取内置资源的根目录
+ ///
+ public virtual string GetBuildinRootDirectory()
+ {
+ if (string.IsNullOrEmpty(_buildinRootDirectory))
+ {
+ _buildinRootDirectory = $"{BuildinFileRoot}/{PackageName}";
+ }
+ return _buildinRootDirectory;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs
index 1cbd3f7..07aa652 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs
@@ -6,58 +6,58 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class BuildParametersContext : IContextObject
- {
- ///
- /// 构建参数
- ///
- public BuildParameters Parameters { private set; get; }
+ public class BuildParametersContext : IContextObject
+ {
+ ///
+ /// 构建参数
+ ///
+ public BuildParameters Parameters { private set; get; }
- public BuildParametersContext(BuildParameters parameters)
- {
- Parameters = parameters;
- }
+ public BuildParametersContext(BuildParameters parameters)
+ {
+ Parameters = parameters;
+ }
- ///
- /// 检测构建参数是否合法
- ///
- public void CheckBuildParameters()
- {
- Parameters.CheckBuildParameters();
- }
+ ///
+ /// 检测构建参数是否合法
+ ///
+ public void CheckBuildParameters()
+ {
+ Parameters.CheckBuildParameters();
+ }
- ///
- /// 获取构建管线的输出目录
- ///
- ///
- public string GetPipelineOutputDirectory()
- {
- return Parameters.GetPipelineOutputDirectory();
- }
+ ///
+ /// 获取构建管线的输出目录
+ ///
+ ///
+ public string GetPipelineOutputDirectory()
+ {
+ return Parameters.GetPipelineOutputDirectory();
+ }
- ///
- /// 获取本次构建的补丁输出目录
- ///
- public string GetPackageOutputDirectory()
- {
- return Parameters.GetPackageOutputDirectory();
- }
+ ///
+ /// 获取本次构建的补丁输出目录
+ ///
+ public string GetPackageOutputDirectory()
+ {
+ return Parameters.GetPackageOutputDirectory();
+ }
- ///
- /// 获取本次构建的补丁根目录
- ///
- public string GetPackageRootDirectory()
- {
- return Parameters.GetPackageRootDirectory();
- }
+ ///
+ /// 获取本次构建的补丁根目录
+ ///
+ public string GetPackageRootDirectory()
+ {
+ return Parameters.GetPackageRootDirectory();
+ }
- ///
- /// 获取内置资源的根目录
- ///
- public string GetBuildinRootDirectory()
- {
- return Parameters.GetBuildinRootDirectory();
- }
- }
+ ///
+ /// 获取内置资源的根目录
+ ///
+ public string GetBuildinRootDirectory()
+ {
+ return Parameters.GetBuildinRootDirectory();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCopyBuildinFiles.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCopyBuildinFiles.cs
index 430d54d..4579410 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCopyBuildinFiles.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCopyBuildinFiles.cs
@@ -6,77 +6,77 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskCopyBuildinFiles
- {
- ///
- /// 拷贝首包资源文件
- ///
- internal void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext, PackageManifest manifest)
- {
- EBuildinFileCopyOption copyOption = buildParametersContext.Parameters.BuildinFileCopyOption;
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
- string buildPackageName = buildParametersContext.Parameters.PackageName;
- string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
+ public class TaskCopyBuildinFiles
+ {
+ ///
+ /// 拷贝首包资源文件
+ ///
+ internal void CopyBuildinFilesToStreaming(BuildParametersContext buildParametersContext, PackageManifest manifest)
+ {
+ EBuildinFileCopyOption copyOption = buildParametersContext.Parameters.BuildinFileCopyOption;
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
+ string buildPackageName = buildParametersContext.Parameters.PackageName;
+ string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
- // 清空内置文件的目录
- if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.ClearAndCopyByTags)
- {
- EditorTools.ClearFolder(buildinRootDirectory);
- }
+ // 清空内置文件的目录
+ if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.ClearAndCopyByTags)
+ {
+ EditorTools.ClearFolder(buildinRootDirectory);
+ }
- // 拷贝补丁清单文件
- {
- string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildPackageName, buildPackageVersion);
- string sourcePath = $"{packageOutputDirectory}/{fileName}";
- string destPath = $"{buildinRootDirectory}/{fileName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝补丁清单文件
+ {
+ string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildPackageName, buildPackageVersion);
+ string sourcePath = $"{packageOutputDirectory}/{fileName}";
+ string destPath = $"{buildinRootDirectory}/{fileName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝补丁清单哈希文件
- {
- string fileName = YooAssetSettingsData.GetPackageHashFileName(buildPackageName, buildPackageVersion);
- string sourcePath = $"{packageOutputDirectory}/{fileName}";
- string destPath = $"{buildinRootDirectory}/{fileName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝补丁清单哈希文件
+ {
+ string fileName = YooAssetSettingsData.GetPackageHashFileName(buildPackageName, buildPackageVersion);
+ string sourcePath = $"{packageOutputDirectory}/{fileName}";
+ string destPath = $"{buildinRootDirectory}/{fileName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝补丁清单版本文件
- {
- string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildPackageName);
- string sourcePath = $"{packageOutputDirectory}/{fileName}";
- string destPath = $"{buildinRootDirectory}/{fileName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝补丁清单版本文件
+ {
+ string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildPackageName);
+ string sourcePath = $"{packageOutputDirectory}/{fileName}";
+ string destPath = $"{buildinRootDirectory}/{fileName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝文件列表(所有文件)
- if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.OnlyCopyAll)
- {
- foreach (var packageBundle in manifest.BundleList)
- {
- string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
- string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
- }
+ // 拷贝文件列表(所有文件)
+ if (copyOption == EBuildinFileCopyOption.ClearAndCopyAll || copyOption == EBuildinFileCopyOption.OnlyCopyAll)
+ {
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
+ string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
+ }
- // 拷贝文件列表(带标签的文件)
- if (copyOption == EBuildinFileCopyOption.ClearAndCopyByTags || copyOption == EBuildinFileCopyOption.OnlyCopyByTags)
- {
- string[] tags = buildParametersContext.Parameters.BuildinFileCopyParams.Split(';');
- foreach (var packageBundle in manifest.BundleList)
- {
- if (packageBundle.HasTag(tags) == false)
- continue;
- string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
- string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
- }
+ // 拷贝文件列表(带标签的文件)
+ if (copyOption == EBuildinFileCopyOption.ClearAndCopyByTags || copyOption == EBuildinFileCopyOption.OnlyCopyByTags)
+ {
+ string[] tags = buildParametersContext.Parameters.BuildinFileCopyParams.Split(';');
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ if (packageBundle.HasTag(tags) == false)
+ continue;
+ string sourcePath = $"{packageOutputDirectory}/{packageBundle.FileName}";
+ string destPath = $"{buildinRootDirectory}/{packageBundle.FileName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
+ }
- // 刷新目录
- AssetDatabase.Refresh();
- BuildLogger.Log($"Buildin files copy complete: {buildinRootDirectory}");
- }
- }
+ // 刷新目录
+ AssetDatabase.Refresh();
+ BuildLogger.Log($"Buildin files copy complete: {buildinRootDirectory}");
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
index 10f3cdf..05cdb2c 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
@@ -5,215 +5,215 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class ManifestContext : IContextObject
- {
- internal PackageManifest Manifest;
- }
+ public class ManifestContext : IContextObject
+ {
+ internal PackageManifest Manifest;
+ }
- public abstract class TaskCreateManifest
- {
- private readonly Dictionary _cachedBundleID = new Dictionary(10000);
- private readonly Dictionary> _cacheBundleTags = new Dictionary>(10000);
+ public abstract class TaskCreateManifest
+ {
+ private readonly Dictionary _cachedBundleID = new Dictionary(10000);
+ private readonly Dictionary> _cacheBundleTags = new Dictionary>(10000);
- ///
- /// 创建补丁清单文件到输出目录
- ///
- protected void CreateManifestFile(BuildContext context)
- {
- var buildMapContext = context.GetContextObject();
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters;
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ ///
+ /// 创建补丁清单文件到输出目录
+ ///
+ protected void CreateManifestFile(BuildContext context)
+ {
+ var buildMapContext = context.GetContextObject();
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters;
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- // 创建新补丁清单
- PackageManifest manifest = new PackageManifest();
- manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
- manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
- manifest.LocationToLower = buildMapContext.Command.LocationToLower;
- manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
- manifest.OutputNameStyle = (int)buildParameters.FileNameStyle;
- manifest.BuildPipeline = buildParameters.BuildPipeline;
- manifest.PackageName = buildParameters.PackageName;
- manifest.PackageVersion = buildParameters.PackageVersion;
- manifest.BundleList = GetAllPackageBundle(buildMapContext);
- manifest.AssetList = GetAllPackageAsset(buildMapContext);
+ // 创建新补丁清单
+ PackageManifest manifest = new PackageManifest();
+ manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
+ manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
+ manifest.LocationToLower = buildMapContext.Command.LocationToLower;
+ manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
+ manifest.OutputNameStyle = (int)buildParameters.FileNameStyle;
+ manifest.BuildPipeline = buildParameters.BuildPipeline;
+ manifest.PackageName = buildParameters.PackageName;
+ manifest.PackageVersion = buildParameters.PackageVersion;
+ manifest.BundleList = GetAllPackageBundle(buildMapContext);
+ manifest.AssetList = GetAllPackageAsset(buildMapContext);
- if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
- {
- // 处理资源包的依赖列表
- ProcessBundleDepends(context, manifest);
+ if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
+ {
+ // 处理资源包的依赖列表
+ ProcessBundleDepends(context, manifest);
- // 处理资源包的标签集合
- ProcessBundleTags(manifest);
- }
+ // 处理资源包的标签集合
+ ProcessBundleTags(manifest);
+ }
- // 创建补丁清单文本文件
- {
- string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string filePath = $"{packageOutputDirectory}/{fileName}";
- ManifestTools.SerializeToJson(filePath, manifest);
- BuildLogger.Log($"Create package manifest file: {filePath}");
- }
+ // 创建补丁清单文本文件
+ {
+ string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string filePath = $"{packageOutputDirectory}/{fileName}";
+ ManifestTools.SerializeToJson(filePath, manifest);
+ BuildLogger.Log($"Create package manifest file: {filePath}");
+ }
- // 创建补丁清单二进制文件
- string packageHash;
- {
- string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string filePath = $"{packageOutputDirectory}/{fileName}";
- ManifestTools.SerializeToBinary(filePath, manifest);
- packageHash = HashUtility.FileMD5(filePath);
- BuildLogger.Log($"Create package manifest file: {filePath}");
+ // 创建补丁清单二进制文件
+ string packageHash;
+ {
+ string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string filePath = $"{packageOutputDirectory}/{fileName}";
+ ManifestTools.SerializeToBinary(filePath, manifest);
+ packageHash = HashUtility.FileMD5(filePath);
+ BuildLogger.Log($"Create package manifest file: {filePath}");
- ManifestContext manifestContext = new ManifestContext();
- byte[] bytesData = FileUtility.ReadAllBytes(filePath);
- manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData);
- context.SetContextObject(manifestContext);
- }
+ ManifestContext manifestContext = new ManifestContext();
+ byte[] bytesData = FileUtility.ReadAllBytes(filePath);
+ manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData);
+ context.SetContextObject(manifestContext);
+ }
- // 创建补丁清单哈希文件
- {
- string fileName = YooAssetSettingsData.GetPackageHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string filePath = $"{packageOutputDirectory}/{fileName}";
- FileUtility.WriteAllText(filePath, packageHash);
- BuildLogger.Log($"Create package manifest hash file: {filePath}");
- }
+ // 创建补丁清单哈希文件
+ {
+ string fileName = YooAssetSettingsData.GetPackageHashFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string filePath = $"{packageOutputDirectory}/{fileName}";
+ FileUtility.WriteAllText(filePath, packageHash);
+ BuildLogger.Log($"Create package manifest hash file: {filePath}");
+ }
- // 创建补丁清单版本文件
- {
- string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildParameters.PackageName);
- string filePath = $"{packageOutputDirectory}/{fileName}";
- FileUtility.WriteAllText(filePath, buildParameters.PackageVersion);
- BuildLogger.Log($"Create package manifest version file: {filePath}");
- }
- }
+ // 创建补丁清单版本文件
+ {
+ string fileName = YooAssetSettingsData.GetPackageVersionFileName(buildParameters.PackageName);
+ string filePath = $"{packageOutputDirectory}/{fileName}";
+ FileUtility.WriteAllText(filePath, buildParameters.PackageVersion);
+ BuildLogger.Log($"Create package manifest version file: {filePath}");
+ }
+ }
- ///
- /// 获取资源包的依赖集合
- ///
- protected abstract string[] GetBundleDepends(BuildContext context, string bundleName);
+ ///
+ /// 获取资源包的依赖集合
+ ///
+ protected abstract string[] GetBundleDepends(BuildContext context, string bundleName);
- ///
- /// 获取主资源对象列表
- ///
- private List GetAllPackageAsset(BuildMapContext buildMapContext)
- {
- List result = new List(1000);
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- var assetInfos = bundleInfo.GetAllManifestAssetInfos();
- foreach (var assetInfo in assetInfos)
- {
- PackageAsset packageAsset = new PackageAsset();
- packageAsset.Address = buildMapContext.Command.EnableAddressable ? assetInfo.Address : string.Empty;
- packageAsset.AssetPath = assetInfo.AssetPath;
- packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetGUID : string.Empty;
- packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
- packageAsset.BundleID = GetCachedBundleID(assetInfo.BundleName);
- result.Add(packageAsset);
- }
- }
- return result;
- }
+ ///
+ /// 获取主资源对象列表
+ ///
+ private List GetAllPackageAsset(BuildMapContext buildMapContext)
+ {
+ List result = new List(1000);
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ var assetInfos = bundleInfo.GetAllManifestAssetInfos();
+ foreach (var assetInfo in assetInfos)
+ {
+ PackageAsset packageAsset = new PackageAsset();
+ packageAsset.Address = buildMapContext.Command.EnableAddressable ? assetInfo.Address : string.Empty;
+ packageAsset.AssetPath = assetInfo.AssetPath;
+ packageAsset.AssetGUID = buildMapContext.Command.IncludeAssetGUID ? assetInfo.AssetGUID : string.Empty;
+ packageAsset.AssetTags = assetInfo.AssetTags.ToArray();
+ packageAsset.BundleID = GetCachedBundleID(assetInfo.BundleName);
+ result.Add(packageAsset);
+ }
+ }
+ return result;
+ }
- ///
- /// 获取资源包列表
- ///
- private List GetAllPackageBundle(BuildMapContext buildMapContext)
- {
- List result = new List(1000);
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- var packageBundle = bundleInfo.CreatePackageBundle();
- result.Add(packageBundle);
- }
+ ///
+ /// 获取资源包列表
+ ///
+ private List GetAllPackageBundle(BuildMapContext buildMapContext)
+ {
+ List result = new List(1000);
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ var packageBundle = bundleInfo.CreatePackageBundle();
+ result.Add(packageBundle);
+ }
- // 注意:缓存资源包索引
- for (int index = 0; index < result.Count; index++)
- {
- string bundleName = result[index].BundleName;
- _cachedBundleID.Add(bundleName, index);
- }
+ // 注意:缓存资源包索引
+ for (int index = 0; index < result.Count; index++)
+ {
+ string bundleName = result[index].BundleName;
+ _cachedBundleID.Add(bundleName, index);
+ }
- return result;
- }
+ return result;
+ }
- ///
- /// 处理资源包的依赖集合
- ///
- private void ProcessBundleDepends(BuildContext context, PackageManifest manifest)
- {
- // 查询引擎生成的资源包依赖关系,然后记录到清单
- foreach (var packageBundle in manifest.BundleList)
- {
- int mainBundleID = GetCachedBundleID(packageBundle.BundleName);
- var depends = GetBundleDepends(context, packageBundle.BundleName);
- List dependIDs = new List(depends.Length);
- foreach (var dependBundleName in depends)
- {
- int bundleID = GetCachedBundleID(dependBundleName);
- if (bundleID != mainBundleID)
- dependIDs.Add(bundleID);
- }
- packageBundle.DependIDs = dependIDs.ToArray();
- }
- }
+ ///
+ /// 处理资源包的依赖集合
+ ///
+ private void ProcessBundleDepends(BuildContext context, PackageManifest manifest)
+ {
+ // 查询引擎生成的资源包依赖关系,然后记录到清单
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ int mainBundleID = GetCachedBundleID(packageBundle.BundleName);
+ var depends = GetBundleDepends(context, packageBundle.BundleName);
+ List dependIDs = new List(depends.Length);
+ foreach (var dependBundleName in depends)
+ {
+ int bundleID = GetCachedBundleID(dependBundleName);
+ if (bundleID != mainBundleID)
+ dependIDs.Add(bundleID);
+ }
+ packageBundle.DependIDs = dependIDs.ToArray();
+ }
+ }
- ///
- /// 处理资源包的标签集合
- ///
- private void ProcessBundleTags(PackageManifest manifest)
- {
- // 将主资源的标签信息传染给其依赖的资源包集合
- foreach (var packageAsset in manifest.AssetList)
- {
- var assetTags = packageAsset.AssetTags;
- int bundleID = packageAsset.BundleID;
- CacheBundleTags(bundleID, assetTags);
+ ///
+ /// 处理资源包的标签集合
+ ///
+ private void ProcessBundleTags(PackageManifest manifest)
+ {
+ // 将主资源的标签信息传染给其依赖的资源包集合
+ foreach (var packageAsset in manifest.AssetList)
+ {
+ var assetTags = packageAsset.AssetTags;
+ int bundleID = packageAsset.BundleID;
+ CacheBundleTags(bundleID, assetTags);
- var packageBundle = manifest.BundleList[bundleID];
- foreach (var dependBundleID in packageBundle.DependIDs)
- {
- CacheBundleTags(dependBundleID, assetTags);
- }
- }
+ var packageBundle = manifest.BundleList[bundleID];
+ foreach (var dependBundleID in packageBundle.DependIDs)
+ {
+ CacheBundleTags(dependBundleID, assetTags);
+ }
+ }
- for (int index = 0; index < manifest.BundleList.Count; index++)
- {
- var packageBundle = manifest.BundleList[index];
- if (_cacheBundleTags.ContainsKey(index))
- {
- packageBundle.Tags = _cacheBundleTags[index].ToArray();
- }
- else
- {
- // 注意:SBP构建管线会自动剔除一些冗余资源的引用关系,导致游离资源包没有被任何主资源包引用。
- string warning = BuildLogger.GetErrorMessage(ErrorCode.FoundStrayBundle, $"Found stray bundle ! Bundle ID : {index} Bundle name : {packageBundle.BundleName}");
- BuildLogger.Warning(warning);
- }
- }
- }
- private void CacheBundleTags(int bundleID, string[] assetTags)
- {
- if (_cacheBundleTags.ContainsKey(bundleID) == false)
- _cacheBundleTags.Add(bundleID, new HashSet());
+ for (int index = 0; index < manifest.BundleList.Count; index++)
+ {
+ var packageBundle = manifest.BundleList[index];
+ if (_cacheBundleTags.ContainsKey(index))
+ {
+ packageBundle.Tags = _cacheBundleTags[index].ToArray();
+ }
+ else
+ {
+ // 注意:SBP构建管线会自动剔除一些冗余资源的引用关系,导致游离资源包没有被任何主资源包引用。
+ string warning = BuildLogger.GetErrorMessage(ErrorCode.FoundStrayBundle, $"Found stray bundle ! Bundle ID : {index} Bundle name : {packageBundle.BundleName}");
+ BuildLogger.Warning(warning);
+ }
+ }
+ }
+ private void CacheBundleTags(int bundleID, string[] assetTags)
+ {
+ if (_cacheBundleTags.ContainsKey(bundleID) == false)
+ _cacheBundleTags.Add(bundleID, new HashSet());
- foreach (var assetTag in assetTags)
- {
- if (_cacheBundleTags[bundleID].Contains(assetTag) == false)
- _cacheBundleTags[bundleID].Add(assetTag);
- }
- }
+ foreach (var assetTag in assetTags)
+ {
+ if (_cacheBundleTags[bundleID].Contains(assetTag) == false)
+ _cacheBundleTags[bundleID].Add(assetTag);
+ }
+ }
- ///
- /// 获取资源包的索引ID
- ///
- private int GetCachedBundleID(string bundleName)
- {
- if (_cachedBundleID.TryGetValue(bundleName, out int value) == false)
- {
- throw new Exception($"Should never get here ! Not found bundle ID : {bundleName}");
- }
- return value;
- }
- }
+ ///
+ /// 获取资源包的索引ID
+ ///
+ private int GetCachedBundleID(string bundleName)
+ {
+ if (_cachedBundleID.TryGetValue(bundleName, out int value) == false)
+ {
+ throw new Exception($"Should never get here ! Not found bundle ID : {bundleName}");
+ }
+ return value;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs
index b462c73..71d3513 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateReport.cs
@@ -6,205 +6,205 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskCreateReport
- {
- protected void CreateReportFile(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext, ManifestContext manifestContext)
- {
- var buildParameters = buildParametersContext.Parameters;
+ public class TaskCreateReport
+ {
+ protected void CreateReportFile(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext, ManifestContext manifestContext)
+ {
+ var buildParameters = buildParametersContext.Parameters;
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- PackageManifest manifest = manifestContext.Manifest;
- BuildReport buildReport = new BuildReport();
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ PackageManifest manifest = manifestContext.Manifest;
+ BuildReport buildReport = new BuildReport();
- // 概述信息
- {
+ // 概述信息
+ {
#if UNITY_2019_4_OR_NEWER
- UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(BuildReport).Assembly);
- if (packageInfo != null)
- buildReport.Summary.YooVersion = packageInfo.version;
+ UnityEditor.PackageManager.PackageInfo packageInfo = UnityEditor.PackageManager.PackageInfo.FindForAssembly(typeof(BuildReport).Assembly);
+ if (packageInfo != null)
+ buildReport.Summary.YooVersion = packageInfo.version;
#endif
- buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
- buildReport.Summary.BuildDate = DateTime.Now.ToString();
- buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
- buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
- buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
- buildReport.Summary.BuildMode = buildParameters.BuildMode;
- buildReport.Summary.BuildPackageName = buildParameters.PackageName;
- buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
- buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
- buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
- buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
- buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
- buildReport.Summary.IgnoreDefaultType = buildMapContext.Command.IgnoreDefaultType;
- buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
- buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ?
- "null" : buildParameters.EncryptionServices.GetType().FullName;
+ buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
+ buildReport.Summary.BuildDate = DateTime.Now.ToString();
+ buildReport.Summary.BuildSeconds = BuildRunner.TotalSeconds;
+ buildReport.Summary.BuildTarget = buildParameters.BuildTarget;
+ buildReport.Summary.BuildPipeline = buildParameters.BuildPipeline;
+ buildReport.Summary.BuildMode = buildParameters.BuildMode;
+ buildReport.Summary.BuildPackageName = buildParameters.PackageName;
+ buildReport.Summary.BuildPackageVersion = buildParameters.PackageVersion;
+ buildReport.Summary.UniqueBundleName = buildMapContext.Command.UniqueBundleName;
+ buildReport.Summary.EnableAddressable = buildMapContext.Command.EnableAddressable;
+ buildReport.Summary.LocationToLower = buildMapContext.Command.LocationToLower;
+ buildReport.Summary.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
+ buildReport.Summary.IgnoreDefaultType = buildMapContext.Command.IgnoreDefaultType;
+ buildReport.Summary.AutoCollectShaders = buildMapContext.Command.AutoCollectShaders;
+ buildReport.Summary.EncryptionClassName = buildParameters.EncryptionServices == null ?
+ "null" : buildParameters.EncryptionServices.GetType().FullName;
- // 构建参数
- if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
- {
- var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
- buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
- buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
- buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
- buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
- }
- else if (buildParameters.BuildPipeline == nameof(ScriptableBuildPipeline))
- {
- var scriptableBuildParameters = buildParameters as ScriptableBuildParameters;
- buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
- buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
- buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
- buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
- }
- else
- {
- buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
- buildReport.Summary.CompressOption = ECompressOption.Uncompressed;
- buildReport.Summary.DisableWriteTypeTree = false;
- buildReport.Summary.IgnoreTypeTreeChanges = false;
- }
+ // 构建参数
+ if (buildParameters.BuildPipeline == nameof(BuiltinBuildPipeline))
+ {
+ var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
+ buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
+ buildReport.Summary.CompressOption = builtinBuildParameters.CompressOption;
+ buildReport.Summary.DisableWriteTypeTree = builtinBuildParameters.DisableWriteTypeTree;
+ buildReport.Summary.IgnoreTypeTreeChanges = builtinBuildParameters.IgnoreTypeTreeChanges;
+ }
+ else if (buildParameters.BuildPipeline == nameof(ScriptableBuildPipeline))
+ {
+ var scriptableBuildParameters = buildParameters as ScriptableBuildParameters;
+ buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
+ buildReport.Summary.CompressOption = scriptableBuildParameters.CompressOption;
+ buildReport.Summary.DisableWriteTypeTree = scriptableBuildParameters.DisableWriteTypeTree;
+ buildReport.Summary.IgnoreTypeTreeChanges = scriptableBuildParameters.IgnoreTypeTreeChanges;
+ }
+ else
+ {
+ buildReport.Summary.FileNameStyle = buildParameters.FileNameStyle;
+ buildReport.Summary.CompressOption = ECompressOption.Uncompressed;
+ buildReport.Summary.DisableWriteTypeTree = false;
+ buildReport.Summary.IgnoreTypeTreeChanges = false;
+ }
- // 构建结果
- buildReport.Summary.AssetFileTotalCount = buildMapContext.AssetFileCount;
- buildReport.Summary.MainAssetTotalCount = GetMainAssetCount(manifest);
- buildReport.Summary.AllBundleTotalCount = GetAllBundleCount(manifest);
- buildReport.Summary.AllBundleTotalSize = GetAllBundleSize(manifest);
- buildReport.Summary.EncryptedBundleTotalCount = GetEncryptedBundleCount(manifest);
- buildReport.Summary.EncryptedBundleTotalSize = GetEncryptedBundleSize(manifest);
- }
+ // 构建结果
+ buildReport.Summary.AssetFileTotalCount = buildMapContext.AssetFileCount;
+ buildReport.Summary.MainAssetTotalCount = GetMainAssetCount(manifest);
+ buildReport.Summary.AllBundleTotalCount = GetAllBundleCount(manifest);
+ buildReport.Summary.AllBundleTotalSize = GetAllBundleSize(manifest);
+ buildReport.Summary.EncryptedBundleTotalCount = GetEncryptedBundleCount(manifest);
+ buildReport.Summary.EncryptedBundleTotalSize = GetEncryptedBundleSize(manifest);
+ }
- // 资源对象列表
- buildReport.AssetInfos = new List(manifest.AssetList.Count);
- foreach (var packageAsset in manifest.AssetList)
- {
- var mainBundle = manifest.BundleList[packageAsset.BundleID];
- ReportAssetInfo reportAssetInfo = new ReportAssetInfo();
- reportAssetInfo.Address = packageAsset.Address;
- reportAssetInfo.AssetPath = packageAsset.AssetPath;
- reportAssetInfo.AssetTags = packageAsset.AssetTags;
- reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(packageAsset.AssetPath);
- reportAssetInfo.MainBundleName = mainBundle.BundleName;
- reportAssetInfo.MainBundleSize = mainBundle.FileSize;
- reportAssetInfo.DependAssets = GetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
- buildReport.AssetInfos.Add(reportAssetInfo);
- }
+ // 资源对象列表
+ buildReport.AssetInfos = new List(manifest.AssetList.Count);
+ foreach (var packageAsset in manifest.AssetList)
+ {
+ var mainBundle = manifest.BundleList[packageAsset.BundleID];
+ ReportAssetInfo reportAssetInfo = new ReportAssetInfo();
+ reportAssetInfo.Address = packageAsset.Address;
+ reportAssetInfo.AssetPath = packageAsset.AssetPath;
+ reportAssetInfo.AssetTags = packageAsset.AssetTags;
+ reportAssetInfo.AssetGUID = AssetDatabase.AssetPathToGUID(packageAsset.AssetPath);
+ reportAssetInfo.MainBundleName = mainBundle.BundleName;
+ reportAssetInfo.MainBundleSize = mainBundle.FileSize;
+ reportAssetInfo.DependAssets = GetDependAssets(buildMapContext, mainBundle.BundleName, packageAsset.AssetPath);
+ buildReport.AssetInfos.Add(reportAssetInfo);
+ }
- // 资源包列表
- buildReport.BundleInfos = new List(manifest.BundleList.Count);
- foreach (var packageBundle in manifest.BundleList)
- {
- ReportBundleInfo reportBundleInfo = new ReportBundleInfo();
- reportBundleInfo.BundleName = packageBundle.BundleName;
- reportBundleInfo.FileName = packageBundle.FileName;
- reportBundleInfo.FileHash = packageBundle.FileHash;
- reportBundleInfo.FileCRC = packageBundle.FileCRC;
- reportBundleInfo.FileSize = packageBundle.FileSize;
- reportBundleInfo.Encrypted = packageBundle.Encrypted;
- reportBundleInfo.Tags = packageBundle.Tags;
- reportBundleInfo.DependBundles = GetDependBundles(manifest, packageBundle);
- reportBundleInfo.AllBuiltinAssets = GetAllBuiltinAssets(buildMapContext, packageBundle.BundleName);
- buildReport.BundleInfos.Add(reportBundleInfo);
- }
+ // 资源包列表
+ buildReport.BundleInfos = new List(manifest.BundleList.Count);
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ ReportBundleInfo reportBundleInfo = new ReportBundleInfo();
+ reportBundleInfo.BundleName = packageBundle.BundleName;
+ reportBundleInfo.FileName = packageBundle.FileName;
+ reportBundleInfo.FileHash = packageBundle.FileHash;
+ reportBundleInfo.FileCRC = packageBundle.FileCRC;
+ reportBundleInfo.FileSize = packageBundle.FileSize;
+ reportBundleInfo.Encrypted = packageBundle.Encrypted;
+ reportBundleInfo.Tags = packageBundle.Tags;
+ reportBundleInfo.DependBundles = GetDependBundles(manifest, packageBundle);
+ reportBundleInfo.AllBuiltinAssets = GetAllBuiltinAssets(buildMapContext, packageBundle.BundleName);
+ buildReport.BundleInfos.Add(reportBundleInfo);
+ }
- // 冗余资源列表
- buildReport.RedundancyInfos = new List(buildMapContext.RedundancyInfos);
+ // 冗余资源列表
+ buildReport.RedundancyInfos = new List(buildMapContext.RedundancyInfos);
- // 序列化文件
- string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
- string filePath = $"{packageOutputDirectory}/{fileName}";
- BuildReport.Serialize(filePath, buildReport);
- BuildLogger.Log($"Create build report file: {filePath}");
- }
+ // 序列化文件
+ string fileName = YooAssetSettingsData.GetReportFileName(buildParameters.PackageName, buildParameters.PackageVersion);
+ string filePath = $"{packageOutputDirectory}/{fileName}";
+ BuildReport.Serialize(filePath, buildReport);
+ BuildLogger.Log($"Create build report file: {filePath}");
+ }
- ///
- /// 获取资源对象依赖的所有资源包
- ///
- private List GetDependBundles(PackageManifest manifest, PackageBundle packageBundle)
- {
- List dependBundles = new List(packageBundle.DependIDs.Length);
- foreach (int index in packageBundle.DependIDs)
- {
- string dependBundleName = manifest.BundleList[index].BundleName;
- dependBundles.Add(dependBundleName);
- }
- return dependBundles;
- }
+ ///
+ /// 获取资源对象依赖的所有资源包
+ ///
+ private List GetDependBundles(PackageManifest manifest, PackageBundle packageBundle)
+ {
+ List dependBundles = new List(packageBundle.DependIDs.Length);
+ foreach (int index in packageBundle.DependIDs)
+ {
+ string dependBundleName = manifest.BundleList[index].BundleName;
+ dependBundles.Add(dependBundleName);
+ }
+ return dependBundles;
+ }
- ///
- /// 获取资源对象依赖的其它所有资源
- ///
- private List GetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
- {
- List result = new List();
- var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
- {
- BuildAssetInfo findAssetInfo = null;
- foreach (var assetInfo in bundleInfo.MainAssets)
- {
- if (assetInfo.AssetPath == assetPath)
- {
- findAssetInfo = assetInfo;
- break;
- }
- }
- if (findAssetInfo == null)
- {
- throw new Exception($"Should never get here ! Not found asset {assetPath} in bunlde {bundleName}");
- }
- foreach (var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
- {
- result.Add(dependAssetInfo.AssetPath);
- }
- }
- return result;
- }
+ ///
+ /// 获取资源对象依赖的其它所有资源
+ ///
+ private List GetDependAssets(BuildMapContext buildMapContext, string bundleName, string assetPath)
+ {
+ List result = new List();
+ var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
+ {
+ BuildAssetInfo findAssetInfo = null;
+ foreach (var assetInfo in bundleInfo.MainAssets)
+ {
+ if (assetInfo.AssetPath == assetPath)
+ {
+ findAssetInfo = assetInfo;
+ break;
+ }
+ }
+ if (findAssetInfo == null)
+ {
+ throw new Exception($"Should never get here ! Not found asset {assetPath} in bunlde {bundleName}");
+ }
+ foreach (var dependAssetInfo in findAssetInfo.AllDependAssetInfos)
+ {
+ result.Add(dependAssetInfo.AssetPath);
+ }
+ }
+ return result;
+ }
- ///
- /// 获取该资源包内的所有资源
- ///
- private List GetAllBuiltinAssets(BuildMapContext buildMapContext, string bundleName)
- {
- var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
- return bundleInfo.GetAllBuiltinAssetPaths();
- }
+ ///
+ /// 获取该资源包内的所有资源
+ ///
+ private List GetAllBuiltinAssets(BuildMapContext buildMapContext, string bundleName)
+ {
+ var bundleInfo = buildMapContext.GetBundleInfo(bundleName);
+ return bundleInfo.GetAllBuiltinAssetPaths();
+ }
- private int GetMainAssetCount(PackageManifest manifest)
- {
- return manifest.AssetList.Count;
- }
- private int GetAllBundleCount(PackageManifest manifest)
- {
- return manifest.BundleList.Count;
- }
- private long GetAllBundleSize(PackageManifest manifest)
- {
- long fileBytes = 0;
- foreach (var packageBundle in manifest.BundleList)
- {
- fileBytes += packageBundle.FileSize;
- }
- return fileBytes;
- }
- private int GetEncryptedBundleCount(PackageManifest manifest)
- {
- int fileCount = 0;
- foreach (var packageBundle in manifest.BundleList)
- {
- if (packageBundle.Encrypted)
- fileCount++;
- }
- return fileCount;
- }
- private long GetEncryptedBundleSize(PackageManifest manifest)
- {
- long fileBytes = 0;
- foreach (var packageBundle in manifest.BundleList)
- {
- if (packageBundle.Encrypted)
- fileBytes += packageBundle.FileSize;
- }
- return fileBytes;
- }
- }
+ private int GetMainAssetCount(PackageManifest manifest)
+ {
+ return manifest.AssetList.Count;
+ }
+ private int GetAllBundleCount(PackageManifest manifest)
+ {
+ return manifest.BundleList.Count;
+ }
+ private long GetAllBundleSize(PackageManifest manifest)
+ {
+ long fileBytes = 0;
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ fileBytes += packageBundle.FileSize;
+ }
+ return fileBytes;
+ }
+ private int GetEncryptedBundleCount(PackageManifest manifest)
+ {
+ int fileCount = 0;
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ if (packageBundle.Encrypted)
+ fileCount++;
+ }
+ return fileCount;
+ }
+ private long GetEncryptedBundleSize(PackageManifest manifest)
+ {
+ long fileBytes = 0;
+ foreach (var packageBundle in manifest.BundleList)
+ {
+ if (packageBundle.Encrypted)
+ fileBytes += packageBundle.FileSize;
+ }
+ return fileBytes;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
index 5950183..d430ae1 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
@@ -6,45 +6,45 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskEncryption
- {
- ///
- /// 加密文件
- ///
- public void EncryptingBundleFiles(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
- {
- var encryptionServices = buildParametersContext.Parameters.EncryptionServices;
- if (encryptionServices == null)
- return;
+ public class TaskEncryption
+ {
+ ///
+ /// 加密文件
+ ///
+ public void EncryptingBundleFiles(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
+ {
+ var encryptionServices = buildParametersContext.Parameters.EncryptionServices;
+ if (encryptionServices == null)
+ return;
- if (encryptionServices.GetType() == typeof(EncryptionNone))
- return;
+ if (encryptionServices.GetType() == typeof(EncryptionNone))
+ return;
- int progressValue = 0;
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- EncryptFileInfo fileInfo = new EncryptFileInfo();
- fileInfo.BundleName = bundleInfo.BundleName;
- fileInfo.FilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
- var encryptResult = encryptionServices.Encrypt(fileInfo);
- if (encryptResult.Encrypted)
- {
- string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}.encrypt";
- FileUtility.WriteAllBytes(filePath, encryptResult.EncryptedData);
- bundleInfo.EncryptedFilePath = filePath;
- bundleInfo.Encrypted = true;
- BuildLogger.Log($"Bundle file encryption complete: {filePath}");
- }
- else
- {
- bundleInfo.Encrypted = false;
- }
+ int progressValue = 0;
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ EncryptFileInfo fileInfo = new EncryptFileInfo();
+ fileInfo.BundleName = bundleInfo.BundleName;
+ fileInfo.FilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
+ var encryptResult = encryptionServices.Encrypt(fileInfo);
+ if (encryptResult.Encrypted)
+ {
+ string filePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}.encrypt";
+ FileUtility.WriteAllBytes(filePath, encryptResult.EncryptedData);
+ bundleInfo.EncryptedFilePath = filePath;
+ bundleInfo.Encrypted = true;
+ BuildLogger.Log($"Bundle file encryption complete: {filePath}");
+ }
+ else
+ {
+ bundleInfo.Encrypted = false;
+ }
- // 进度条
- EditorTools.DisplayProgressBar("Encrypting bundle", ++progressValue, buildMapContext.Collection.Count);
- }
- EditorTools.ClearProgressBar();
- }
- }
+ // 进度条
+ EditorTools.DisplayProgressBar("Encrypting bundle", ++progressValue, buildMapContext.Collection.Count);
+ }
+ EditorTools.ClearProgressBar();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskGetBuildMap.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskGetBuildMap.cs
index aecbaa0..0583e5f 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskGetBuildMap.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskGetBuildMap.cs
@@ -7,184 +7,184 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskGetBuildMap
- {
- ///
- /// 生成资源构建上下文
- ///
- public BuildMapContext CreateBuildMap(BuildParameters buildParameters)
- {
- var buildMode = buildParameters.BuildMode;
- var packageName = buildParameters.PackageName;
+ public class TaskGetBuildMap
+ {
+ ///
+ /// 生成资源构建上下文
+ ///
+ public BuildMapContext CreateBuildMap(BuildParameters buildParameters)
+ {
+ var buildMode = buildParameters.BuildMode;
+ var packageName = buildParameters.PackageName;
- Dictionary allBuildAssetInfos = new Dictionary(1000);
+ Dictionary allBuildAssetInfos = new Dictionary(1000);
- // 1. 获取所有收集器收集的资源
- var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
- List allCollectAssetInfos = collectResult.CollectAssets;
+ // 1. 获取所有收集器收集的资源
+ var collectResult = AssetBundleCollectorSettingData.Setting.GetPackageAssets(buildMode, packageName);
+ List allCollectAssetInfos = collectResult.CollectAssets;
- // 2. 剔除未被引用的依赖项资源
- RemoveZeroReferenceAssets(allCollectAssetInfos);
+ // 2. 剔除未被引用的依赖项资源
+ RemoveZeroReferenceAssets(allCollectAssetInfos);
- // 3. 录入所有收集器主动收集的资源
- foreach (var collectAssetInfo in allCollectAssetInfos)
- {
- if (allBuildAssetInfos.ContainsKey(collectAssetInfo.AssetPath) == false)
- {
- if (collectAssetInfo.CollectorType != ECollectorType.MainAssetCollector)
- {
- if (collectAssetInfo.AssetTags.Count > 0)
- {
- collectAssetInfo.AssetTags.Clear();
- string warning = BuildLogger.GetErrorMessage(ErrorCode.RemoveInvalidTags, $"Remove asset tags that don't work, see the asset collector type : {collectAssetInfo.AssetPath}");
- BuildLogger.Warning(warning);
- }
- }
+ // 3. 录入所有收集器主动收集的资源
+ foreach (var collectAssetInfo in allCollectAssetInfos)
+ {
+ if (allBuildAssetInfos.ContainsKey(collectAssetInfo.AssetPath) == false)
+ {
+ if (collectAssetInfo.CollectorType != ECollectorType.MainAssetCollector)
+ {
+ if (collectAssetInfo.AssetTags.Count > 0)
+ {
+ collectAssetInfo.AssetTags.Clear();
+ string warning = BuildLogger.GetErrorMessage(ErrorCode.RemoveInvalidTags, $"Remove asset tags that don't work, see the asset collector type : {collectAssetInfo.AssetPath}");
+ BuildLogger.Warning(warning);
+ }
+ }
- var buildAssetInfo = new BuildAssetInfo(collectAssetInfo.CollectorType, collectAssetInfo.BundleName, collectAssetInfo.Address, collectAssetInfo.AssetPath);
- buildAssetInfo.AddAssetTags(collectAssetInfo.AssetTags);
- allBuildAssetInfos.Add(collectAssetInfo.AssetPath, buildAssetInfo);
- }
- else
- {
- throw new Exception($"Should never get here !");
- }
- }
+ var buildAssetInfo = new BuildAssetInfo(collectAssetInfo.CollectorType, collectAssetInfo.BundleName, collectAssetInfo.Address, collectAssetInfo.AssetPath);
+ buildAssetInfo.AddAssetTags(collectAssetInfo.AssetTags);
+ allBuildAssetInfos.Add(collectAssetInfo.AssetPath, buildAssetInfo);
+ }
+ else
+ {
+ throw new Exception($"Should never get here !");
+ }
+ }
- // 4. 录入所有收集资源依赖的其它资源
- foreach (var collectAssetInfo in allCollectAssetInfos)
- {
- string bundleName = collectAssetInfo.BundleName;
- foreach (var dependAssetPath in collectAssetInfo.DependAssets)
- {
- if (allBuildAssetInfos.ContainsKey(dependAssetPath))
- {
- allBuildAssetInfos[dependAssetPath].AddReferenceBundleName(bundleName);
- }
- else
- {
- var buildAssetInfo = new BuildAssetInfo(dependAssetPath);
- buildAssetInfo.AddReferenceBundleName(bundleName);
- allBuildAssetInfos.Add(dependAssetPath, buildAssetInfo);
- }
- }
- }
+ // 4. 录入所有收集资源依赖的其它资源
+ foreach (var collectAssetInfo in allCollectAssetInfos)
+ {
+ string bundleName = collectAssetInfo.BundleName;
+ foreach (var dependAssetPath in collectAssetInfo.DependAssets)
+ {
+ if (allBuildAssetInfos.ContainsKey(dependAssetPath))
+ {
+ allBuildAssetInfos[dependAssetPath].AddReferenceBundleName(bundleName);
+ }
+ else
+ {
+ var buildAssetInfo = new BuildAssetInfo(dependAssetPath);
+ buildAssetInfo.AddReferenceBundleName(bundleName);
+ allBuildAssetInfos.Add(dependAssetPath, buildAssetInfo);
+ }
+ }
+ }
- // 5. 填充所有收集资源的依赖列表
- foreach (var collectAssetInfo in allCollectAssetInfos)
- {
- var dependAssetInfos = new List(collectAssetInfo.DependAssets.Count);
- foreach (var dependAssetPath in collectAssetInfo.DependAssets)
- {
- if (allBuildAssetInfos.TryGetValue(dependAssetPath, out BuildAssetInfo value))
- dependAssetInfos.Add(value);
- else
- throw new Exception("Should never get here !");
- }
- allBuildAssetInfos[collectAssetInfo.AssetPath].SetDependAssetInfos(dependAssetInfos);
- }
+ // 5. 填充所有收集资源的依赖列表
+ foreach (var collectAssetInfo in allCollectAssetInfos)
+ {
+ var dependAssetInfos = new List(collectAssetInfo.DependAssets.Count);
+ foreach (var dependAssetPath in collectAssetInfo.DependAssets)
+ {
+ if (allBuildAssetInfos.TryGetValue(dependAssetPath, out BuildAssetInfo value))
+ dependAssetInfos.Add(value);
+ else
+ throw new Exception("Should never get here !");
+ }
+ allBuildAssetInfos[collectAssetInfo.AssetPath].SetDependAssetInfos(dependAssetInfos);
+ }
- // 6. 自动收集所有依赖的着色器
- if (collectResult.Command.AutoCollectShaders)
- {
- foreach (var buildAssetInfo in allBuildAssetInfos.Values)
- {
- if (buildAssetInfo.CollectorType == ECollectorType.None)
- {
- if (buildAssetInfo.AssetType == typeof(UnityEngine.Shader) || buildAssetInfo.AssetType == typeof(UnityEngine.ShaderVariantCollection))
- {
- buildAssetInfo.SetShaderBundleName(collectResult.Command.PackageName, collectResult.Command.UniqueBundleName);
- }
- }
- }
- }
+ // 6. 自动收集所有依赖的着色器
+ if (collectResult.Command.AutoCollectShaders)
+ {
+ foreach (var buildAssetInfo in allBuildAssetInfos.Values)
+ {
+ if (buildAssetInfo.CollectorType == ECollectorType.None)
+ {
+ if (buildAssetInfo.AssetType == typeof(UnityEngine.Shader) || buildAssetInfo.AssetType == typeof(UnityEngine.ShaderVariantCollection))
+ {
+ buildAssetInfo.SetShaderBundleName(collectResult.Command.PackageName, collectResult.Command.UniqueBundleName);
+ }
+ }
+ }
+ }
- // 7. 记录关键信息
- BuildMapContext context = new BuildMapContext();
- context.AssetFileCount = allBuildAssetInfos.Count;
- context.Command = collectResult.Command;
+ // 7. 记录关键信息
+ BuildMapContext context = new BuildMapContext();
+ context.AssetFileCount = allBuildAssetInfos.Count;
+ context.Command = collectResult.Command;
- // 8. 记录冗余资源
- foreach (var buildAssetInfo in allBuildAssetInfos.Values)
- {
- if (buildAssetInfo.IsRedundancyAsset())
- {
- var redundancyInfo = new ReportRedundancyInfo();
- redundancyInfo.AssetPath = buildAssetInfo.AssetPath;
- redundancyInfo.AssetType = buildAssetInfo.AssetType.Name;
- redundancyInfo.AssetGUID = buildAssetInfo.AssetGUID;
- redundancyInfo.FileSize = FileUtility.GetFileSize(buildAssetInfo.AssetPath);
- redundancyInfo.Number = buildAssetInfo.GetReferenceBundleCount();
- context.RedundancyInfos.Add(redundancyInfo);
- }
- }
+ // 8. 记录冗余资源
+ foreach (var buildAssetInfo in allBuildAssetInfos.Values)
+ {
+ if (buildAssetInfo.IsRedundancyAsset())
+ {
+ var redundancyInfo = new ReportRedundancyInfo();
+ redundancyInfo.AssetPath = buildAssetInfo.AssetPath;
+ redundancyInfo.AssetType = buildAssetInfo.AssetType.Name;
+ redundancyInfo.AssetGUID = buildAssetInfo.AssetGUID;
+ redundancyInfo.FileSize = FileUtility.GetFileSize(buildAssetInfo.AssetPath);
+ redundancyInfo.Number = buildAssetInfo.GetReferenceBundleCount();
+ context.RedundancyInfos.Add(redundancyInfo);
+ }
+ }
- // 9. 移除不参与构建的资源
- List removeBuildList = new List();
- foreach (var buildAssetInfo in allBuildAssetInfos.Values)
- {
- if (buildAssetInfo.HasBundleName() == false)
- removeBuildList.Add(buildAssetInfo);
- }
- foreach (var removeValue in removeBuildList)
- {
- allBuildAssetInfos.Remove(removeValue.AssetPath);
- }
+ // 9. 移除不参与构建的资源
+ List removeBuildList = new List();
+ foreach (var buildAssetInfo in allBuildAssetInfos.Values)
+ {
+ if (buildAssetInfo.HasBundleName() == false)
+ removeBuildList.Add(buildAssetInfo);
+ }
+ foreach (var removeValue in removeBuildList)
+ {
+ allBuildAssetInfos.Remove(removeValue.AssetPath);
+ }
- // 10. 构建资源列表
- var allPackAssets = allBuildAssetInfos.Values.ToList();
- if (allPackAssets.Count == 0)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.PackAssetListIsEmpty, "The pack asset info is empty !");
- throw new Exception(message);
- }
- foreach (var assetInfo in allPackAssets)
- {
- context.PackAsset(assetInfo);
- }
+ // 10. 构建资源列表
+ var allPackAssets = allBuildAssetInfos.Values.ToList();
+ if (allPackAssets.Count == 0)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.PackAssetListIsEmpty, "The pack asset info is empty !");
+ throw new Exception(message);
+ }
+ foreach (var assetInfo in allPackAssets)
+ {
+ context.PackAsset(assetInfo);
+ }
- return context;
- }
- private void RemoveZeroReferenceAssets(List allCollectAssetInfos)
- {
- // 1. 检测是否任何存在依赖资源
- if (allCollectAssetInfos.Exists(x => x.CollectorType == ECollectorType.DependAssetCollector) == false)
- return;
+ return context;
+ }
+ private void RemoveZeroReferenceAssets(List allCollectAssetInfos)
+ {
+ // 1. 检测是否任何存在依赖资源
+ if (allCollectAssetInfos.Exists(x => x.CollectorType == ECollectorType.DependAssetCollector) == false)
+ return;
- // 2. 获取所有主资源的依赖资源集合
- HashSet allDependAsset = new HashSet();
- foreach (var collectAssetInfo in allCollectAssetInfos)
- {
- var collectorType = collectAssetInfo.CollectorType;
- if (collectorType == ECollectorType.MainAssetCollector || collectorType == ECollectorType.StaticAssetCollector)
- {
- foreach (var dependAsset in collectAssetInfo.DependAssets)
- {
- if (allDependAsset.Contains(dependAsset) == false)
- allDependAsset.Add(dependAsset);
- }
- }
- }
+ // 2. 获取所有主资源的依赖资源集合
+ HashSet allDependAsset = new HashSet();
+ foreach (var collectAssetInfo in allCollectAssetInfos)
+ {
+ var collectorType = collectAssetInfo.CollectorType;
+ if (collectorType == ECollectorType.MainAssetCollector || collectorType == ECollectorType.StaticAssetCollector)
+ {
+ foreach (var dependAsset in collectAssetInfo.DependAssets)
+ {
+ if (allDependAsset.Contains(dependAsset) == false)
+ allDependAsset.Add(dependAsset);
+ }
+ }
+ }
- // 3. 找出所有零引用的依赖资源集合
- List removeList = new List();
- foreach (var collectAssetInfo in allCollectAssetInfos)
- {
- var collectorType = collectAssetInfo.CollectorType;
- if (collectorType == ECollectorType.DependAssetCollector)
- {
- if (allDependAsset.Contains(collectAssetInfo.AssetPath) == false)
- removeList.Add(collectAssetInfo);
- }
- }
+ // 3. 找出所有零引用的依赖资源集合
+ List removeList = new List();
+ foreach (var collectAssetInfo in allCollectAssetInfos)
+ {
+ var collectorType = collectAssetInfo.CollectorType;
+ if (collectorType == ECollectorType.DependAssetCollector)
+ {
+ if (allDependAsset.Contains(collectAssetInfo.AssetPath) == false)
+ removeList.Add(collectAssetInfo);
+ }
+ }
- // 4. 移除所有零引用的依赖资源
- foreach (var removeValue in removeList)
- {
- string warning = BuildLogger.GetErrorMessage(ErrorCode.FoundUndependedAsset, $"Found undepended asset and remove it : {removeValue.AssetPath}");
- BuildLogger.Warning(warning);
- allCollectAssetInfos.Remove(removeValue);
- }
- }
- }
+ // 4. 移除所有零引用的依赖资源
+ foreach (var removeValue in removeList)
+ {
+ string warning = BuildLogger.GetErrorMessage(ErrorCode.FoundUndependedAsset, $"Found undepended asset and remove it : {removeValue.AssetPath}");
+ BuildLogger.Warning(warning);
+ allCollectAssetInfos.Remove(removeValue);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
index df4379e..7cf43ec 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
@@ -7,90 +7,90 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public abstract class TaskUpdateBundleInfo
- {
- public void UpdateBundleInfo(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- int outputNameStyle = (int)buildParametersContext.Parameters.FileNameStyle;
+ public abstract class TaskUpdateBundleInfo
+ {
+ public void UpdateBundleInfo(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ int outputNameStyle = (int)buildParametersContext.Parameters.FileNameStyle;
- // 1.检测文件名长度
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- // NOTE:检测文件名长度不要超过260字符。
- string fileName = bundleInfo.BundleName;
- if (fileName.Length >= 260)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.CharactersOverTheLimit, $"Bundle file name character count exceeds limit : {fileName}");
- throw new Exception(message);
- }
- }
+ // 1.检测文件名长度
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ // NOTE:检测文件名长度不要超过260字符。
+ string fileName = bundleInfo.BundleName;
+ if (fileName.Length >= 260)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.CharactersOverTheLimit, $"Bundle file name character count exceeds limit : {fileName}");
+ throw new Exception(message);
+ }
+ }
- // 2.更新构建输出的文件路径
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- bundleInfo.BuildOutputFilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
- if (bundleInfo.Encrypted)
- bundleInfo.PackageSourceFilePath = bundleInfo.EncryptedFilePath;
- else
- bundleInfo.PackageSourceFilePath = bundleInfo.BuildOutputFilePath;
- }
+ // 2.更新构建输出的文件路径
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ bundleInfo.BuildOutputFilePath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
+ if (bundleInfo.Encrypted)
+ bundleInfo.PackageSourceFilePath = bundleInfo.EncryptedFilePath;
+ else
+ bundleInfo.PackageSourceFilePath = bundleInfo.BuildOutputFilePath;
+ }
- // 3.更新文件其它信息
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- bundleInfo.PackageUnityHash = GetUnityHash(bundleInfo, context);
- bundleInfo.PackageUnityCRC = GetUnityCRC(bundleInfo, context);
- bundleInfo.PackageFileHash = GetBundleFileHash(bundleInfo, buildParametersContext);
- bundleInfo.PackageFileCRC = GetBundleFileCRC(bundleInfo, buildParametersContext);
- bundleInfo.PackageFileSize = GetBundleFileSize(bundleInfo, buildParametersContext);
- }
+ // 3.更新文件其它信息
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ bundleInfo.PackageUnityHash = GetUnityHash(bundleInfo, context);
+ bundleInfo.PackageUnityCRC = GetUnityCRC(bundleInfo, context);
+ bundleInfo.PackageFileHash = GetBundleFileHash(bundleInfo, buildParametersContext);
+ bundleInfo.PackageFileCRC = GetBundleFileCRC(bundleInfo, buildParametersContext);
+ bundleInfo.PackageFileSize = GetBundleFileSize(bundleInfo, buildParametersContext);
+ }
- // 4.更新补丁包输出的文件路径
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- string bundleName = bundleInfo.BundleName;
- string fileHash = bundleInfo.PackageFileHash;
- string fileExtension = ManifestTools.GetRemoteBundleFileExtension(bundleName);
- string fileName = ManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleName, fileExtension, fileHash);
- bundleInfo.PackageDestFilePath = $"{packageOutputDirectory}/{fileName}";
- }
- }
+ // 4.更新补丁包输出的文件路径
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ string bundleName = bundleInfo.BundleName;
+ string fileHash = bundleInfo.PackageFileHash;
+ string fileExtension = ManifestTools.GetRemoteBundleFileExtension(bundleName);
+ string fileName = ManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleName, fileExtension, fileHash);
+ bundleInfo.PackageDestFilePath = $"{packageOutputDirectory}/{fileName}";
+ }
+ }
- protected abstract string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context);
- protected abstract uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context);
- protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
- protected abstract string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
- protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
+ protected abstract string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context);
+ protected abstract uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context);
+ protected abstract string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
+ protected abstract string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
+ protected abstract long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext);
- protected string GetFilePathTempHash(string filePath)
- {
- byte[] bytes = Encoding.UTF8.GetBytes(filePath);
- return HashUtility.BytesMD5(bytes);
+ protected string GetFilePathTempHash(string filePath)
+ {
+ byte[] bytes = Encoding.UTF8.GetBytes(filePath);
+ return HashUtility.BytesMD5(bytes);
- // 注意:在文件路径的哈希值冲突的情况下,可以使用下面的方法
- //return $"{HashUtility.BytesMD5(bytes)}-{Guid.NewGuid():N}";
- }
- protected long GetBundleTempSize(BuildBundleInfo bundleInfo)
- {
- long tempSize = 0;
+ // 注意:在文件路径的哈希值冲突的情况下,可以使用下面的方法
+ //return $"{HashUtility.BytesMD5(bytes)}-{Guid.NewGuid():N}";
+ }
+ protected long GetBundleTempSize(BuildBundleInfo bundleInfo)
+ {
+ long tempSize = 0;
- var assetPaths = bundleInfo.GetAllMainAssetPaths();
- foreach (var assetPath in assetPaths)
- {
- long size = FileUtility.GetFileSize(assetPath);
- tempSize += size;
- }
+ var assetPaths = bundleInfo.GetAllMainAssetPaths();
+ foreach (var assetPath in assetPaths)
+ {
+ long size = FileUtility.GetFileSize(assetPath);
+ tempSize += size;
+ }
- if (tempSize == 0)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BundleTempSizeIsZero, $"Bundle temp size is zero, check bundle main asset list : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- return tempSize;
- }
- }
+ if (tempSize == 0)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BundleTempSizeIsZero, $"Bundle temp size is zero, check bundle main asset list : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ return tempSize;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskBuilding_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskBuilding_BBP.cs
index 02bb3a2..f15882a 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskBuilding_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskBuilding_BBP.cs
@@ -7,48 +7,48 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskBuilding_BBP : IBuildTask
- {
- public class BuildResultContext : IContextObject
- {
- public AssetBundleManifest UnityManifest;
- }
+ public class TaskBuilding_BBP : IBuildTask
+ {
+ public class BuildResultContext : IContextObject
+ {
+ public AssetBundleManifest UnityManifest;
+ }
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var builtinBuildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var builtinBuildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
- // 模拟构建模式下跳过引擎构建
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return;
+ // 模拟构建模式下跳过引擎构建
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return;
- // 开始构建
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
- AssetBundleManifest unityManifest = BuildPipeline.BuildAssetBundles(pipelineOutputDirectory, buildMapContext.GetPipelineBuilds(), buildOptions, buildParametersContext.Parameters.BuildTarget);
- if (unityManifest == null)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, "UnityEngine build failed !");
- throw new Exception(message);
- }
+ // 开始构建
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ BuildAssetBundleOptions buildOptions = builtinBuildParameters.GetBundleBuildOptions();
+ AssetBundleManifest unityManifest = BuildPipeline.BuildAssetBundles(pipelineOutputDirectory, buildMapContext.GetPipelineBuilds(), buildOptions, buildParametersContext.Parameters.BuildTarget);
+ if (unityManifest == null)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, "UnityEngine build failed !");
+ throw new Exception(message);
+ }
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- string unityOutputManifestFilePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
- if (System.IO.File.Exists(unityOutputManifestFilePath) == false)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFatal, $"Not found output {nameof(AssetBundleManifest)} file : {unityOutputManifestFilePath}");
- throw new Exception(message);
- }
- }
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ string unityOutputManifestFilePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
+ if (System.IO.File.Exists(unityOutputManifestFilePath) == false)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFatal, $"Not found output {nameof(AssetBundleManifest)} file : {unityOutputManifestFilePath}");
+ throw new Exception(message);
+ }
+ }
- BuildLogger.Log("UnityEngine build success !");
- BuildResultContext buildResultContext = new BuildResultContext();
- buildResultContext.UnityManifest = unityManifest;
- context.SetContextObject(buildResultContext);
- }
- }
+ BuildLogger.Log("UnityEngine build success !");
+ BuildResultContext buildResultContext = new BuildResultContext();
+ buildResultContext.UnityManifest = unityManifest;
+ context.SetContextObject(buildResultContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCopyBuildinFiles_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCopyBuildinFiles_BBP.cs
index dcf4a9c..807093e 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCopyBuildinFiles_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCopyBuildinFiles_BBP.cs
@@ -6,21 +6,21 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskCopyBuildinFiles_BBP : TaskCopyBuildinFiles, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var manifestContext = context.GetContextObject();
- var buildMode = buildParametersContext.Parameters.BuildMode;
+ public class TaskCopyBuildinFiles_BBP : TaskCopyBuildinFiles, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var manifestContext = context.GetContextObject();
+ var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
- {
- CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
- }
- }
- }
- }
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateManifest_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateManifest_BBP.cs
index 919fc39..32c46ea 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateManifest_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateManifest_BBP.cs
@@ -5,21 +5,21 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskCreateManifest_BBP : TaskCreateManifest, IBuildTask
- {
- private TaskBuilding_BBP.BuildResultContext _buildResultContext = null;
+ public class TaskCreateManifest_BBP : TaskCreateManifest, IBuildTask
+ {
+ private TaskBuilding_BBP.BuildResultContext _buildResultContext = null;
- void IBuildTask.Run(BuildContext context)
- {
- CreateManifestFile(context);
- }
+ void IBuildTask.Run(BuildContext context)
+ {
+ CreateManifestFile(context);
+ }
- protected override string[] GetBundleDepends(BuildContext context, string bundleName)
- {
- if (_buildResultContext == null)
- _buildResultContext = context.GetContextObject();
+ protected override string[] GetBundleDepends(BuildContext context, string bundleName)
+ {
+ if (_buildResultContext == null)
+ _buildResultContext = context.GetContextObject();
- return _buildResultContext.UnityManifest.GetAllDependencies(bundleName);
- }
- }
+ return _buildResultContext.UnityManifest.GetAllDependencies(bundleName);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreatePackage_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreatePackage_BBP.cs
index 4ec89fd..530b1b7 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreatePackage_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreatePackage_BBP.cs
@@ -3,51 +3,51 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskCreatePackage_BBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild && buildMode != EBuildMode.DryRunBuild)
- {
- CreatePackageCatalog(buildParameters, buildMapContext);
- }
- }
+ public class TaskCreatePackage_BBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild && buildMode != EBuildMode.DryRunBuild)
+ {
+ CreatePackageCatalog(buildParameters, buildMapContext);
+ }
+ }
- ///
- /// 拷贝补丁文件到补丁包目录
- ///
- private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
- {
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
+ ///
+ /// 拷贝补丁文件到补丁包目录
+ ///
+ private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
+ {
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
- // 拷贝UnityManifest序列化文件
- {
- string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
- string destPath = $"{packageOutputDirectory}/{YooAssetSettings.OutputFolderName}";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝UnityManifest序列化文件
+ {
+ string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}";
+ string destPath = $"{packageOutputDirectory}/{YooAssetSettings.OutputFolderName}";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝UnityManifest文本文件
- {
- string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}.manifest";
- string destPath = $"{packageOutputDirectory}/{YooAssetSettings.OutputFolderName}.manifest";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝UnityManifest文本文件
+ {
+ string sourcePath = $"{pipelineOutputDirectory}/{YooAssetSettings.OutputFolderName}.manifest";
+ string destPath = $"{packageOutputDirectory}/{YooAssetSettings.OutputFolderName}.manifest";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝所有补丁文件
- int progressValue = 0;
- int fileTotalCount = buildMapContext.Collection.Count;
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
- EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
- }
- EditorTools.ClearProgressBar();
- }
- }
+ // 拷贝所有补丁文件
+ int progressValue = 0;
+ int fileTotalCount = buildMapContext.Collection.Count;
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
+ EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
+ }
+ EditorTools.ClearProgressBar();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateReport_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateReport_BBP.cs
index 44ac4c2..aa363ad 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateReport_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateReport_BBP.cs
@@ -6,19 +6,19 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskCreateReport_BBP : TaskCreateReport, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var manifestContext = context.GetContextObject();
+ public class TaskCreateReport_BBP : TaskCreateReport, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var manifestContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild)
- {
- CreateReportFile(buildParameters, buildMapContext, manifestContext);
- }
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild)
+ {
+ CreateReportFile(buildParameters, buildMapContext, manifestContext);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskEncryption_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskEncryption_BBP.cs
index 391a1b8..0248499 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskEncryption_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskEncryption_BBP.cs
@@ -6,18 +6,18 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskEncryption_BBP : TaskEncryption, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
+ public class TaskEncryption_BBP : TaskEncryption, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- EncryptingBundleFiles(buildParameters, buildMapContext);
- }
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ EncryptingBundleFiles(buildParameters, buildMapContext);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskGetBuildMap_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskGetBuildMap_BBP.cs
index 82640fe..68a6cc0 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskGetBuildMap_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskGetBuildMap_BBP.cs
@@ -7,13 +7,13 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskGetBuildMap_BBP : TaskGetBuildMap, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
- context.SetContextObject(buildMapContext);
- }
- }
+ public class TaskGetBuildMap_BBP : TaskGetBuildMap, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
+ context.SetContextObject(buildMapContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskPrepare_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskPrepare_BBP.cs
index 932934a..825c8e8 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskPrepare_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskPrepare_BBP.cs
@@ -6,18 +6,18 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskPrepare_BBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters;
- var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
+ public class TaskPrepare_BBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters;
+ var builtinBuildParameters = buildParameters as BuiltinBuildParameters;
- // 检测基础构建参数
- buildParametersContext.CheckBuildParameters();
+ // 检测基础构建参数
+ buildParametersContext.CheckBuildParameters();
- // 检测Unity版本
+ // 检测Unity版本
#if UNITY_2021_3_OR_NEWER
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
{
@@ -25,6 +25,6 @@ namespace YooAsset.Editor
BuildLogger.Warning(warning);
}
#endif
- }
- }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskUpdateBundleInfo_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskUpdateBundleInfo_BBP.cs
index d4a5b68..5aaccfb 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskUpdateBundleInfo_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskUpdateBundleInfo_BBP.cs
@@ -6,86 +6,86 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskUpdateBundleInfo_BBP : TaskUpdateBundleInfo, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- UpdateBundleInfo(context);
- }
+ public class TaskUpdateBundleInfo_BBP : TaskUpdateBundleInfo, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ UpdateBundleInfo(context);
+ }
- protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var parameters = buildParametersContext.Parameters;
- var buildMode = parameters.BuildMode;
- if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
- {
- return "00000000000000000000000000000000"; //32位
- }
- else
- {
- var buildResult = context.GetContextObject();
- var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
- if (hash.isValid)
- {
- return hash.ToString();
- }
- else
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- }
- }
- protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var parameters = buildParametersContext.Parameters;
- var buildMode = parameters.BuildMode;
- if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
- {
- return 0;
- }
- else
- {
- string filePath = bundleInfo.BuildOutputFilePath;
- if (BuildPipeline.GetCRCForAssetBundle(filePath, out uint crc))
- {
- return crc;
- }
- else
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- }
- }
- protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
- return GetFilePathTempHash(filePath);
- else
- return HashUtility.FileMD5(filePath);
- }
- protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
- return "00000000"; //8位
- else
- return HashUtility.FileCRC32(filePath);
- }
- protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
- return GetBundleTempSize(bundleInfo);
- else
- return FileUtility.GetFileSize(filePath);
- }
- }
+ protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var parameters = buildParametersContext.Parameters;
+ var buildMode = parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ {
+ return "00000000000000000000000000000000"; //32位
+ }
+ else
+ {
+ var buildResult = context.GetContextObject();
+ var hash = buildResult.UnityManifest.GetAssetBundleHash(bundleInfo.BundleName);
+ if (hash.isValid)
+ {
+ return hash.ToString();
+ }
+ else
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ }
+ }
+ protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var parameters = buildParametersContext.Parameters;
+ var buildMode = parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ {
+ return 0;
+ }
+ else
+ {
+ string filePath = bundleInfo.BuildOutputFilePath;
+ if (BuildPipeline.GetCRCForAssetBundle(filePath, out uint crc))
+ {
+ return crc;
+ }
+ else
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ }
+ }
+ protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return GetFilePathTempHash(filePath);
+ else
+ return HashUtility.FileMD5(filePath);
+ }
+ protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return "00000000"; //8位
+ else
+ return HashUtility.FileCRC32(filePath);
+ }
+ protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.DryRunBuild || buildMode == EBuildMode.SimulateBuild)
+ return GetBundleTempSize(bundleInfo);
+ else
+ return FileUtility.GetFileSize(filePath);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskVerifyBuildResult_BBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskVerifyBuildResult_BBP.cs
index 97b9e46..3203ccf 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskVerifyBuildResult_BBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskVerifyBuildResult_BBP.cs
@@ -8,66 +8,66 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskVerifyBuildResult_BBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
+ public class TaskVerifyBuildResult_BBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters as BuiltinBuildParameters;
- // 模拟构建模式下跳过验证
- if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
- return;
+ // 模拟构建模式下跳过验证
+ if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
+ return;
- // 验证构建结果
- if (buildParameters.VerifyBuildingResult)
- {
- var buildResultContext = context.GetContextObject();
- VerifyingBuildingResult(context, buildResultContext.UnityManifest);
- }
- }
+ // 验证构建结果
+ if (buildParameters.VerifyBuildingResult)
+ {
+ var buildResultContext = context.GetContextObject();
+ VerifyingBuildingResult(context, buildResultContext.UnityManifest);
+ }
+ }
- ///
- /// 验证构建结果
- ///
- private void VerifyingBuildingResult(BuildContext context, AssetBundleManifest unityManifest)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- string[] unityCreateBundles = unityManifest.GetAllAssetBundles();
+ ///
+ /// 验证构建结果
+ ///
+ private void VerifyingBuildingResult(BuildContext context, AssetBundleManifest unityManifest)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ string[] unityCreateBundles = unityManifest.GetAllAssetBundles();
- // 1. 过滤掉原生Bundle
- string[] mapBundles = buildMapContext.Collection.Select(t => t.BundleName).ToArray();
+ // 1. 过滤掉原生Bundle
+ string[] mapBundles = buildMapContext.Collection.Select(t => t.BundleName).ToArray();
- // 2. 验证Bundle
- List exceptBundleList1 = unityCreateBundles.Except(mapBundles).ToList();
- if (exceptBundleList1.Count > 0)
- {
- foreach (var exceptBundle in exceptBundleList1)
- {
- string warning = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildBundle, $"Found unintended build bundle : {exceptBundle}");
- BuildLogger.Warning(warning);
- }
+ // 2. 验证Bundle
+ List exceptBundleList1 = unityCreateBundles.Except(mapBundles).ToList();
+ if (exceptBundleList1.Count > 0)
+ {
+ foreach (var exceptBundle in exceptBundleList1)
+ {
+ string warning = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildBundle, $"Found unintended build bundle : {exceptBundle}");
+ BuildLogger.Warning(warning);
+ }
- string exception = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildResult, $"Unintended build, See the detailed warnings !");
- throw new Exception(exception);
- }
+ string exception = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildResult, $"Unintended build, See the detailed warnings !");
+ throw new Exception(exception);
+ }
- // 3. 验证Bundle
- List exceptBundleList2 = mapBundles.Except(unityCreateBundles).ToList();
- if (exceptBundleList2.Count > 0)
- {
- foreach (var exceptBundle in exceptBundleList2)
- {
- string warning = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildBundle, $"Found unintended build bundle : {exceptBundle}");
- BuildLogger.Warning(warning);
- }
+ // 3. 验证Bundle
+ List exceptBundleList2 = mapBundles.Except(unityCreateBundles).ToList();
+ if (exceptBundleList2.Count > 0)
+ {
+ foreach (var exceptBundle in exceptBundleList2)
+ {
+ string warning = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildBundle, $"Found unintended build bundle : {exceptBundle}");
+ BuildLogger.Warning(warning);
+ }
- string exception = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildResult, $"Unintended build, See the detailed warnings !");
- throw new Exception(exception);
- }
+ string exception = BuildLogger.GetErrorMessage(ErrorCode.UnintendedBuildResult, $"Unintended build, See the detailed warnings !");
+ throw new Exception(exception);
+ }
- BuildLogger.Log("Build results verify success!");
- }
- }
+ BuildLogger.Log("Build results verify success!");
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildParameters.cs
index 38009cc..da4c538 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildParameters.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildParameters.cs
@@ -5,57 +5,57 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class BuiltinBuildParameters : BuildParameters
- {
- ///
- /// 压缩选项
- ///
- public ECompressOption CompressOption = ECompressOption.Uncompressed;
+ public class BuiltinBuildParameters : BuildParameters
+ {
+ ///
+ /// 压缩选项
+ ///
+ public ECompressOption CompressOption = ECompressOption.Uncompressed;
- ///
- /// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
- ///
- public bool DisableWriteTypeTree = false;
+ ///
+ /// 禁止写入类型树结构(可以降低包体和内存并提高加载效率)
+ ///
+ public bool DisableWriteTypeTree = false;
- ///
- /// 忽略类型树变化
- ///
- public bool IgnoreTypeTreeChanges = true;
+ ///
+ /// 忽略类型树变化
+ ///
+ public bool IgnoreTypeTreeChanges = true;
- ///
- /// 获取内置构建管线的构建选项
- ///
- public BuildAssetBundleOptions GetBundleBuildOptions()
- {
- // For the new build system, unity always need BuildAssetBundleOptions.CollectDependencies and BuildAssetBundleOptions.DeterministicAssetBundle
- // 除非设置ForceRebuildAssetBundle标记,否则会进行增量打包
+ ///
+ /// 获取内置构建管线的构建选项
+ ///
+ public BuildAssetBundleOptions GetBundleBuildOptions()
+ {
+ // For the new build system, unity always need BuildAssetBundleOptions.CollectDependencies and BuildAssetBundleOptions.DeterministicAssetBundle
+ // 除非设置ForceRebuildAssetBundle标记,否则会进行增量打包
- BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;
- opt |= BuildAssetBundleOptions.StrictMode; //Do not allow the build to succeed if any errors are reporting during it.
+ BuildAssetBundleOptions opt = BuildAssetBundleOptions.None;
+ opt |= BuildAssetBundleOptions.StrictMode; //Do not allow the build to succeed if any errors are reporting during it.
- if (BuildMode == EBuildMode.DryRunBuild)
- {
- opt |= BuildAssetBundleOptions.DryRunBuild;
- return opt;
- }
+ if (BuildMode == EBuildMode.DryRunBuild)
+ {
+ opt |= BuildAssetBundleOptions.DryRunBuild;
+ return opt;
+ }
- if (CompressOption == ECompressOption.Uncompressed)
- opt |= BuildAssetBundleOptions.UncompressedAssetBundle;
- else if (CompressOption == ECompressOption.LZ4)
- opt |= BuildAssetBundleOptions.ChunkBasedCompression;
+ if (CompressOption == ECompressOption.Uncompressed)
+ opt |= BuildAssetBundleOptions.UncompressedAssetBundle;
+ else if (CompressOption == ECompressOption.LZ4)
+ opt |= BuildAssetBundleOptions.ChunkBasedCompression;
- if (BuildMode == EBuildMode.ForceRebuild)
- opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
- if (DisableWriteTypeTree)
- opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
- if (IgnoreTypeTreeChanges)
- opt |= BuildAssetBundleOptions.IgnoreTypeTreeChanges; //Ignore the type tree changes when doing the incremental build check.
+ if (BuildMode == EBuildMode.ForceRebuild)
+ opt |= BuildAssetBundleOptions.ForceRebuildAssetBundle; //Force rebuild the asset bundles
+ if (DisableWriteTypeTree)
+ opt |= BuildAssetBundleOptions.DisableWriteTypeTree; //Do not include type information within the asset bundle (don't write type tree).
+ if (IgnoreTypeTreeChanges)
+ opt |= BuildAssetBundleOptions.IgnoreTypeTreeChanges; //Ignore the type tree changes when doing the incremental build check.
- opt |= BuildAssetBundleOptions.DisableLoadAssetByFileName; //Disables Asset Bundle LoadAsset by file name.
- opt |= BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension; //Disables Asset Bundle LoadAsset by file name with extension.
+ opt |= BuildAssetBundleOptions.DisableLoadAssetByFileName; //Disables Asset Bundle LoadAsset by file name.
+ opt |= BuildAssetBundleOptions.DisableLoadAssetByFileNameWithExtension; //Disables Asset Bundle LoadAsset by file name with extension.
- return opt;
- }
- }
+ return opt;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
index 3a6b966..2ac4058 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
@@ -4,33 +4,33 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class BuiltinBuildPipeline : IBuildPipeline
- {
- public BuildResult Run(BuildParameters buildParameters, bool enableLog)
- {
- AssetBundleBuilder builder = new AssetBundleBuilder();
- return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
- }
+ public class BuiltinBuildPipeline : IBuildPipeline
+ {
+ public BuildResult Run(BuildParameters buildParameters, bool enableLog)
+ {
+ AssetBundleBuilder builder = new AssetBundleBuilder();
+ return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
+ }
- ///
- /// 获取默认的构建流程
- ///
- private List GetDefaultBuildPipeline()
- {
- List pipeline = new List
- {
- new TaskPrepare_BBP(),
- new TaskGetBuildMap_BBP(),
- new TaskBuilding_BBP(),
- new TaskVerifyBuildResult_BBP(),
- new TaskEncryption_BBP(),
- new TaskUpdateBundleInfo_BBP(),
- new TaskCreateManifest_BBP(),
- new TaskCreateReport_BBP(),
- new TaskCreatePackage_BBP(),
- new TaskCopyBuildinFiles_BBP(),
- };
- return pipeline;
- }
- }
+ ///
+ /// 获取默认的构建流程
+ ///
+ private List GetDefaultBuildPipeline()
+ {
+ List pipeline = new List
+ {
+ new TaskPrepare_BBP(),
+ new TaskGetBuildMap_BBP(),
+ new TaskBuilding_BBP(),
+ new TaskVerifyBuildResult_BBP(),
+ new TaskEncryption_BBP(),
+ new TaskUpdateBundleInfo_BBP(),
+ new TaskCreateManifest_BBP(),
+ new TaskCreateReport_BBP(),
+ new TaskCreatePackage_BBP(),
+ new TaskCopyBuildinFiles_BBP(),
+ };
+ return pipeline;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskBuilding_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskBuilding_RFBP.cs
index 6ee5a7c..8a10f24 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskBuilding_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskBuilding_RFBP.cs
@@ -5,35 +5,35 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskBuilding_RFBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
+ public class TaskBuilding_RFBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- CopyRawBundle(buildMapContext, buildParametersContext);
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ CopyRawBundle(buildMapContext, buildParametersContext);
+ }
+ }
- ///
- /// 拷贝原生文件
- ///
- private void CopyRawBundle(BuildMapContext buildMapContext, BuildParametersContext buildParametersContext)
- {
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- string dest = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
- foreach (var assetInfo in bundleInfo.MainAssets)
- {
- EditorTools.CopyFile(assetInfo.AssetPath, dest, true);
- }
- }
- }
- }
+ ///
+ /// 拷贝原生文件
+ ///
+ private void CopyRawBundle(BuildMapContext buildMapContext, BuildParametersContext buildParametersContext)
+ {
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ string dest = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
+ foreach (var assetInfo in bundleInfo.MainAssets)
+ {
+ EditorTools.CopyFile(assetInfo.AssetPath, dest, true);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCopyBuildinFiles_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCopyBuildinFiles_RFBP.cs
index f1a7476..4b9148f 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCopyBuildinFiles_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCopyBuildinFiles_RFBP.cs
@@ -6,21 +6,21 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskCopyBuildinFiles_RFBP : TaskCopyBuildinFiles, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters;
- var manifestContext = context.GetContextObject();
+ public class TaskCopyBuildinFiles_RFBP : TaskCopyBuildinFiles, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters;
+ var manifestContext = context.GetContextObject();
- if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
- {
- if (buildParameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
- {
- CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
- }
- }
- }
- }
+ if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
+ {
+ if (buildParameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateManifest_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateManifest_RFBP.cs
index faed139..4a7778a 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateManifest_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateManifest_RFBP.cs
@@ -5,16 +5,16 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskCreateManifest_RFBP : TaskCreateManifest, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- CreateManifestFile(context);
- }
+ public class TaskCreateManifest_RFBP : TaskCreateManifest, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ CreateManifestFile(context);
+ }
- protected override string[] GetBundleDepends(BuildContext context, string bundleName)
- {
- return new string[] { };
- }
- }
+ protected override string[] GetBundleDepends(BuildContext context, string bundleName)
+ {
+ return new string[] { };
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreatePackage_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreatePackage_RFBP.cs
index eb25b0f..f8a2a3b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreatePackage_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreatePackage_RFBP.cs
@@ -3,36 +3,36 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskCreatePackage_RFBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild)
- {
- CreatePackageCatalog(buildParameters, buildMapContext);
- }
- }
+ public class TaskCreatePackage_RFBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild)
+ {
+ CreatePackageCatalog(buildParameters, buildMapContext);
+ }
+ }
- ///
- /// 拷贝补丁文件到补丁包目录
- ///
- private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
- {
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
+ ///
+ /// 拷贝补丁文件到补丁包目录
+ ///
+ private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
+ {
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
- // 拷贝所有补丁文件
- int progressValue = 0;
- int fileTotalCount = buildMapContext.Collection.Count;
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
- EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
- }
- EditorTools.ClearProgressBar();
- }
- }
+ // 拷贝所有补丁文件
+ int progressValue = 0;
+ int fileTotalCount = buildMapContext.Collection.Count;
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
+ EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
+ }
+ EditorTools.ClearProgressBar();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateReport_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateReport_RFBP.cs
index f85e35c..83458c9 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateReport_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateReport_RFBP.cs
@@ -6,19 +6,19 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskCreateReport_RFBP : TaskCreateReport, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var manifestContext = context.GetContextObject();
+ public class TaskCreateReport_RFBP : TaskCreateReport, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var manifestContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild)
- {
- CreateReportFile(buildParameters, buildMapContext, manifestContext);
- }
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild)
+ {
+ CreateReportFile(buildParameters, buildMapContext, manifestContext);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskGetBuildMap_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskGetBuildMap_RFBP.cs
index 181ec3e..88f99be 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskGetBuildMap_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskGetBuildMap_RFBP.cs
@@ -7,32 +7,32 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskGetBuildMap_RFBP : TaskGetBuildMap, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
- context.SetContextObject(buildMapContext);
+ public class TaskGetBuildMap_RFBP : TaskGetBuildMap, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
+ context.SetContextObject(buildMapContext);
- // 检测构建结果
- CheckBuildMapContent(buildMapContext);
- }
+ // 检测构建结果
+ CheckBuildMapContent(buildMapContext);
+ }
- ///
- /// 检测资源构建上下文
- ///
- private void CheckBuildMapContent(BuildMapContext buildMapContext)
- {
- // 注意:原生文件资源包只能包含一个原生文件
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- if (bundleInfo.MainAssets.Count != 1)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotSupportMultipleRawAsset, $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- }
- }
- }
+ ///
+ /// 检测资源构建上下文
+ ///
+ private void CheckBuildMapContent(BuildMapContext buildMapContext)
+ {
+ // 注意:原生文件资源包只能包含一个原生文件
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ if (bundleInfo.MainAssets.Count != 1)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotSupportMultipleRawAsset, $"The bundle does not support multiple raw asset : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskPrepare_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskPrepare_RFBP.cs
index 2e5987b..381edac 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskPrepare_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskPrepare_RFBP.cs
@@ -6,27 +6,27 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskPrepare_RFBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters;
+ public class TaskPrepare_RFBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters;
- // 检测基础构建参数
- buildParametersContext.CheckBuildParameters();
+ // 检测基础构建参数
+ buildParametersContext.CheckBuildParameters();
- // 检测不被支持的构建模式
- if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
- throw new Exception(message);
- }
- if (buildParameters.BuildMode == EBuildMode.IncrementalBuild)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.IncrementalBuild)} build mode !");
- throw new Exception(message);
- }
- }
- }
+ // 检测不被支持的构建模式
+ if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
+ throw new Exception(message);
+ }
+ if (buildParameters.BuildMode == EBuildMode.IncrementalBuild)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.RawFileBuildPipeline)} not support {nameof(EBuildMode.IncrementalBuild)} build mode !");
+ throw new Exception(message);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskUpdateBundleInfo_RFBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskUpdateBundleInfo_RFBP.cs
index e9e7899..ffc8571 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskUpdateBundleInfo_RFBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskUpdateBundleInfo_RFBP.cs
@@ -6,58 +6,58 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskUpdateBundleInfo_RFBP : TaskUpdateBundleInfo, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- UpdateBundleInfo(context);
- }
+ public class TaskUpdateBundleInfo_RFBP : TaskUpdateBundleInfo, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ UpdateBundleInfo(context);
+ }
- protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var parameters = buildParametersContext.Parameters;
- var buildMode = parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- {
- return "00000000000000000000000000000000"; //32位
- }
- else
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- return HashUtility.FileMD5(filePath);
- }
- }
- protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
- {
- return 0;
- }
- protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return GetFilePathTempHash(filePath);
- else
- return HashUtility.FileMD5(filePath);
- }
- protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return "00000000"; //8位
- else
- return HashUtility.FileCRC32(filePath);
- }
- protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return GetBundleTempSize(bundleInfo);
- else
- return FileUtility.GetFileSize(filePath);
- }
- }
+ protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var parameters = buildParametersContext.Parameters;
+ var buildMode = parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ {
+ return "00000000000000000000000000000000"; //32位
+ }
+ else
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ return HashUtility.FileMD5(filePath);
+ }
+ }
+ protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ return 0;
+ }
+ protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return GetFilePathTempHash(filePath);
+ else
+ return HashUtility.FileMD5(filePath);
+ }
+ protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return "00000000"; //8位
+ else
+ return HashUtility.FileCRC32(filePath);
+ }
+ protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return GetBundleTempSize(bundleInfo);
+ else
+ return FileUtility.GetFileSize(filePath);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildParameters.cs
index cbb61ed..eedb8d5 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildParameters.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildParameters.cs
@@ -4,7 +4,7 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class RawFileBuildParameters : BuildParameters
- {
- }
+ public class RawFileBuildParameters : BuildParameters
+ {
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
index 517e04e..7865150 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
@@ -7,31 +7,31 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class RawFileBuildPipeline : IBuildPipeline
- {
- public BuildResult Run(BuildParameters buildParameters, bool enableLog)
- {
- AssetBundleBuilder builder = new AssetBundleBuilder();
- return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
- }
+ public class RawFileBuildPipeline : IBuildPipeline
+ {
+ public BuildResult Run(BuildParameters buildParameters, bool enableLog)
+ {
+ AssetBundleBuilder builder = new AssetBundleBuilder();
+ return builder.Run(buildParameters, GetDefaultBuildPipeline(), enableLog);
+ }
- ///
- /// 获取默认的构建流程
- ///
- private List GetDefaultBuildPipeline()
- {
- List pipeline = new List
- {
- new TaskPrepare_RFBP(),
- new TaskGetBuildMap_RFBP(),
- new TaskBuilding_RFBP(),
- new TaskUpdateBundleInfo_RFBP(),
- new TaskCreateManifest_RFBP(),
- new TaskCreateReport_RFBP(),
- new TaskCreatePackage_RFBP(),
- new TaskCopyBuildinFiles_RFBP(),
- };
- return pipeline;
- }
- }
+ ///
+ /// 获取默认的构建流程
+ ///
+ private List GetDefaultBuildPipeline()
+ {
+ List pipeline = new List
+ {
+ new TaskPrepare_RFBP(),
+ new TaskGetBuildMap_RFBP(),
+ new TaskBuilding_RFBP(),
+ new TaskUpdateBundleInfo_RFBP(),
+ new TaskCreateManifest_RFBP(),
+ new TaskCreateReport_RFBP(),
+ new TaskCreatePackage_RFBP(),
+ new TaskCopyBuildinFiles_RFBP(),
+ };
+ return pipeline;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskBuilding_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskBuilding_SBP.cs
index 3617741..03cbd54 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskBuilding_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskBuilding_SBP.cs
@@ -8,51 +8,51 @@ using UnityEditor.Build.Pipeline.Tasks;
namespace YooAsset.Editor
{
- public class TaskBuilding_SBP : IBuildTask
- {
- public class BuildResultContext : IContextObject
- {
- public IBundleBuildResults Results;
- }
+ public class TaskBuilding_SBP : IBuildTask
+ {
+ public class BuildResultContext : IContextObject
+ {
+ public IBundleBuildResults Results;
+ }
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
- // 模拟构建模式下跳过引擎构建
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return;
+ // 模拟构建模式下跳过引擎构建
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return;
- // 构建内容
- var buildContent = new BundleBuildContent(buildMapContext.GetPipelineBuilds());
+ // 构建内容
+ var buildContent = new BundleBuildContent(buildMapContext.GetPipelineBuilds());
- // 开始构建
- IBundleBuildResults buildResults;
- var buildParameters = scriptableBuildParameters.GetBundleBuildParameters();
- var taskList = SBPBuildTasks.Create(buildMapContext.Command.ShadersBundleName);
- ReturnCode exitCode = ContentPipeline.BuildAssetBundles(buildParameters, buildContent, out buildResults, taskList);
- if (exitCode < 0)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, $"UnityEngine build failed ! ReturnCode : {exitCode}");
- throw new Exception(message);
- }
+ // 开始构建
+ IBundleBuildResults buildResults;
+ var buildParameters = scriptableBuildParameters.GetBundleBuildParameters();
+ var taskList = SBPBuildTasks.Create(buildMapContext.Command.ShadersBundleName);
+ ReturnCode exitCode = ContentPipeline.BuildAssetBundles(buildParameters, buildContent, out buildResults, taskList);
+ if (exitCode < 0)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.UnityEngineBuildFailed, $"UnityEngine build failed ! ReturnCode : {exitCode}");
+ throw new Exception(message);
+ }
- // 创建着色器信息
- // 说明:解决因为着色器资源包导致验证失败。
- // 例如:当项目里没有着色器,如果有依赖内置着色器就会验证失败。
- string shadersBundleName = buildMapContext.Command.ShadersBundleName;
- if (buildResults.BundleInfos.ContainsKey(shadersBundleName))
- {
- buildMapContext.CreateShadersBundleInfo(shadersBundleName);
- }
+ // 创建着色器信息
+ // 说明:解决因为着色器资源包导致验证失败。
+ // 例如:当项目里没有着色器,如果有依赖内置着色器就会验证失败。
+ string shadersBundleName = buildMapContext.Command.ShadersBundleName;
+ if (buildResults.BundleInfos.ContainsKey(shadersBundleName))
+ {
+ buildMapContext.CreateShadersBundleInfo(shadersBundleName);
+ }
- BuildLogger.Log("UnityEngine build success!");
- BuildResultContext buildResultContext = new BuildResultContext();
- buildResultContext.Results = buildResults;
- context.SetContextObject(buildResultContext);
- }
- }
+ BuildLogger.Log("UnityEngine build success!");
+ BuildResultContext buildResultContext = new BuildResultContext();
+ buildResultContext.Results = buildResults;
+ context.SetContextObject(buildResultContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCopyBuildinFiles_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCopyBuildinFiles_SBP.cs
index 90a46f7..c830064 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCopyBuildinFiles_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCopyBuildinFiles_SBP.cs
@@ -6,21 +6,21 @@ using UnityEngine;
namespace YooAsset.Editor
{
- public class TaskCopyBuildinFiles_SBP : TaskCopyBuildinFiles, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var manifestContext = context.GetContextObject();
- var buildMode = buildParametersContext.Parameters.BuildMode;
+ public class TaskCopyBuildinFiles_SBP : TaskCopyBuildinFiles, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var manifestContext = context.GetContextObject();
+ var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
- {
- CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
- }
- }
- }
- }
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CopyBuildinFilesToStreaming(buildParametersContext, manifestContext.Manifest);
+ }
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateManifest_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateManifest_SBP.cs
index f208529..df244ec 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateManifest_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateManifest_SBP.cs
@@ -7,26 +7,26 @@ using UnityEditor.Build.Pipeline.Interfaces;
namespace YooAsset.Editor
{
- public class TaskCreateManifest_SBP : TaskCreateManifest, IBuildTask
- {
- private TaskBuilding_SBP.BuildResultContext _buildResultContext = null;
+ public class TaskCreateManifest_SBP : TaskCreateManifest, IBuildTask
+ {
+ private TaskBuilding_SBP.BuildResultContext _buildResultContext = null;
- void IBuildTask.Run(BuildContext context)
- {
- CreateManifestFile(context);
- }
+ void IBuildTask.Run(BuildContext context)
+ {
+ CreateManifestFile(context);
+ }
- protected override string[] GetBundleDepends(BuildContext context, string bundleName)
- {
- if (_buildResultContext == null)
- _buildResultContext = context.GetContextObject();
+ protected override string[] GetBundleDepends(BuildContext context, string bundleName)
+ {
+ if (_buildResultContext == null)
+ _buildResultContext = context.GetContextObject();
- if (_buildResultContext.Results.BundleInfos.ContainsKey(bundleName) == false)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleInBuildResult, $"Not found bundle in engine build result : {bundleName}");
- throw new Exception(message);
- }
- return _buildResultContext.Results.BundleInfos[bundleName].Dependencies;
- }
- }
+ if (_buildResultContext.Results.BundleInfos.ContainsKey(bundleName) == false)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleInBuildResult, $"Not found bundle in engine build result : {bundleName}");
+ throw new Exception(message);
+ }
+ return _buildResultContext.Results.BundleInfos[bundleName].Dependencies;
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreatePackage_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreatePackage_SBP.cs
index ca41eb3..5fa6569 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreatePackage_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreatePackage_SBP.cs
@@ -3,53 +3,53 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskCreatePackage_SBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild)
- {
- CreatePackageCatalog(buildParameters, buildMapContext);
- }
- }
+ public class TaskCreatePackage_SBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild)
+ {
+ CreatePackageCatalog(buildParameters, buildMapContext);
+ }
+ }
- ///
- /// 拷贝补丁文件到补丁包目录
- ///
- private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
- {
- var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
- string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
- string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
- BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
+ ///
+ /// 拷贝补丁文件到补丁包目录
+ ///
+ private void CreatePackageCatalog(BuildParametersContext buildParametersContext, BuildMapContext buildMapContext)
+ {
+ var scriptableBuildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
+ string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
+ string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
+ BuildLogger.Log($"Start making patch package: {packageOutputDirectory}");
- // 拷贝构建日志
- {
- string sourcePath = $"{pipelineOutputDirectory}/buildlogtep.json";
- string destPath = $"{packageOutputDirectory}/buildlogtep.json";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝构建日志
+ {
+ string sourcePath = $"{pipelineOutputDirectory}/buildlogtep.json";
+ string destPath = $"{packageOutputDirectory}/buildlogtep.json";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝代码防裁剪配置
- if (scriptableBuildParameters.WriteLinkXML)
- {
- string sourcePath = $"{pipelineOutputDirectory}/link.xml";
- string destPath = $"{packageOutputDirectory}/link.xml";
- EditorTools.CopyFile(sourcePath, destPath, true);
- }
+ // 拷贝代码防裁剪配置
+ if (scriptableBuildParameters.WriteLinkXML)
+ {
+ string sourcePath = $"{pipelineOutputDirectory}/link.xml";
+ string destPath = $"{packageOutputDirectory}/link.xml";
+ EditorTools.CopyFile(sourcePath, destPath, true);
+ }
- // 拷贝所有补丁文件
- int progressValue = 0;
- int fileTotalCount = buildMapContext.Collection.Count;
- foreach (var bundleInfo in buildMapContext.Collection)
- {
- EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
- EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
- }
- EditorTools.ClearProgressBar();
- }
- }
+ // 拷贝所有补丁文件
+ int progressValue = 0;
+ int fileTotalCount = buildMapContext.Collection.Count;
+ foreach (var bundleInfo in buildMapContext.Collection)
+ {
+ EditorTools.CopyFile(bundleInfo.PackageSourceFilePath, bundleInfo.PackageDestFilePath, true);
+ EditorTools.DisplayProgressBar("Copy patch file", ++progressValue, fileTotalCount);
+ }
+ EditorTools.ClearProgressBar();
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateReport_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateReport_SBP.cs
index 36d093c..5c7c8be 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateReport_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateReport_SBP.cs
@@ -6,19 +6,19 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskCreateReport_SBP : TaskCreateReport, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- var manifestContext = context.GetContextObject();
+ public class TaskCreateReport_SBP : TaskCreateReport, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
+ var manifestContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode != EBuildMode.SimulateBuild)
- {
- CreateReportFile(buildParameters, buildMapContext, manifestContext);
- }
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode != EBuildMode.SimulateBuild)
+ {
+ CreateReportFile(buildParameters, buildMapContext, manifestContext);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskEncryption_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskEncryption_SBP.cs
index b0f009a..8b1ffae 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskEncryption_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskEncryption_SBP.cs
@@ -6,18 +6,18 @@ using System.Collections.Generic;
namespace YooAsset.Editor
{
- public class TaskEncryption_SBP : TaskEncryption, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
+ public class TaskEncryption_SBP : TaskEncryption, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParameters = context.GetContextObject();
+ var buildMapContext = context.GetContextObject();
- var buildMode = buildParameters.Parameters.BuildMode;
- if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
- {
- EncryptingBundleFiles(buildParameters, buildMapContext);
- }
- }
- }
+ var buildMode = buildParameters.Parameters.BuildMode;
+ if (buildMode == EBuildMode.ForceRebuild || buildMode == EBuildMode.IncrementalBuild)
+ {
+ EncryptingBundleFiles(buildParameters, buildMapContext);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskGetBuildMap_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskGetBuildMap_SBP.cs
index 536202c..938f607 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskGetBuildMap_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskGetBuildMap_SBP.cs
@@ -7,13 +7,13 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskGetBuildMap_SBP : TaskGetBuildMap, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
- context.SetContextObject(buildMapContext);
- }
- }
+ public class TaskGetBuildMap_SBP : TaskGetBuildMap, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildMapContext = CreateBuildMap(buildParametersContext.Parameters);
+ context.SetContextObject(buildMapContext);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskPrepare_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskPrepare_SBP.cs
index bc38545..0fbf321 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskPrepare_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskPrepare_SBP.cs
@@ -6,27 +6,27 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskPrepare_SBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters;
+ public class TaskPrepare_SBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters;
- // 检测基础构建参数
- buildParametersContext.CheckBuildParameters();
+ // 检测基础构建参数
+ buildParametersContext.CheckBuildParameters();
- // 检测不被支持的构建模式
- if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
- throw new Exception(message);
- }
- if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
- throw new Exception(message);
- }
- }
- }
+ // 检测不被支持的构建模式
+ if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
+ throw new Exception(message);
+ }
+ if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineNotSupportBuildMode, $"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
+ throw new Exception(message);
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskUpdateBundleInfo_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskUpdateBundleInfo_SBP.cs
index ec07041..4cc4812 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskUpdateBundleInfo_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskUpdateBundleInfo_SBP.cs
@@ -6,86 +6,86 @@ using UnityEditor;
namespace YooAsset.Editor
{
- public class TaskUpdateBundleInfo_SBP : TaskUpdateBundleInfo, IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- UpdateBundleInfo(context);
- }
+ public class TaskUpdateBundleInfo_SBP : TaskUpdateBundleInfo, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ UpdateBundleInfo(context);
+ }
- protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var parameters = buildParametersContext.Parameters;
- var buildMode = parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- {
- return "00000000000000000000000000000000"; //32位
- }
- else
- {
- // 注意:当资源包的依赖列表发生变化的时候,ContentHash也会发生变化!
- var buildResult = context.GetContextObject();
- if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
- {
- return value.Hash.ToString();
- }
- else
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- }
- }
- protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var parameters = buildParametersContext.Parameters;
- var buildMode = parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- {
- return 0;
- }
- else
- {
- var buildResult = context.GetContextObject();
- if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
- {
- return value.Crc;
- }
- else
- {
- string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
- throw new Exception(message);
- }
- }
- }
- protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return GetFilePathTempHash(filePath);
- else
- return HashUtility.FileMD5(filePath);
- }
- protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return "00000000"; //8位
- else
- return HashUtility.FileCRC32(filePath);
- }
- protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
- {
- string filePath = bundleInfo.PackageSourceFilePath;
- var buildMode = buildParametersContext.Parameters.BuildMode;
- if (buildMode == EBuildMode.SimulateBuild)
- return GetBundleTempSize(bundleInfo);
- else
- return FileUtility.GetFileSize(filePath);
- }
- }
+ protected override string GetUnityHash(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var parameters = buildParametersContext.Parameters;
+ var buildMode = parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ {
+ return "00000000000000000000000000000000"; //32位
+ }
+ else
+ {
+ // 注意:当资源包的依赖列表发生变化的时候,ContentHash也会发生变化!
+ var buildResult = context.GetContextObject();
+ if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
+ {
+ return value.Hash.ToString();
+ }
+ else
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleHash, $"Not found unity bundle hash : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ }
+ }
+ protected override uint GetUnityCRC(BuildBundleInfo bundleInfo, BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var parameters = buildParametersContext.Parameters;
+ var buildMode = parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ {
+ return 0;
+ }
+ else
+ {
+ var buildResult = context.GetContextObject();
+ if (buildResult.Results.BundleInfos.TryGetValue(bundleInfo.BundleName, out var value))
+ {
+ return value.Crc;
+ }
+ else
+ {
+ string message = BuildLogger.GetErrorMessage(ErrorCode.NotFoundUnityBundleCRC, $"Not found unity bundle crc : {bundleInfo.BundleName}");
+ throw new Exception(message);
+ }
+ }
+ }
+ protected override string GetBundleFileHash(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return GetFilePathTempHash(filePath);
+ else
+ return HashUtility.FileMD5(filePath);
+ }
+ protected override string GetBundleFileCRC(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return "00000000"; //8位
+ else
+ return HashUtility.FileCRC32(filePath);
+ }
+ protected override long GetBundleFileSize(BuildBundleInfo bundleInfo, BuildParametersContext buildParametersContext)
+ {
+ string filePath = bundleInfo.PackageSourceFilePath;
+ var buildMode = buildParametersContext.Parameters.BuildMode;
+ if (buildMode == EBuildMode.SimulateBuild)
+ return GetBundleTempSize(bundleInfo);
+ else
+ return FileUtility.GetFileSize(filePath);
+ }
+ }
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskVerifyBuildResult_SBP.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskVerifyBuildResult_SBP.cs
index 1d62d7a..db6630b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskVerifyBuildResult_SBP.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskVerifyBuildResult_SBP.cs
@@ -9,66 +9,66 @@ using UnityEditor.Build.Pipeline.Interfaces;
namespace YooAsset.Editor
{
- public class TaskVerifyBuildResult_SBP : IBuildTask
- {
- void IBuildTask.Run(BuildContext context)
- {
- var buildParametersContext = context.GetContextObject();
- var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
+ public class TaskVerifyBuildResult_SBP : IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ var buildParameters = buildParametersContext.Parameters as ScriptableBuildParameters;
- // 模拟构建模式下跳过验证
- if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
- return;
+ // 模拟构建模式下跳过验证
+ if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
+ return;
- // 验证构建结果
- if (buildParameters.VerifyBuildingResult)
- {
- var buildResultContext = context.GetContextObject();
- VerifyingBuildingResult(context, buildResultContext.Results);
- }
- }
+ // 验证构建结果
+ if (buildParameters.VerifyBuildingResult)
+ {
+ var buildResultContext = context.GetContextObject();
+ VerifyingBuildingResult(context, buildResultContext.Results);
+ }
+ }
- ///
- /// 验证构建结果
- ///
- private void VerifyingBuildingResult(BuildContext context, IBundleBuildResults buildResults)
- {
- var buildParameters = context.GetContextObject();
- var buildMapContext = context.GetContextObject();
- List