[change] 支持获得UWP、PS5等平台的裁剪后aot dll

main
walon 2023-09-10 13:37:12 +08:00
parent 1168d51e93
commit dc884d36b8
2 changed files with 26 additions and 16 deletions

View File

@ -12,7 +12,7 @@ using System.IO;
namespace HybridCLR.MonoHook namespace HybridCLR.MonoHook
{ {
#if UNITY_2021 && UNITY_IOS #if UNITY_2021_1_OR_NEWER
[InitializeOnLoad] [InitializeOnLoad]
public class CopyStrippedAOTAssembliesHook public class CopyStrippedAOTAssembliesHook
{ {

View File

@ -25,19 +25,25 @@ namespace HybridCLR.Editor.BuildProcessors
public static string GetStripAssembliesDir2021(BuildTarget target) public static string GetStripAssembliesDir2021(BuildTarget target)
{ {
string projectDir = SettingsUtil.ProjectDir; string projectDir = SettingsUtil.ProjectDir;
#if UNITY_STANDALONE_WIN switch (target)
return $"{projectDir}/Library/Bee/artifacts/WinPlayerBuildProgram/ManagedStripped"; {
#elif UNITY_ANDROID case BuildTarget.StandaloneWindows:
return $"{projectDir}/Library/Bee/artifacts/Android/ManagedStripped"; case BuildTarget.StandaloneWindows64:
#elif UNITY_IOS return $"{projectDir}/Library/Bee/artifacts/WinPlayerBuildProgram/ManagedStripped";
return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped"; case BuildTarget.Android:
#elif UNITY_WEBGL return $"{projectDir}/Library/Bee/artifacts/Android/ManagedStripped";
return $"{projectDir}/Library/Bee/artifacts/WebGL/ManagedStripped"; case BuildTarget.iOS:
#elif UNITY_EDITOR_OSX return $"{projectDir}/Library/Bee/artifacts/iOS/ManagedStripped";
return $"{projectDir}/Library/Bee/artifacts/MacStandalonePlayerBuildProgram/ManagedStripped"; case BuildTarget.WebGL:
#else return $"{projectDir}/Library/Bee/artifacts/WebGL/ManagedStripped";
throw new NotSupportedException("GetOriginBuildStripAssembliesDir"); case BuildTarget.StandaloneOSX:
#endif return $"{projectDir}/Library/Bee/artifacts/MacStandalonePlayerBuildProgram/ManagedStripped";
case BuildTarget.PS4:
return $"{projectDir}/Library/Bee/artifacts/PS4PlayerBuildProgram/ManagedStripped";
case BuildTarget.PS5:
return $"{projectDir}/Library/Bee/artifacts/PS5PlayerBuildProgram/ManagedStripped";
default: return "";
}
} }
#else #else
private string GetStripAssembliesDir2020(BuildTarget target) private string GetStripAssembliesDir2020(BuildTarget target)
@ -78,9 +84,13 @@ namespace HybridCLR.Editor.BuildProcessors
public void OnPostprocessBuild(BuildReport report) public void OnPostprocessBuild(BuildReport report)
{ {
#if (UNITY_2021 && !UNITY_IOS) || UNITY_2022_1_OR_NEWER #if UNITY_2021_1_OR_NEWER
BuildTarget target = EditorUserBuildSettings.activeBuildTarget; BuildTarget target = EditorUserBuildSettings.activeBuildTarget;
CopyStripDlls(GetStripAssembliesDir2021(target), target); string srcStripDllPath = GetStripAssembliesDir2021(target);
if (!string.IsNullOrEmpty(srcStripDllPath) && Directory.Exists(srcStripDllPath))
{
CopyStripDlls(srcStripDllPath, target);
}
#endif #endif
} }
} }