From 02b9b689b79f98e24d970c27f931a25551ff323a Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 21 Sep 2022 11:18:38 +0800 Subject: [PATCH] Update AssetBundleBuilder MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 可编程构建管线强制使用增量构建模式。 --- .../AssetBundleBuilder/AssetBundleBuilder.cs | 10 ++++++++-- .../AssetBundleBuilder/BuildParametersContext.cs | 16 +++------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs index 2358427..9abe437 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleBuilder.cs @@ -20,13 +20,19 @@ namespace YooAsset.Editor // 检测构建参数是否为空 if (buildParameters == null) - { throw new Exception($"{nameof(buildParameters)} is null !"); - } + + // 检测可编程构建管线参数 if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline) { if (buildParameters.SBPParameters == null) throw new Exception($"{nameof(BuildParameters.SBPParameters)} is null !"); + + if (buildParameters.BuildMode == EBuildMode.DryRunBuild) + throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !"); + + if (buildParameters.BuildMode == EBuildMode.ForceRebuild) + throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !"); } // 构建参数 diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs index 175d281..e06d7fc 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParametersContext.cs @@ -85,9 +85,6 @@ namespace YooAsset.Editor if (Parameters.BuildMode == EBuildMode.SimulateBuild) throw new Exception("Should never get here !"); - if (Parameters.BuildMode == EBuildMode.DryRunBuild) - throw new Exception($"SBP not support {nameof(EBuildMode.DryRunBuild)} build mode !"); - var targetGroup = BuildPipeline.GetBuildTargetGroup(Parameters.BuildTarget); var buildParams = new UnityEditor.Build.Pipeline.BundleBuildParameters(Parameters.BuildTarget, targetGroup, PipelineOutputDirectory); @@ -103,16 +100,9 @@ namespace YooAsset.Editor if (Parameters.DisableWriteTypeTree) buildParams.ContentBuildFlags |= UnityEditor.Build.Content.ContentBuildFlags.DisableWriteTypeTree; - if(Parameters.BuildMode == EBuildMode.ForceRebuild) - { - buildParams.UseCache = false; - } - else - { - buildParams.UseCache = true; - buildParams.CacheServerHost = Parameters.SBPParameters.CacheServerHost; - buildParams.CacheServerPort = Parameters.SBPParameters.CacheServerPort; - } + buildParams.UseCache = true; + buildParams.CacheServerHost = Parameters.SBPParameters.CacheServerHost; + buildParams.CacheServerPort = Parameters.SBPParameters.CacheServerPort; buildParams.WriteLinkXML = Parameters.SBPParameters.WriteLinkXML; return buildParams;