[new] 新增菜单命令`HybridCLR/CompileDll/ActiveBuildTarget_Development`,用于编译出DevelopmentBuild模式的热更新dll

main
walon 2023-06-01 11:43:41 +08:00
parent 97f083f07d
commit 49873ba6ed
1 changed files with 13 additions and 3 deletions

View File

@ -12,13 +12,17 @@ namespace HybridCLR.Editor.Commands
{ {
public class CompileDllCommand public class CompileDllCommand
{ {
public static void CompileDll(string buildDir, BuildTarget target) public static void CompileDll(string buildDir, BuildTarget target, bool developmentBuild)
{ {
var group = BuildPipeline.GetBuildTargetGroup(target); var group = BuildPipeline.GetBuildTargetGroup(target);
ScriptCompilationSettings scriptCompilationSettings = new ScriptCompilationSettings(); ScriptCompilationSettings scriptCompilationSettings = new ScriptCompilationSettings();
scriptCompilationSettings.group = group; scriptCompilationSettings.group = group;
scriptCompilationSettings.target = target; scriptCompilationSettings.target = target;
if (developmentBuild)
{
scriptCompilationSettings.options |= ScriptCompilationOptions.DevelopmentBuild;
}
Directory.CreateDirectory(buildDir); Directory.CreateDirectory(buildDir);
ScriptCompilationResult scriptCompilationResult = PlayerBuildInterface.CompilePlayerScripts(scriptCompilationSettings, buildDir); ScriptCompilationResult scriptCompilationResult = PlayerBuildInterface.CompilePlayerScripts(scriptCompilationSettings, buildDir);
foreach (var ass in scriptCompilationResult.assemblies) foreach (var ass in scriptCompilationResult.assemblies)
@ -28,9 +32,9 @@ namespace HybridCLR.Editor.Commands
Debug.Log("compile finish!!!"); Debug.Log("compile finish!!!");
} }
public static void CompileDll(BuildTarget target) public static void CompileDll(BuildTarget target, bool developmentBuild = false)
{ {
CompileDll(SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target), target); CompileDll(SettingsUtil.GetHotUpdateDllsOutputDirByTarget(target), target, developmentBuild);
} }
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget", priority = 100)] [MenuItem("HybridCLR/CompileDll/ActiveBuildTarget", priority = 100)]
@ -39,6 +43,12 @@ namespace HybridCLR.Editor.Commands
CompileDll(EditorUserBuildSettings.activeBuildTarget); CompileDll(EditorUserBuildSettings.activeBuildTarget);
} }
[MenuItem("HybridCLR/CompileDll/ActiveBuildTarget_Development", priority = 101)]
public static void CompileDllActiveBuildTargetDevelopment()
{
CompileDll(EditorUserBuildSettings.activeBuildTarget, true);
}
[MenuItem("HybridCLR/CompileDll/Win32", priority = 200)] [MenuItem("HybridCLR/CompileDll/Win32", priority = 200)]
public static void CompileDllWin32() public static void CompileDllWin32()
{ {