|
@@ -11,10 +11,19 @@ namespace ET
|
|
|
{
|
|
|
public static class BuildAssembliesHelper
|
|
|
{
|
|
|
- public const string CodeDir = "Assets/Bundles/Code/";
|
|
|
+ public const string CodeDir = "Assets/Res/CodeDll/";
|
|
|
|
|
|
public static void BuildModel(CodeOptimization codeOptimization, GlobalConfig globalConfig)
|
|
|
{
|
|
|
+ string[] logicFiles = Directory.GetFiles(Define.BuildOutputDir, "Model_*");
|
|
|
+ foreach (string file in logicFiles)
|
|
|
+ {
|
|
|
+ File.Delete(file);
|
|
|
+ }
|
|
|
+
|
|
|
+ int random = RandomGenerator.RandomNumber(100000000, 999999999);
|
|
|
+ string logicFile = $"Model_{random}";
|
|
|
+
|
|
|
List<string> codes;
|
|
|
|
|
|
switch (globalConfig.CodeMode)
|
|
@@ -48,14 +57,14 @@ namespace ET
|
|
|
};
|
|
|
break;
|
|
|
default:
|
|
|
- throw new Exception("not found enum");
|
|
|
+ throw new Exception("unknow 'CodeMode'");
|
|
|
}
|
|
|
|
|
|
- BuildAssembliesHelper.BuildMuteAssembly("Model", codes, Array.Empty<string>(), codeOptimization, globalConfig.CodeMode);
|
|
|
+ BuildMuteAssembly(logicFile, codes, Array.Empty<string>(), codeOptimization, globalConfig.CodeMode);
|
|
|
|
|
|
- File.Copy(Path.Combine(Define.BuildOutputDir, $"Model.dll"), Path.Combine(CodeDir, $"Model.dll.bytes"), true);
|
|
|
- File.Copy(Path.Combine(Define.BuildOutputDir, $"Model.pdb"), Path.Combine(CodeDir, $"Model.pdb.bytes"), true);
|
|
|
- Debug.Log("copy Model.dll to Bundles/Code success!");
|
|
|
+ File.Copy(Path.Combine(Define.BuildOutputDir, $"{logicFile}.dll"), Path.Combine(CodeDir, $"Model.dll.bytes"), true);
|
|
|
+ File.Copy(Path.Combine(Define.BuildOutputDir, $"{logicFile}.pdb"), Path.Combine(CodeDir, $"Model.pdb.bytes"), true);
|
|
|
+ Debug.Log("copy Model.dll to Assets/Res/CodeDll success!");
|
|
|
}
|
|
|
|
|
|
public static void BuildHotfix(CodeOptimization codeOptimization, GlobalConfig globalConfig)
|
|
@@ -65,6 +74,16 @@ namespace ET
|
|
|
{
|
|
|
File.Delete(file);
|
|
|
}
|
|
|
+ string modelfile;
|
|
|
+ string[] modelFiles = Directory.GetFiles(Define.BuildOutputDir, "Model_*.dll");
|
|
|
+ if (modelFiles.Length > 0)
|
|
|
+ {
|
|
|
+ modelfile = modelFiles[0];
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ throw new Exception($"Not Found model_xx.dll @{Define.BuildOutputDir}");
|
|
|
+ }
|
|
|
|
|
|
int random = RandomGenerator.RandomNumber(100000000, 999999999);
|
|
|
string logicFile = $"Hotfix_{random}";
|
|
@@ -83,7 +102,9 @@ namespace ET
|
|
|
case CodeMode.Server:
|
|
|
codes = new List<string>()
|
|
|
{
|
|
|
- "Assets/Scripts/Codes/Hotfix/Share/", "Assets/Scripts/Codes/Hotfix/Server/", "Assets/Scripts/Codes/Hotfix/Client/",
|
|
|
+ "Assets/Scripts/Codes/Hotfix/Share/",
|
|
|
+ "Assets/Scripts/Codes/Hotfix/Server/",
|
|
|
+ "Assets/Scripts/Codes/Hotfix/Client/",
|
|
|
};
|
|
|
break;
|
|
|
case CodeMode.ClientServer:
|
|
@@ -96,15 +117,14 @@ namespace ET
|
|
|
};
|
|
|
break;
|
|
|
default:
|
|
|
- throw new Exception("not found enum");
|
|
|
+ throw new Exception("unknow 'CodeMode'");
|
|
|
}
|
|
|
|
|
|
- BuildAssembliesHelper.BuildMuteAssembly(logicFile, codes, new[] { Path.Combine(Define.BuildOutputDir, "Model.dll") }, codeOptimization,
|
|
|
- globalConfig.CodeMode);
|
|
|
+ BuildMuteAssembly(logicFile, codes, new[] { modelfile }, codeOptimization, globalConfig.CodeMode);
|
|
|
|
|
|
File.Copy(Path.Combine(Define.BuildOutputDir, $"{logicFile}.dll"), Path.Combine(CodeDir, $"Hotfix.dll.bytes"), true);
|
|
|
File.Copy(Path.Combine(Define.BuildOutputDir, $"{logicFile}.pdb"), Path.Combine(CodeDir, $"Hotfix.pdb.bytes"), true);
|
|
|
- Debug.Log("copy Hotfix.dll to Bundles/Code success!");
|
|
|
+ Debug.Log("copy Hotfix.dll to Assets/Res/CodeDll success!");
|
|
|
}
|
|
|
|
|
|
private static void BuildMuteAssembly(
|
|
@@ -185,6 +205,13 @@ namespace ET
|
|
|
if (warningCount > 0)
|
|
|
{
|
|
|
Debug.LogFormat("有{0}个Warning!!!", warningCount);
|
|
|
+ for (int i = 0; i < compilerMessages.Length; i++)
|
|
|
+ {
|
|
|
+ if (compilerMessages[i].type == CompilerMessageType.Warning)
|
|
|
+ {
|
|
|
+ Debug.LogWarning(compilerMessages[i].message);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (errorCount > 0)
|