parent
75910b7558
commit
9c67461dbc
|
@ -13,7 +13,7 @@ namespace YooAsset.Editor
|
|||
/// <summary>
|
||||
/// 开始构建
|
||||
/// </summary>
|
||||
public bool Run(BuildParameters buildParameters)
|
||||
public BuildResult Run(BuildParameters buildParameters)
|
||||
{
|
||||
// 清空旧数据
|
||||
_buildContext.ClearAllContext();
|
||||
|
@ -77,12 +77,18 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
// 执行构建流程
|
||||
bool succeed = BuildRunner.Run(pipeline, _buildContext);
|
||||
if (succeed)
|
||||
var buildResult = BuildRunner.Run(pipeline, _buildContext);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
Debug.Log($"{buildParameters.BuildMode} pipeline build succeed !");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"{buildParameters.BuildMode} pipeline build failed !");
|
||||
return succeed;
|
||||
Debug.LogError($"Build task failed : {buildResult.FailedTask}");
|
||||
Debug.LogError($"Build task error : {buildResult.FailedInfo}");
|
||||
}
|
||||
return buildResult;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -237,8 +237,8 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
var builder = new AssetBundleBuilder();
|
||||
bool succeed = builder.Run(buildParameters);
|
||||
if (succeed)
|
||||
var buildResult = builder.Run(buildParameters);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
EditorUtility.RevealInFinder($"{buildParameters.OutputRoot}/{buildParameters.BuildTarget}/{buildParameters.BuildVersion}");
|
||||
}
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace YooAsset.Editor
|
|||
buildParameters.EnableAddressable = AssetBundleCollectorSettingData.Setting.EnableAddressable;
|
||||
|
||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||
bool buildResult = builder.Run(buildParameters);
|
||||
if (buildResult)
|
||||
var buildResult = builder.Run(buildParameters);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
string pipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(buildParameters.OutputRoot, buildParameters.BuildTarget);
|
||||
_manifestFilePath = $"{pipelineOutputDirectory}_{EBuildMode.SimulateBuild}/{YooAssetSettingsData.GetPatchManifestFileName(buildParameters.BuildVersion)}";
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建结果
|
||||
/// </summary>
|
||||
public class BuildResult
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建是否成功
|
||||
/// </summary>
|
||||
public bool Success;
|
||||
|
||||
/// <summary>
|
||||
/// 构建失败的任务
|
||||
/// </summary>
|
||||
public string FailedTask;
|
||||
|
||||
/// <summary>
|
||||
/// 构建失败的信息
|
||||
/// </summary>
|
||||
public string FailedInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: e0855c4b5eaa26942bd7ad177fe3c288
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -14,14 +14,15 @@ namespace YooAsset.Editor
|
|||
/// 执行构建流程
|
||||
/// </summary>
|
||||
/// <returns>如果成功返回TRUE,否则返回FALSE</returns>
|
||||
public static bool Run(List<IBuildTask> pipeline, BuildContext context)
|
||||
public static BuildResult Run(List<IBuildTask> pipeline, BuildContext context)
|
||||
{
|
||||
if (pipeline == null)
|
||||
throw new ArgumentNullException("pipeline");
|
||||
if (context == null)
|
||||
throw new ArgumentNullException("context");
|
||||
|
||||
bool succeed = true;
|
||||
BuildResult buildResult = new BuildResult();
|
||||
buildResult.Success = true;
|
||||
for (int i = 0; i < pipeline.Count; i++)
|
||||
{
|
||||
IBuildTask task = pipeline[i];
|
||||
|
@ -33,15 +34,15 @@ namespace YooAsset.Editor
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError($"Build task {task.GetType().Name} failed !");
|
||||
Debug.LogError($"Build error : {e}");
|
||||
succeed = false;
|
||||
buildResult.FailedTask = task.GetType().Name;
|
||||
buildResult.FailedInfo = e.ToString();
|
||||
buildResult.Success = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 返回运行结果
|
||||
return succeed;
|
||||
return buildResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue