mirror of https://github.com/tuyoogame/YooAsset
parent
15dc047488
commit
775c724840
|
@ -26,7 +26,10 @@ namespace YooAsset.Editor
|
|||
public BuildParametersContext(BuildParameters parameters)
|
||||
{
|
||||
Parameters = parameters;
|
||||
|
||||
PipelineOutputDirectory = AssetBundleBuilderHelper.MakePipelineOutputDirectory(parameters.OutputRoot, parameters.BuildTarget);
|
||||
if (parameters.DryRunBuild)
|
||||
PipelineOutputDirectory += "_DryRunBuild";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -30,6 +30,11 @@ namespace YooAsset.Editor
|
|||
/// </summary>
|
||||
public bool ForceRebuild = false;
|
||||
|
||||
/// <summary>
|
||||
/// 演练构建
|
||||
/// </summary>
|
||||
public bool DryRunBuild = false;
|
||||
|
||||
/// <summary>
|
||||
/// 内置标签
|
||||
/// </summary>
|
||||
|
|
|
@ -29,6 +29,7 @@ namespace YooAsset.Editor
|
|||
private PopupField<string> _encryptionField;
|
||||
private Toggle _appendExtensionToggle;
|
||||
private Toggle _forceRebuildToggle;
|
||||
private Toggle _dryRunBuildToggle;
|
||||
private TextField _buildTagsTxt;
|
||||
|
||||
|
||||
|
@ -73,6 +74,7 @@ namespace YooAsset.Editor
|
|||
_compressionField.Init(AssetBundleBuilderSettingData.Setting.CompressOption);
|
||||
_compressionField.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.CompressOption);
|
||||
_compressionField.style.width = 300;
|
||||
_compressionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
|
||||
_compressionField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSettingData.Setting.CompressOption = (ECompressOption)_compressionField.value;
|
||||
|
@ -94,6 +96,7 @@ namespace YooAsset.Editor
|
|||
_encryptionField = new PopupField<string>(_encryptionServicesClassNames, defaultIndex);
|
||||
_encryptionField.label = "Encryption";
|
||||
_encryptionField.style.width = 300;
|
||||
_encryptionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
|
||||
_encryptionField.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSettingData.Setting.EncyptionClassName = _encryptionField.value;
|
||||
|
@ -105,12 +108,14 @@ namespace YooAsset.Editor
|
|||
_encryptionField = new PopupField<string>();
|
||||
_encryptionField.label = "Encryption";
|
||||
_encryptionField.style.width = 300;
|
||||
_encryptionField.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
|
||||
encryptionContainer.Add(_encryptionField);
|
||||
}
|
||||
|
||||
// 附加后缀格式
|
||||
_appendExtensionToggle = root.Q<Toggle>("AppendExtension");
|
||||
_appendExtensionToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.AppendExtension);
|
||||
_appendExtensionToggle.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
|
||||
_appendExtensionToggle.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSettingData.Setting.AppendExtension = _appendExtensionToggle.value;
|
||||
|
@ -119,12 +124,25 @@ namespace YooAsset.Editor
|
|||
// 强制构建
|
||||
_forceRebuildToggle = root.Q<Toggle>("ForceRebuild");
|
||||
_forceRebuildToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.ForceRebuild);
|
||||
_forceRebuildToggle.SetEnabled(AssetBundleBuilderSettingData.Setting.DryRunBuild == false);
|
||||
_forceRebuildToggle.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSettingData.Setting.ForceRebuild = _forceRebuildToggle.value;
|
||||
_buildTagsTxt.SetEnabled(_forceRebuildToggle.value);
|
||||
});
|
||||
|
||||
// 演练构建
|
||||
_dryRunBuildToggle = root.Q<Toggle>("DryRunBuild");
|
||||
_dryRunBuildToggle.SetValueWithoutNotify(AssetBundleBuilderSettingData.Setting.DryRunBuild);
|
||||
_dryRunBuildToggle.RegisterValueChangedCallback(evt =>
|
||||
{
|
||||
AssetBundleBuilderSettingData.Setting.DryRunBuild = _dryRunBuildToggle.value;
|
||||
_compressionField.SetEnabled(_dryRunBuildToggle.value == false);
|
||||
_encryptionField.SetEnabled(_dryRunBuildToggle.value == false);
|
||||
_appendExtensionToggle.SetEnabled(_dryRunBuildToggle.value == false);
|
||||
_forceRebuildToggle.SetEnabled(_dryRunBuildToggle.value == false);
|
||||
});
|
||||
|
||||
// 内置标签
|
||||
_buildTagsTxt = root.Q<TextField>("BuildinTags");
|
||||
_buildTagsTxt.SetEnabled(_forceRebuildToggle.value);
|
||||
|
@ -188,6 +206,7 @@ namespace YooAsset.Editor
|
|||
buildParameters.AppendFileExtension = _appendExtensionToggle.value;
|
||||
buildParameters.EncryptionServices = CreateEncryptionServicesInstance();
|
||||
buildParameters.ForceRebuild = _forceRebuildToggle.value;
|
||||
buildParameters.DryRunBuild = _dryRunBuildToggle.value;
|
||||
buildParameters.BuildinTags = _buildTagsTxt.value;
|
||||
|
||||
AssetBundleBuilder builder = new AssetBundleBuilder();
|
||||
|
@ -198,7 +217,7 @@ namespace YooAsset.Editor
|
|||
/// 获取加密类的类型列表
|
||||
/// </summary>
|
||||
private List<Type> GetEncryptionServicesClassTypes()
|
||||
{
|
||||
{
|
||||
TypeCache.TypeCollection collection = TypeCache.GetTypesDerivedFrom<IEncryptionServices>();
|
||||
List<Type> classTypes = collection.ToList();
|
||||
return classTypes;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
<ui:VisualElement name="EncryptionContainer" style="height: 24px;" />
|
||||
<ui:Toggle label="Append Extension" name="AppendExtension" style="height: 15px;" />
|
||||
<ui:Toggle label="Force Rebuild" name="ForceRebuild" />
|
||||
<ui:Toggle label="Dry Run Build" name="DryRunBuild" />
|
||||
<ui:TextField picking-mode="Ignore" label="Buildin Tags" name="BuildinTags" />
|
||||
<ui:Button text="构建" display-tooltip-when-elided="true" name="Build" style="height: 50px; background-color: rgb(40, 106, 42); margin-top: 10px;" />
|
||||
</ui:VisualElement>
|
||||
|
|
|
@ -28,8 +28,9 @@ namespace YooAsset.Editor
|
|||
|
||||
// 拷贝Report文件
|
||||
{
|
||||
string sourcePath = $"{buildParameters.PipelineOutputDirectory}/{YooAssetSettings.ReportFileName}";
|
||||
string destPath = $"{packageDirectory}/{YooAssetSettings.ReportFileName}";
|
||||
string reportFileName = YooAssetSettingsData.GetReportFileName(buildParameters.Parameters.BuildVersion);
|
||||
string sourcePath = $"{buildParameters.PipelineOutputDirectory}/{reportFileName}";
|
||||
string destPath = $"{packageDirectory}/{reportFileName}";
|
||||
EditorTools.CopyFile(sourcePath, destPath, true);
|
||||
UnityEngine.Debug.Log($"拷贝构建报告文件到:{destPath}");
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
// 删除旧文件
|
||||
string filePath = $"{buildParameters.PipelineOutputDirectory}/{YooAssetSettings.ReportFileName}";
|
||||
string filePath = $"{buildParameters.PipelineOutputDirectory}/{YooAssetSettingsData.GetReportFileName(buildParameters.Parameters.BuildVersion)}";
|
||||
if (File.Exists(filePath))
|
||||
File.Delete(filePath);
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace YooAsset.Editor
|
|||
throw new Exception("输出目录不能为空");
|
||||
|
||||
// 增量更新时候的必要检测
|
||||
if (buildParameters.Parameters.ForceRebuild == false)
|
||||
if (buildParameters.Parameters.DryRunBuild == false && buildParameters.Parameters.ForceRebuild == false)
|
||||
{
|
||||
// 检测历史版本是否存在
|
||||
if (AssetBundleBuilderHelper.HasAnyPackageVersion(buildParameters.Parameters.BuildTarget, buildParameters.Parameters.OutputRoot) == false)
|
||||
|
@ -49,7 +49,7 @@ namespace YooAsset.Editor
|
|||
}
|
||||
|
||||
// 如果是强制重建
|
||||
if (buildParameters.Parameters.ForceRebuild)
|
||||
if (buildParameters.Parameters.DryRunBuild == false && buildParameters.Parameters.ForceRebuild)
|
||||
{
|
||||
// 删除平台总目录
|
||||
string platformDirectory = $"{buildParameters.Parameters.OutputRoot}/{buildParameters.Parameters.BuildTarget}";
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace YooAsset
|
|||
/// <summary>
|
||||
/// 构建输出的报告文件
|
||||
/// </summary>
|
||||
public const string ReportFileName = "BuildReport.json";
|
||||
public const string ReportFileName = "BuildReport";
|
||||
|
||||
/// <summary>
|
||||
/// 静态版本文件
|
||||
|
|
|
@ -32,6 +32,14 @@ namespace YooAsset
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取构建报告文件名
|
||||
/// </summary>
|
||||
public static string GetReportFileName(int resourceVersion)
|
||||
{
|
||||
return $"{YooAssetSettings.ReportFileName}_{resourceVersion}.json";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取补丁清单文件完整名称
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue