mirror of https://github.com/tuyoogame/YooAsset
Optimized the speed of simulate build
parent
091758022f
commit
65875b66c2
|
@ -89,9 +89,9 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取构建的耗时(单位:秒)
|
/// 获取构建的耗时(单位:秒)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int GetBuildingSeconds()
|
public float GetBuildingSeconds()
|
||||||
{
|
{
|
||||||
int seconds = (int)(_buildWatch.ElapsedMilliseconds / 1000);
|
float seconds = _buildWatch.ElapsedMilliseconds / 1000f;
|
||||||
return seconds;
|
return seconds;
|
||||||
}
|
}
|
||||||
public void BeginWatch()
|
public void BeginWatch()
|
||||||
|
@ -139,9 +139,9 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
bool succeed = BuildRunner.Run(pipeline, _buildContext);
|
bool succeed = BuildRunner.Run(pipeline, _buildContext);
|
||||||
if (succeed)
|
if (succeed)
|
||||||
Debug.Log($"{buildParameters.BuildMode}模式构建成功!");
|
Debug.Log($"{buildParameters.BuildMode} pipeline build succeed !");
|
||||||
else
|
else
|
||||||
Debug.LogWarning($"{buildParameters.BuildMode}模式构建失败!");
|
Debug.LogWarning($"{buildParameters.BuildMode} pipeline build failed !");
|
||||||
return succeed;
|
return succeed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ namespace YooAsset.Editor
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 普通日志输出
|
/// 日志输出
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void Log(string info)
|
public static void Log(string info)
|
||||||
{
|
{
|
||||||
|
@ -54,5 +54,13 @@ namespace YooAsset.Editor
|
||||||
UnityEngine.Debug.Log(info);
|
UnityEngine.Debug.Log(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 日志输出
|
||||||
|
/// </summary>
|
||||||
|
public static void Info(string info)
|
||||||
|
{
|
||||||
|
UnityEngine.Debug.Log(info);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,20 +12,30 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
var buildParameters = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
var buildParameters = context.GetContextObject<AssetBundleBuilder.BuildParametersContext>();
|
||||||
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
var buildMapContext = context.GetContextObject<BuildMapContext>();
|
||||||
CreateReportFile(buildParameters, buildMapContext);
|
buildParameters.StopWatch();
|
||||||
|
|
||||||
|
var buildMode = buildParameters.Parameters.BuildMode;
|
||||||
|
if (buildMode != EBuildMode.SimulateBuild)
|
||||||
|
{
|
||||||
|
CreateReportFile(buildParameters, buildMapContext);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
float buildSeconds = buildParameters.GetBuildingSeconds();
|
||||||
|
BuildRunner.Info($"Build time consuming {buildSeconds} seconds.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateReportFile(AssetBundleBuilder.BuildParametersContext buildParameters, BuildMapContext buildMapContext)
|
private void CreateReportFile(AssetBundleBuilder.BuildParametersContext buildParameters, BuildMapContext buildMapContext)
|
||||||
{
|
{
|
||||||
PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(buildParameters.PipelineOutputDirectory, buildParameters.Parameters.BuildVersion);
|
PatchManifest patchManifest = AssetBundleBuilderHelper.LoadPatchManifestFile(buildParameters.PipelineOutputDirectory, buildParameters.Parameters.BuildVersion);
|
||||||
BuildReport buildReport = new BuildReport();
|
BuildReport buildReport = new BuildReport();
|
||||||
buildParameters.StopWatch();
|
|
||||||
|
|
||||||
// 概述信息
|
// 概述信息
|
||||||
{
|
{
|
||||||
buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
|
buildReport.Summary.UnityVersion = UnityEngine.Application.unityVersion;
|
||||||
buildReport.Summary.BuildTime = DateTime.Now.ToString();
|
buildReport.Summary.BuildTime = DateTime.Now.ToString();
|
||||||
buildReport.Summary.BuildSeconds = buildParameters.GetBuildingSeconds();
|
buildReport.Summary.BuildSeconds = (int)buildParameters.GetBuildingSeconds();
|
||||||
buildReport.Summary.BuildTarget = buildParameters.Parameters.BuildTarget;
|
buildReport.Summary.BuildTarget = buildParameters.Parameters.BuildTarget;
|
||||||
buildReport.Summary.BuildMode = buildParameters.Parameters.BuildMode;
|
buildReport.Summary.BuildMode = buildParameters.Parameters.BuildMode;
|
||||||
buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion;
|
buildReport.Summary.BuildVersion = buildParameters.Parameters.BuildVersion;
|
||||||
|
|
|
@ -89,6 +89,13 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<CollectAssetInfo> GetAllCollectAssets(AssetBundleCollectorGroup group)
|
public List<CollectAssetInfo> GetAllCollectAssets(AssetBundleCollectorGroup group)
|
||||||
{
|
{
|
||||||
|
// 注意:模拟构建模式下只收集主资源
|
||||||
|
if (AssetBundleCollectorSetting.BuildMode == EBuildMode.SimulateBuild)
|
||||||
|
{
|
||||||
|
if (CollectorType != ECollectorType.MainAssetCollector)
|
||||||
|
return new List<CollectAssetInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
Dictionary<string, CollectAssetInfo> result = new Dictionary<string, CollectAssetInfo>(1000);
|
||||||
bool isRawAsset = PackRuleName == nameof(PackRawFile);
|
bool isRawAsset = PackRuleName == nameof(PackRawFile);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue