[new] 新增对团结引擎 HMIAndroid、OpenHarmony、WeixinMiniGame平台的支持
parent
ef103d8351
commit
2b42376505
|
@ -12,7 +12,7 @@ using System.IO;
|
||||||
|
|
||||||
namespace HybridCLR.MonoHook
|
namespace HybridCLR.MonoHook
|
||||||
{
|
{
|
||||||
#if UNITY_2021_1_OR_NEWER && UNITY_WEBGL
|
#if (UNITY_2021_1_OR_NEWER && UNITY_WEBGL) || TUANJIE_2022
|
||||||
[InitializeOnLoad]
|
[InitializeOnLoad]
|
||||||
public class PatchScriptingAssembliesJsonHook
|
public class PatchScriptingAssembliesJsonHook
|
||||||
{
|
{
|
||||||
|
@ -36,6 +36,12 @@ namespace HybridCLR.MonoHook
|
||||||
private static string BuildMainWindowTitle()
|
private static string BuildMainWindowTitle()
|
||||||
{
|
{
|
||||||
string tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WebGL/Data/ScriptingAssemblies.json";
|
string tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WebGL/Data/ScriptingAssemblies.json";
|
||||||
|
#if TUANJIE_2022
|
||||||
|
if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.WeixinMiniGame)
|
||||||
|
{
|
||||||
|
tempJsonPath = $"{Application.dataPath}/../Library/PlayerDataCache/WeixinMiniGame/Data/ScriptingAssemblies.json";
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (File.Exists(tempJsonPath))
|
if (File.Exists(tempJsonPath))
|
||||||
{
|
{
|
||||||
var patcher = new PatchScriptingAssemblyList();
|
var patcher = new PatchScriptingAssemblyList();
|
||||||
|
|
|
@ -17,6 +17,8 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||||
public class PatchScriptingAssemblyList :
|
public class PatchScriptingAssemblyList :
|
||||||
#if UNITY_ANDROID
|
#if UNITY_ANDROID
|
||||||
IPostGenerateGradleAndroidProject,
|
IPostGenerateGradleAndroidProject,
|
||||||
|
#elif UNITY_OPENHARMONY
|
||||||
|
UnityEditor.OpenHarmony.IPostGenerateOpenHarmonyProject,
|
||||||
#endif
|
#endif
|
||||||
IPostprocessBuildWithReport
|
IPostprocessBuildWithReport
|
||||||
#if !UNITY_2021_1_OR_NEWER && UNITY_WEBGL
|
#if !UNITY_2021_1_OR_NEWER && UNITY_WEBGL
|
||||||
|
@ -45,11 +47,20 @@ namespace HybridCLR.Editor.BuildProcessors
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_OPENHARMONY
|
||||||
|
|
||||||
|
public void OnPostGenerateOpenHarmonyProject(string path)
|
||||||
|
{
|
||||||
|
OnPostGenerateGradleAndroidProject(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
public void OnPostprocessBuild(BuildReport report)
|
public void OnPostprocessBuild(BuildReport report)
|
||||||
{
|
{
|
||||||
// 如果target为Android,由于已经在OnPostGenerateGradelAndroidProject中处理过,
|
// 如果target为Android,由于已经在OnPostGenerateGradelAndroidProject中处理过,
|
||||||
// 这里不再重复处理
|
// 这里不再重复处理
|
||||||
#if !UNITY_ANDROID && !UNITY_WEBGL
|
#if !UNITY_ANDROID && !UNITY_WEBGL && !UNITY_OPENHARMONY
|
||||||
PathScriptingAssembilesFile(report.summary.outputPath);
|
PathScriptingAssembilesFile(report.summary.outputPath);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,9 @@ namespace HybridCLR.Editor.Commands
|
||||||
bool oldCreateSolution = UnityEditor.OSXStandalone.UserBuildSettings.createXcodeProject;
|
bool oldCreateSolution = UnityEditor.OSXStandalone.UserBuildSettings.createXcodeProject;
|
||||||
#elif UNITY_EDITOR_WIN
|
#elif UNITY_EDITOR_WIN
|
||||||
bool oldCreateSolution = UnityEditor.WindowsStandalone.UserBuildSettings.createSolution;
|
bool oldCreateSolution = UnityEditor.WindowsStandalone.UserBuildSettings.createSolution;
|
||||||
|
#endif
|
||||||
|
#if TUANJIE_2022
|
||||||
|
bool oldOpenHarmonyProj = EditorUserBuildSettings.exportAsOpenHarmonyProject;
|
||||||
#endif
|
#endif
|
||||||
bool oldBuildScriptsOnly = EditorUserBuildSettings.buildScriptsOnly;
|
bool oldBuildScriptsOnly = EditorUserBuildSettings.buildScriptsOnly;
|
||||||
EditorUserBuildSettings.buildScriptsOnly = true;
|
EditorUserBuildSettings.buildScriptsOnly = true;
|
||||||
|
@ -105,11 +108,21 @@ namespace HybridCLR.Editor.Commands
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if TUANJIE_2022
|
||||||
|
case BuildTarget.HMIAndroid:
|
||||||
|
#endif
|
||||||
case BuildTarget.Android:
|
case BuildTarget.Android:
|
||||||
{
|
{
|
||||||
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if TUANJIE_2022
|
||||||
|
case BuildTarget.OpenHarmony:
|
||||||
|
{
|
||||||
|
EditorUserBuildSettings.exportAsOpenHarmonyProject = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Log($"GenerateStripedAOTDlls build option:{buildOptions}");
|
Debug.Log($"GenerateStripedAOTDlls build option:{buildOptions}");
|
||||||
|
@ -145,11 +158,21 @@ namespace HybridCLR.Editor.Commands
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if TUANJIE_2022
|
||||||
|
case BuildTarget.HMIAndroid:
|
||||||
|
#endif
|
||||||
case BuildTarget.Android:
|
case BuildTarget.Android:
|
||||||
{
|
{
|
||||||
EditorUserBuildSettings.exportAsGoogleAndroidProject = oldExportAndroidProj;
|
EditorUserBuildSettings.exportAsGoogleAndroidProject = oldExportAndroidProj;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if TUANJIE_2022
|
||||||
|
case BuildTarget.OpenHarmony:
|
||||||
|
{
|
||||||
|
EditorUserBuildSettings.exportAsOpenHarmonyProject = oldOpenHarmonyProj;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
if (report.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
|
||||||
|
|
Loading…
Reference in New Issue