Support do a dry run build.

支持演练构建模式。
This commit is contained in:
hevinci
2022-04-22 15:14:37 +08:00
parent a25fd19bcc
commit 7683746032
17 changed files with 259 additions and 166 deletions

View File

@@ -62,14 +62,14 @@ namespace YooAsset.Editor
// 内置标记列表
List<string> buildinTags = buildParameters.Parameters.GetBuildinTags();
bool dryRunBuild = buildParameters.Parameters.DryRunBuild;
foreach (var bundleInfo in buildMapContext.BundleInfos)
{
var bundleName = bundleInfo.BundleName;
string filePath = $"{buildParameters.PipelineOutputDirectory}/{bundleName}";
string hash = HashUtility.FileMD5(filePath);
string crc32 = HashUtility.FileCRC32(filePath);
long size = FileUtility.GetFileSize(filePath);
int version = buildParameters.Parameters.BuildVersion;
string hash = GetFileHash(filePath, dryRunBuild);
string crc32 = GetFileCRC(filePath, dryRunBuild);
long size = GetFileSize(filePath, dryRunBuild);
string[] tags = buildMapContext.GetAssetTags(bundleName);
bool isEncrypted = encryptionContext.IsEncryptFile(bundleName);
bool isBuildin = IsBuildinBundle(tags, buildinTags);
@@ -101,6 +101,27 @@ namespace YooAsset.Editor
}
return false;
}
private string GetFileHash(string filePath, bool dryRunBuild)
{
if (dryRunBuild)
return "00000000000000000000000000000000"; //32位
else
return HashUtility.FileMD5(filePath);
}
private string GetFileCRC(string filePath, bool dryRunBuild)
{
if (dryRunBuild)
return "00000000"; //8位
else
return HashUtility.FileCRC32(filePath);
}
private long GetFileSize(string filePath, bool dryRunBuild)
{
if (dryRunBuild)
return 0;
else
return FileUtility.GetFileSize(filePath);
}
/// <summary>
/// 获取资源列表