mirror of https://github.com/tuyoogame/YooAsset
update asset bundle builder
parent
93d7c34454
commit
b330d26b4f
|
@ -39,12 +39,6 @@ namespace YooAsset.Editor
|
|||
var buildParametersContext = new BuildParametersContext(buildParameters);
|
||||
_buildContext.SetContextObject(buildParametersContext);
|
||||
|
||||
// 是否显示LOG
|
||||
if (buildParameters.BuildMode == EBuildMode.SimulateBuild)
|
||||
BuildLogger.EnableLog = false;
|
||||
else
|
||||
BuildLogger.EnableLog = true;
|
||||
|
||||
// 创建构建节点
|
||||
List<IBuildTask> pipeline;
|
||||
if (buildParameters.BuildPipeline == EBuildPipeline.BuiltinBuildPipeline)
|
||||
|
@ -86,19 +80,23 @@ namespace YooAsset.Editor
|
|||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// 初始化日志
|
||||
BuildLogger.InitLogger(buildParameters.EnableLog);
|
||||
|
||||
// 执行构建流程
|
||||
var buildResult = BuildRunner.Run(pipeline, _buildContext);
|
||||
if (buildResult.Success)
|
||||
{
|
||||
buildResult.OutputPackageDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||
Debug.Log($"{buildParameters.BuildMode} pipeline build succeed !");
|
||||
BuildLogger.Log($"{buildParameters.BuildMode} pipeline build succeed !");
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning($"{buildParameters.BuildMode} pipeline build failed !");
|
||||
Debug.LogError($"Build task failed : {buildResult.FailedTask}");
|
||||
Debug.LogError($"Build task error : {buildResult.FailedInfo}");
|
||||
BuildLogger.Warning($"{buildParameters.BuildMode} pipeline build failed !");
|
||||
BuildLogger.Error($"Build task failed : {buildResult.FailedTask}");
|
||||
BuildLogger.Error($"Build task error : {buildResult.FailedInfo}");
|
||||
}
|
||||
|
||||
return buildResult;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ namespace YooAsset.Editor
|
|||
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
||||
buildParameters.PackageName = packageName;
|
||||
buildParameters.PackageVersion = "Simulate";
|
||||
buildParameters.EnableLog = false;
|
||||
|
||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||
var buildResult = builder.Run(buildParameters);
|
||||
|
|
|
@ -67,6 +67,11 @@ namespace YooAsset.Editor
|
|||
public string PackageVersion;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示普通日志
|
||||
/// </summary>
|
||||
public bool EnableLog = true;
|
||||
|
||||
/// <summary>
|
||||
/// 验证构建结果
|
||||
/// </summary>
|
||||
|
|
|
@ -1,30 +1,33 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace YooAsset.Editor
|
||||
{
|
||||
public static class BuildLogger
|
||||
{
|
||||
/// <summary>
|
||||
/// 是否启用LOG
|
||||
/// </summary>
|
||||
public static bool EnableLog = true;
|
||||
private static bool _enableLog = true;
|
||||
|
||||
/// <summary>
|
||||
/// 日志输出
|
||||
/// </summary>
|
||||
public static void Log(string info)
|
||||
public static void InitLogger(bool enableLog)
|
||||
{
|
||||
if (EnableLog)
|
||||
{
|
||||
UnityEngine.Debug.Log(info);
|
||||
}
|
||||
_enableLog = enableLog;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 日志输出
|
||||
/// </summary>
|
||||
public static void Info(string info)
|
||||
public static void Log(string message)
|
||||
{
|
||||
UnityEngine.Debug.Log(info);
|
||||
if (_enableLog)
|
||||
{
|
||||
Debug.Log(message);
|
||||
}
|
||||
}
|
||||
public static void Warning(string message)
|
||||
{
|
||||
Debug.LogWarning(message);
|
||||
}
|
||||
public static void Error(string message)
|
||||
{
|
||||
Debug.LogError(message);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -47,7 +47,7 @@ namespace YooAsset.Editor
|
|||
// 注意:原生文件不支持加密
|
||||
if (bundleInfo.IsRawFile)
|
||||
{
|
||||
UnityEngine.Debug.LogWarning($"Encryption not support raw file : {bundleInfo.BundleName}");
|
||||
BuildLogger.Warning($"Encryption not support raw file : {bundleInfo.BundleName}");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var exceptBundle in exceptBundleList1)
|
||||
{
|
||||
Debug.LogWarning($"差异资源包: {exceptBundle}");
|
||||
BuildLogger.Warning($"差异资源包: {exceptBundle}");
|
||||
}
|
||||
throw new System.Exception("存在差异资源包!请查看警告信息!");
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var exceptBundle in exceptBundleList2)
|
||||
{
|
||||
Debug.LogWarning($"差异资源包: {exceptBundle}");
|
||||
BuildLogger.Warning($"差异资源包: {exceptBundle}");
|
||||
}
|
||||
throw new System.Exception("存在差异资源包!请查看警告信息!");
|
||||
}
|
||||
|
@ -76,16 +76,16 @@ namespace YooAsset.Editor
|
|||
string[] mapAssetPaths = buildMapContext.GetBuildinAssetPaths(buildedBundle);
|
||||
if (mapAssetPaths.Length != buildedAssetPaths.Length)
|
||||
{
|
||||
Debug.LogWarning($"构建的Bundle文件内的资源对象数量和预期不匹配 : {buildedBundle}");
|
||||
BuildLogger.Warning($"构建的Bundle文件内的资源对象数量和预期不匹配 : {buildedBundle}");
|
||||
var exceptAssetList1 = mapAssetPaths.Except(buildedAssetPaths).ToList();
|
||||
foreach (var excpetAsset in exceptAssetList1)
|
||||
{
|
||||
Debug.LogWarning($"构建失败的资源对象路径为 : {excpetAsset}");
|
||||
BuildLogger.Warning($"构建失败的资源对象路径为 : {excpetAsset}");
|
||||
}
|
||||
var exceptAssetList2 = buildedAssetPaths.Except(mapAssetPaths).ToList();
|
||||
foreach (var excpetAsset in exceptAssetList2)
|
||||
{
|
||||
Debug.LogWarning($"构建失败的资源对象路径为 : {excpetAsset}");
|
||||
BuildLogger.Warning($"构建失败的资源对象路径为 : {excpetAsset}");
|
||||
}
|
||||
isPass = false;
|
||||
continue;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var exceptBundle in exceptBundleList1)
|
||||
{
|
||||
Debug.LogWarning($"差异资源包: {exceptBundle}");
|
||||
BuildLogger.Warning($"差异资源包: {exceptBundle}");
|
||||
}
|
||||
throw new System.Exception("存在差异资源包!请查看警告信息!");
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ namespace YooAsset.Editor
|
|||
{
|
||||
foreach (var exceptBundle in exceptBundleList2)
|
||||
{
|
||||
Debug.LogWarning($"差异资源包: {exceptBundle}");
|
||||
BuildLogger.Warning($"差异资源包: {exceptBundle}");
|
||||
}
|
||||
throw new System.Exception("存在差异资源包!请查看警告信息!");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue