Update editor code

pull/51/head
hevinci 2022-09-29 18:40:51 +08:00
parent a71921cdd1
commit 6549fbb552
1 changed files with 6 additions and 15 deletions

View File

@ -4,20 +4,18 @@ namespace YooAsset.Editor
{ {
public static class AssetBundleSimulateBuilder public static class AssetBundleSimulateBuilder
{ {
private static string _manifestFilePath = string.Empty;
/// <summary> /// <summary>
/// 模拟构建 /// 模拟构建
/// </summary> /// </summary>
public static void SimulateBuild() public static string SimulateBuild(string packageName, bool enableAddressable)
{ {
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot(); string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
BuildParameters buildParameters = new BuildParameters(); BuildParameters buildParameters = new BuildParameters();
buildParameters.OutputRoot = defaultOutputRoot; buildParameters.OutputRoot = defaultOutputRoot;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget; buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.BuildMode = EBuildMode.SimulateBuild; buildParameters.BuildMode = EBuildMode.SimulateBuild;
buildParameters.BuildPackage = AssetBundleBuilderSettingData.Setting.BuildPackage; buildParameters.BuildPackage = packageName;
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable; buildParameters.EnableAddressable = enableAddressable;
AssetBundleBuilder builder = new AssetBundleBuilder(); AssetBundleBuilder builder = new AssetBundleBuilder();
var buildResult = builder.Run(buildParameters); var buildResult = builder.Run(buildParameters);
@ -25,20 +23,13 @@ namespace YooAsset.Editor
{ {
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.BuildPackage, buildParameters.BuildTarget, buildParameters.BuildMode); string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.BuildPackage, buildParameters.BuildTarget, buildParameters.BuildMode);
string manifestFileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.BuildPackage, buildResult.OutputPackageCRC); string manifestFileName = YooAssetSettingsData.GetPatchManifestFileName(buildParameters.BuildPackage, buildResult.OutputPackageCRC);
_manifestFilePath = $"{pipelineOutputDirectory}/{manifestFileName}"; string manifestFilePath = $"{pipelineOutputDirectory}/{manifestFileName}";
return manifestFilePath;
} }
else else
{ {
_manifestFilePath = null; return null;
} }
}
/// <summary>
/// 获取构建的补丁清单路径
/// </summary>
public static string GetPatchManifestPath()
{
return _manifestFilePath;
} }
} }
} }