update editor code
1. BuildParameters.OutputRoot重命名为BuildOutputRoot 2. 新增了BuildParameters.StreamingAssetsRoot字段mlyDevMerge1.5.7
parent
92246f1043
commit
efbf1304ed
|
@ -25,19 +25,6 @@ namespace YooAsset.Editor
|
||||||
if (buildPipeline.Count == 0)
|
if (buildPipeline.Count == 0)
|
||||||
throw new Exception($"Build pipeline is empty !");
|
throw new Exception($"Build pipeline is empty !");
|
||||||
|
|
||||||
// 检测可编程构建管线参数
|
|
||||||
if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
|
|
||||||
{
|
|
||||||
if (buildParameters.SBPParameters == null)
|
|
||||||
throw new Exception($"{nameof(BuildParameters.SBPParameters)} is null !");
|
|
||||||
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
|
|
||||||
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
|
|
||||||
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
|
||||||
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
|
|
||||||
}
|
|
||||||
|
|
||||||
// 清空旧数据
|
// 清空旧数据
|
||||||
_buildContext.ClearAllContext();
|
_buildContext.ClearAllContext();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取默认的输出根路录
|
/// 获取默认的输出根路录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetDefaultOutputRoot()
|
public static string GetDefaultBuildOutputRoot()
|
||||||
{
|
{
|
||||||
string projectPath = EditorTools.GetProjectPath();
|
string projectPath = EditorTools.GetProjectPath();
|
||||||
return $"{projectPath}/Bundles";
|
return $"{projectPath}/Bundles";
|
||||||
|
@ -20,43 +20,9 @@ namespace YooAsset.Editor
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取流文件夹路径
|
/// 获取流文件夹路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string GetStreamingAssetsFolderPath()
|
public static string GetDefaultStreamingAssetsRoot()
|
||||||
{
|
{
|
||||||
return $"{Application.dataPath}/StreamingAssets/{YooAssetSettings.StreamingAssetsBuildinFolder}/";
|
return $"{Application.dataPath}/StreamingAssets/{YooAssetSettings.DefaultYooFolderName}/";
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 清空流文件夹
|
|
||||||
/// </summary>
|
|
||||||
public static void ClearStreamingAssetsFolder()
|
|
||||||
{
|
|
||||||
string streamingFolderPath = GetStreamingAssetsFolderPath();
|
|
||||||
EditorTools.ClearFolder(streamingFolderPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除流文件夹内无关的文件
|
|
||||||
/// 删除.manifest文件和.meta文件
|
|
||||||
/// </summary>
|
|
||||||
public static void DeleteStreamingAssetsIgnoreFiles()
|
|
||||||
{
|
|
||||||
string streamingFolderPath = GetStreamingAssetsFolderPath();
|
|
||||||
if (Directory.Exists(streamingFolderPath))
|
|
||||||
{
|
|
||||||
string[] files = Directory.GetFiles(streamingFolderPath, "*.manifest", SearchOption.AllDirectories);
|
|
||||||
foreach (var file in files)
|
|
||||||
{
|
|
||||||
FileInfo info = new FileInfo(file);
|
|
||||||
info.Delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
files = Directory.GetFiles(streamingFolderPath, "*.meta", SearchOption.AllDirectories);
|
|
||||||
foreach (var item in files)
|
|
||||||
{
|
|
||||||
FileInfo info = new FileInfo(item);
|
|
||||||
info.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -63,7 +63,7 @@ namespace YooAsset.Editor
|
||||||
_encryptionServicesClassNames = _encryptionServicesClassTypes.Select(t => t.Name).ToList();
|
_encryptionServicesClassNames = _encryptionServicesClassTypes.Select(t => t.Name).ToList();
|
||||||
|
|
||||||
// 输出目录
|
// 输出目录
|
||||||
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
_buildOutputField = root.Q<TextField>("BuildOutput");
|
_buildOutputField = root.Q<TextField>("BuildOutput");
|
||||||
_buildOutputField.SetValueWithoutNotify(defaultOutputRoot);
|
_buildOutputField.SetValueWithoutNotify(defaultOutputRoot);
|
||||||
_buildOutputField.SetEnabled(false);
|
_buildOutputField.SetEnabled(false);
|
||||||
|
@ -266,9 +266,9 @@ namespace YooAsset.Editor
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void ExecuteBuild()
|
private void ExecuteBuild()
|
||||||
{
|
{
|
||||||
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
|
||||||
BuildParameters buildParameters = new BuildParameters();
|
BuildParameters buildParameters = new BuildParameters();
|
||||||
buildParameters.OutputRoot = defaultOutputRoot;
|
buildParameters.StreamingAssetsRoot = AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot();
|
||||||
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildTarget = _buildTarget;
|
buildParameters.BuildTarget = _buildTarget;
|
||||||
buildParameters.BuildPipeline = AssetBundleBuilderSettingData.Setting.BuildPipeline;
|
buildParameters.BuildPipeline = AssetBundleBuilderSettingData.Setting.BuildPipeline;
|
||||||
buildParameters.BuildMode = AssetBundleBuilderSettingData.Setting.BuildMode;
|
buildParameters.BuildMode = AssetBundleBuilderSettingData.Setting.BuildMode;
|
||||||
|
|
|
@ -11,9 +11,9 @@ namespace YooAsset.Editor
|
||||||
public static string SimulateBuild(string packageName)
|
public static string SimulateBuild(string packageName)
|
||||||
{
|
{
|
||||||
Debug.Log($"Begin to create simulate package : {packageName}");
|
Debug.Log($"Begin to create simulate package : {packageName}");
|
||||||
string defaultOutputRoot = AssetBundleBuilderHelper.GetDefaultOutputRoot();
|
|
||||||
BuildParameters buildParameters = new BuildParameters();
|
BuildParameters buildParameters = new BuildParameters();
|
||||||
buildParameters.OutputRoot = defaultOutputRoot;
|
buildParameters.StreamingAssetsRoot = AssetBundleBuilderHelper.GetDefaultStreamingAssetsRoot();
|
||||||
|
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
|
||||||
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
|
||||||
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
buildParameters.BuildMode = EBuildMode.SimulateBuild;
|
||||||
buildParameters.PackageName = packageName;
|
buildParameters.PackageName = packageName;
|
||||||
|
|
|
@ -37,9 +37,14 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输出的根目录
|
/// 内置资源的根目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string OutputRoot;
|
public string StreamingAssetsRoot;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 构建输出的根目录
|
||||||
|
/// </summary>
|
||||||
|
public string BuildOutputRoot;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建的平台
|
/// 构建的平台
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
private string _pipelineOutputDirectory = string.Empty;
|
private string _pipelineOutputDirectory = string.Empty;
|
||||||
private string _packageOutputDirectory = string.Empty;
|
private string _packageOutputDirectory = string.Empty;
|
||||||
|
private string _packageRootDirectory = string.Empty;
|
||||||
|
private string _streamingAssetsDirectory = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 构建参数
|
/// 构建参数
|
||||||
|
@ -29,23 +31,47 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_pipelineOutputDirectory))
|
if (string.IsNullOrEmpty(_pipelineOutputDirectory))
|
||||||
{
|
{
|
||||||
_pipelineOutputDirectory = $"{Parameters.OutputRoot}/{Parameters.BuildTarget}/{Parameters.PackageName}/{YooAssetSettings.OutputFolderName}";
|
_pipelineOutputDirectory = $"{Parameters.BuildOutputRoot}/{Parameters.BuildTarget}/{Parameters.PackageName}/{YooAssetSettings.OutputFolderName}";
|
||||||
}
|
}
|
||||||
return _pipelineOutputDirectory;
|
return _pipelineOutputDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取本次构建的补丁目录
|
/// 获取本次构建的补丁输出目录
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string GetPackageOutputDirectory()
|
public string GetPackageOutputDirectory()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(_packageOutputDirectory))
|
if (string.IsNullOrEmpty(_packageOutputDirectory))
|
||||||
{
|
{
|
||||||
_packageOutputDirectory = $"{Parameters.OutputRoot}/{Parameters.BuildTarget}/{Parameters.PackageName}/{Parameters.PackageVersion}";
|
_packageOutputDirectory = $"{Parameters.BuildOutputRoot}/{Parameters.BuildTarget}/{Parameters.PackageName}/{Parameters.PackageVersion}";
|
||||||
}
|
}
|
||||||
return _packageOutputDirectory;
|
return _packageOutputDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取本次构建的补丁根目录
|
||||||
|
/// </summary>
|
||||||
|
public string GetPackageRootDirectory()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_packageRootDirectory))
|
||||||
|
{
|
||||||
|
_packageRootDirectory = $"{Parameters.BuildOutputRoot}/{Parameters.BuildTarget}/{Parameters.PackageName}";
|
||||||
|
}
|
||||||
|
return _packageRootDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取内置资源的目录
|
||||||
|
/// </summary>
|
||||||
|
public string GetStreamingAssetsDirectory()
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(_streamingAssetsDirectory))
|
||||||
|
{
|
||||||
|
_streamingAssetsDirectory = $"{Parameters.StreamingAssetsRoot}/{Parameters.PackageName}";
|
||||||
|
}
|
||||||
|
return _streamingAssetsDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取内置构建管线的构建选项
|
/// 获取内置构建管线的构建选项
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace YooAsset.Editor
|
||||||
{
|
{
|
||||||
ECopyBuildinFileOption option = buildParametersContext.Parameters.CopyBuildinFileOption;
|
ECopyBuildinFileOption option = buildParametersContext.Parameters.CopyBuildinFileOption;
|
||||||
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
string packageOutputDirectory = buildParametersContext.GetPackageOutputDirectory();
|
||||||
string streamingAssetsDirectory = AssetBundleBuilderHelper.GetStreamingAssetsFolderPath();
|
string streamingAssetsDirectory = buildParametersContext.GetStreamingAssetsDirectory();
|
||||||
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
string buildPackageName = buildParametersContext.Parameters.PackageName;
|
||||||
string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
|
string buildPackageVersion = buildParametersContext.Parameters.PackageVersion;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ namespace YooAsset.Editor
|
||||||
// 清空流目录
|
// 清空流目录
|
||||||
if (option == ECopyBuildinFileOption.ClearAndCopyAll || option == ECopyBuildinFileOption.ClearAndCopyByTags)
|
if (option == ECopyBuildinFileOption.ClearAndCopyAll || option == ECopyBuildinFileOption.ClearAndCopyByTags)
|
||||||
{
|
{
|
||||||
AssetBundleBuilderHelper.ClearStreamingAssetsFolder();
|
EditorTools.ClearFolder(streamingAssetsDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拷贝补丁清单文件
|
// 拷贝补丁清单文件
|
||||||
|
|
|
@ -147,17 +147,17 @@ namespace YooAsset.Editor
|
||||||
private void RemoveZeroReferenceAssets(List<CollectAssetInfo> allCollectAssetInfos)
|
private void RemoveZeroReferenceAssets(List<CollectAssetInfo> allCollectAssetInfos)
|
||||||
{
|
{
|
||||||
// 1. 检测是否任何存在依赖资源
|
// 1. 检测是否任何存在依赖资源
|
||||||
bool hasAnyDependAsset = false;
|
bool hasAnyDependCollector = false;
|
||||||
foreach (var collectAssetInfo in allCollectAssetInfos)
|
foreach (var collectAssetInfo in allCollectAssetInfos)
|
||||||
{
|
{
|
||||||
var collectorType = collectAssetInfo.CollectorType;
|
var collectorType = collectAssetInfo.CollectorType;
|
||||||
if (collectorType == ECollectorType.DependAssetCollector)
|
if (collectorType == ECollectorType.DependAssetCollector)
|
||||||
{
|
{
|
||||||
hasAnyDependAsset = true;
|
hasAnyDependCollector = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (hasAnyDependAsset == false)
|
if (hasAnyDependCollector == false)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// 2. 获取所有主资源的依赖资源集合
|
// 2. 获取所有主资源的依赖资源集合
|
||||||
|
|
|
@ -16,11 +16,27 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
// 检测构建参数合法性
|
// 检测构建参数合法性
|
||||||
if (buildParameters.BuildTarget == BuildTarget.NoTarget)
|
if (buildParameters.BuildTarget == BuildTarget.NoTarget)
|
||||||
throw new Exception("请选择目标平台");
|
throw new Exception("请选择目标平台!");
|
||||||
if (string.IsNullOrEmpty(buildParameters.PackageName))
|
if (string.IsNullOrEmpty(buildParameters.PackageName))
|
||||||
throw new Exception("包裹名称不能为空");
|
throw new Exception("包裹名称不能为空!");
|
||||||
if (string.IsNullOrEmpty(buildParameters.PackageVersion))
|
if (string.IsNullOrEmpty(buildParameters.PackageVersion))
|
||||||
throw new Exception("包裹版本不能为空");
|
throw new Exception("包裹版本不能为空!");
|
||||||
|
if (string.IsNullOrEmpty(buildParameters.BuildOutputRoot))
|
||||||
|
throw new Exception("构建输出的根目录为空!");
|
||||||
|
if (string.IsNullOrEmpty(buildParameters.StreamingAssetsRoot))
|
||||||
|
throw new Exception("内置资源根目录为空!");
|
||||||
|
|
||||||
|
if (buildParameters.BuildPipeline == EBuildPipeline.ScriptableBuildPipeline)
|
||||||
|
{
|
||||||
|
if (buildParameters.SBPParameters == null)
|
||||||
|
throw new Exception($"{nameof(BuildParameters.SBPParameters)} is null !");
|
||||||
|
|
||||||
|
if (buildParameters.BuildMode == EBuildMode.DryRunBuild)
|
||||||
|
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.DryRunBuild)} build mode !");
|
||||||
|
|
||||||
|
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
||||||
|
throw new Exception($"{nameof(EBuildPipeline.ScriptableBuildPipeline)} not support {nameof(EBuildMode.ForceRebuild)} build mode !");
|
||||||
|
}
|
||||||
|
|
||||||
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
|
if (buildParameters.BuildMode != EBuildMode.SimulateBuild)
|
||||||
{
|
{
|
||||||
|
@ -72,11 +88,10 @@ namespace YooAsset.Editor
|
||||||
|
|
||||||
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
if (buildParameters.BuildMode == EBuildMode.ForceRebuild)
|
||||||
{
|
{
|
||||||
// 删除总目录
|
string packageRootDirectory = buildParametersContext.GetPackageRootDirectory();
|
||||||
string platformDirectory = $"{buildParameters.OutputRoot}/{buildParameters.BuildTarget}/{buildParameters.PackageName}";
|
if (EditorTools.DeleteDirectory(packageRootDirectory))
|
||||||
if (EditorTools.DeleteDirectory(platformDirectory))
|
|
||||||
{
|
{
|
||||||
BuildLogger.Log($"删除平台总目录:{platformDirectory}");
|
BuildLogger.Log($"删除包裹目录:{packageRootDirectory}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue