[new] HybridCLRSettings 新增 preserveHotUpdateAssemblies字段,用于预留assembly

main
walon 2022-10-18 13:48:43 +08:00
parent 339b9f9fde
commit be4d220529
5 changed files with 34 additions and 4 deletions

View File

@ -89,7 +89,7 @@ namespace HybridCLR.Editor.BuildProcessors
{ {
var patcher = new ScriptingAssembliesJsonPatcher(); var patcher = new ScriptingAssembliesJsonPatcher();
patcher.Load(file); patcher.Load(file);
patcher.AddScriptingAssemblies(SettingsUtil.HotUpdateAssemblyFiles); patcher.AddScriptingAssemblies(SettingsUtil.PatchingHotUpdateAssemblyFiles);
patcher.Save(file); patcher.Save(file);
} }
} }
@ -120,7 +120,7 @@ namespace HybridCLR.Editor.BuildProcessors
{ {
var binFile = new UnityBinFile(); var binFile = new UnityBinFile();
binFile.Load(binPath); binFile.Load(binPath);
binFile.AddScriptingAssemblies(SettingsUtil.HotUpdateAssemblyFiles); binFile.AddScriptingAssemblies(SettingsUtil.PatchingHotUpdateAssemblyFiles);
binFile.Save(binPath); binFile.Save(binPath);
Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}"); Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}");
} }
@ -139,7 +139,7 @@ namespace HybridCLR.Editor.BuildProcessors
foreach (string binPath in binFiles) foreach (string binPath in binFiles)
{ {
var patcher = new Dataunity3dPatcher(); var patcher = new Dataunity3dPatcher();
patcher.ApplyPatch(binPath, SettingsUtil.HotUpdateAssemblyFiles); patcher.ApplyPatch(binPath, SettingsUtil.PatchingHotUpdateAssemblyFiles);
Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}"); Debug.Log($"[PatchScriptingAssemblyList] patch {binPath}");
} }
return true; return true;

View File

@ -14,6 +14,7 @@ namespace HybridCLR.Editor
private SerializedProperty m_CloneFromGitee; private SerializedProperty m_CloneFromGitee;
private SerializedProperty m_HotUpdateAssemblyDefinitions; private SerializedProperty m_HotUpdateAssemblyDefinitions;
private SerializedProperty m_HotUpdateAssemblies; private SerializedProperty m_HotUpdateAssemblies;
private SerializedProperty m_preserveHotUpdateAssemblies;
private SerializedProperty m_collectAssetReferenceTypes; private SerializedProperty m_collectAssetReferenceTypes;
private SerializedProperty m_OutputLinkFile; private SerializedProperty m_OutputLinkFile;
private SerializedProperty m_OutputAOTGenericReferenceFile; private SerializedProperty m_OutputAOTGenericReferenceFile;
@ -32,6 +33,7 @@ namespace HybridCLR.Editor
m_CloneFromGitee = m_SerializedObject.FindProperty("cloneFromGitee"); m_CloneFromGitee = m_SerializedObject.FindProperty("cloneFromGitee");
m_HotUpdateAssemblyDefinitions = m_SerializedObject.FindProperty("hotUpdateAssemblyDefinitions"); m_HotUpdateAssemblyDefinitions = m_SerializedObject.FindProperty("hotUpdateAssemblyDefinitions");
m_HotUpdateAssemblies = m_SerializedObject.FindProperty("hotUpdateAssemblies"); m_HotUpdateAssemblies = m_SerializedObject.FindProperty("hotUpdateAssemblies");
m_preserveHotUpdateAssemblies = m_SerializedObject.FindProperty("preserveHotUpdateAssemblies");
m_collectAssetReferenceTypes = m_SerializedObject.FindProperty("collectAssetReferenceTypes"); m_collectAssetReferenceTypes = m_SerializedObject.FindProperty("collectAssetReferenceTypes");
m_OutputLinkFile = m_SerializedObject.FindProperty("outputLinkFile"); m_OutputLinkFile = m_SerializedObject.FindProperty("outputLinkFile");
m_OutputAOTGenericReferenceFile = m_SerializedObject.FindProperty("outputAOTGenericReferenceFile"); m_OutputAOTGenericReferenceFile = m_SerializedObject.FindProperty("outputAOTGenericReferenceFile");
@ -104,6 +106,7 @@ namespace HybridCLR.Editor
EditorGUILayout.PropertyField(m_UseGlobalIl2cpp); EditorGUILayout.PropertyField(m_UseGlobalIl2cpp);
EditorGUILayout.PropertyField(m_HotUpdateAssemblyDefinitions); EditorGUILayout.PropertyField(m_HotUpdateAssemblyDefinitions);
EditorGUILayout.PropertyField(m_HotUpdateAssemblies); EditorGUILayout.PropertyField(m_HotUpdateAssemblies);
EditorGUILayout.PropertyField(m_preserveHotUpdateAssemblies);
EditorGUILayout.PropertyField(m_collectAssetReferenceTypes); EditorGUILayout.PropertyField(m_collectAssetReferenceTypes);
EditorGUILayout.PropertyField(m_OutputLinkFile); EditorGUILayout.PropertyField(m_OutputLinkFile);
EditorGUILayout.PropertyField(m_OutputAOTGenericReferenceFile); EditorGUILayout.PropertyField(m_OutputAOTGenericReferenceFile);

View File

@ -20,6 +20,9 @@ namespace HybridCLR.Editor
[Header("热更新dlls")] [Header("热更新dlls")]
public string[] hotUpdateAssemblies; public string[] hotUpdateAssemblies;
[Header("预留的热更新dlls")]
public string[] preserveHotUpdateAssemblies;
[Header("生成link.xml时扫描asset中引用的类型")] [Header("生成link.xml时扫描asset中引用的类型")]
public bool collectAssetReferenceTypes; public bool collectAssetReferenceTypes;

View File

@ -75,8 +75,32 @@ namespace HybridCLR.Editor
return hotfixAssembles.ToList(); return hotfixAssembles.ToList();
} }
} }
public static List<string> HotUpdateAssemblyFiles => HotUpdateAssemblyNames.Select(dll => dll + ".dll").ToList(); public static List<string> HotUpdateAssemblyFiles => HotUpdateAssemblyNames.Select(dll => dll + ".dll").ToList();
public static List<string> PatchingHotUpdateAssemblyFiles
{
get
{
List<string> patchingList = HotUpdateAssemblyFiles;
string[] preserveAssemblyNames = HybridCLRSettings.Instance.preserveHotUpdateAssemblies;
if (preserveAssemblyNames != null && preserveAssemblyNames.Length > 0)
{
foreach(var assemblyName in preserveAssemblyNames)
{
string dllFileName = assemblyName + ".dll";
if (patchingList.Contains(dllFileName))
{
throw new Exception($"[PatchingHotUpdateAssemblyFiles] assembly:'{assemblyName}' 重复");
}
patchingList.Add(dllFileName);
}
}
return patchingList;
}
}
public static HybridCLRSettings HybridCLRSettings => HybridCLRSettings.Instance; public static HybridCLRSettings HybridCLRSettings => HybridCLRSettings.Instance;
} }
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "com.focus-creative-games.hybridclr_unity", "name": "com.focus-creative-games.hybridclr_unity",
"version": "0.5.2", "version": "0.6.0",
"displayName": "HybridCLR", "displayName": "HybridCLR",
"description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR", "description": "Unity package for HybridCLR. It includes editor and runtime scripts and assets for HybridCLR",
"category": "Runtime", "category": "Runtime",