[fix] StripAOTDllCommand生成AOT dll时的BuildOption采用当前Player的设置,避免当打包开启development时, StripAOTDllCommand生成Release aot dll,而打包生成debug aot dll,产生补充元数据及桥接函数生成不匹配的严重错误
parent
1eaaf44c97
commit
1d50dfcb6e
|
@ -3,10 +3,12 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using static UnityEngine.Networking.UnityWebRequest;
|
||||
|
||||
namespace HybridCLR.Editor.Commands
|
||||
{
|
||||
|
@ -18,6 +20,37 @@ namespace HybridCLR.Editor.Commands
|
|||
GenerateStripedAOTDlls(EditorUserBuildSettings.activeBuildTarget);
|
||||
}
|
||||
|
||||
static BuildOptions GetBuildPlayerOptions(BuildTarget buildTarget)
|
||||
{
|
||||
BuildOptions options = BuildOptions.BuildScriptsOnly;
|
||||
bool development = EditorUserBuildSettings.development;
|
||||
if (development)
|
||||
{
|
||||
options |= BuildOptions.Development;
|
||||
}
|
||||
|
||||
if (EditorUserBuildSettings.allowDebugging && development)
|
||||
{
|
||||
options |= BuildOptions.AllowDebugging;
|
||||
}
|
||||
|
||||
if (EditorUserBuildSettings.connectProfiler && (development || buildTarget == BuildTarget.WSAPlayer))
|
||||
{
|
||||
options |= BuildOptions.ConnectWithProfiler;
|
||||
}
|
||||
|
||||
if (EditorUserBuildSettings.buildWithDeepProfilingSupport && development)
|
||||
{
|
||||
options |= BuildOptions.EnableDeepProfilingSupport;
|
||||
}
|
||||
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
options |= BuildOptions.CleanBuildCache;
|
||||
#endif
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
private static string GetLocationPathName(string buildDir, BuildTarget target)
|
||||
{
|
||||
switch(target)
|
||||
|
@ -37,7 +70,7 @@ namespace HybridCLR.Editor.Commands
|
|||
string outputPath = $"{SettingsUtil.HybridCLRDataDir}/StrippedAOTDllsTempProj/{target}";
|
||||
BashUtil.RemoveDir(outputPath);
|
||||
|
||||
var buildOptions = BuildOptions.BuildScriptsOnly;
|
||||
var buildOptions = GetBuildPlayerOptions(target);
|
||||
#if UNITY_2021_2_OR_NEWER
|
||||
buildOptions |= BuildOptions.CleanBuildCache;
|
||||
#endif
|
||||
|
@ -75,6 +108,8 @@ namespace HybridCLR.Editor.Commands
|
|||
}
|
||||
}
|
||||
|
||||
Debug.Log($"GenerateStripedAOTDlls build option:{buildOptions}");
|
||||
|
||||
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions()
|
||||
{
|
||||
scenes = EditorBuildSettings.scenes.Where(s => s.enabled).Select(s => s.path).ToArray(),
|
||||
|
|
Loading…
Reference in New Issue