mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
Add option to clean rebuild scripts
This commit is contained in:
@@ -232,11 +232,11 @@ namespace GlitchyEditor
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Rebuilds the C# scripts.
|
/// Rebuilds the C# scripts.
|
||||||
public BuildScriptsBackgroundTask BuildScripts(bool reloadAfterBuild = true)
|
public BuildScriptsBackgroundTask BuildScripts(bool reloadAfterBuild = true, bool doCleanRebuild = false)
|
||||||
{
|
{
|
||||||
ScriptEngine.SuspendAssemblyWatcher();
|
ScriptEngine.SuspendAssemblyWatcher();
|
||||||
|
|
||||||
BuildScriptsBackgroundTask task = new .(EditorApp.Instance.Settings.ScriptSettings.DotNetExecutablePath, EditorApp.Instance.EditorLayer.CurrentProject, false){ DeleteWhenEnded = true };
|
BuildScriptsBackgroundTask task = new .(EditorApp.Instance.Settings.ScriptSettings.DotNetExecutablePath, EditorApp.Instance.EditorLayer.CurrentProject, releaseBuild: false, doCleanRebuild){ DeleteWhenEnded = true };
|
||||||
task.ContinueWith(new (task) => {
|
task.ContinueWith(new (task) => {
|
||||||
ScriptEngine.ResumeAssemblyWatcher();
|
ScriptEngine.ResumeAssemblyWatcher();
|
||||||
|
|
||||||
|
|||||||
@@ -1543,6 +1543,11 @@ namespace GlitchyEditor
|
|||||||
|
|
||||||
ImGui.AttachTooltip("Compiles the C# script project.");
|
ImGui.AttachTooltip("Compiles the C# script project.");
|
||||||
|
|
||||||
|
if(ImGui.MenuItem("Clean and build Scripts", "Ctrl+Shift+B"))
|
||||||
|
_editor.BuildScripts(doCleanRebuild: true);
|
||||||
|
|
||||||
|
ImGui.AttachTooltip("Makes a clean rebuild of the C# script project.");
|
||||||
|
|
||||||
if(ImGui.MenuItem("Reload Scripts", "Ctrl+Shift+R"))
|
if(ImGui.MenuItem("Reload Scripts", "Ctrl+Shift+R"))
|
||||||
_editor.ReloadScripts();
|
_editor.ReloadScripts();
|
||||||
|
|
||||||
|
|||||||
@@ -19,16 +19,18 @@ class BuildScriptsBackgroundTask : BackgroundTask
|
|||||||
private Project _project;
|
private Project _project;
|
||||||
private bool _releaseBuild;
|
private bool _releaseBuild;
|
||||||
private StringView _dotnetPath;
|
private StringView _dotnetPath;
|
||||||
|
private bool _doCleanRebuild;
|
||||||
|
|
||||||
private String _buildLog = new .() ~ delete _;
|
private String _buildLog = new .() ~ delete _;
|
||||||
|
|
||||||
private SpawnedProcess _process ~ delete _;
|
private SpawnedProcess _process ~ delete _;
|
||||||
|
|
||||||
public this(StringView dotnetPath, Project project, bool releaseBuild)
|
public this(StringView dotnetPath, Project project, bool releaseBuild, bool doCleanRebuild)
|
||||||
{
|
{
|
||||||
_dotnetPath = dotnetPath;
|
_dotnetPath = dotnetPath;
|
||||||
_project = project;
|
_project = project;
|
||||||
_releaseBuild = releaseBuild;
|
_releaseBuild = releaseBuild;
|
||||||
|
_doCleanRebuild = doCleanRebuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override RunResult Run()
|
public override RunResult Run()
|
||||||
@@ -81,10 +83,22 @@ class BuildScriptsBackgroundTask : BackgroundTask
|
|||||||
|
|
||||||
processInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.DotNetExecutablePath);
|
processInfo.SetFileName(EditorApp.Instance.Settings.ScriptSettings.DotNetExecutablePath);
|
||||||
|
|
||||||
|
StringView target;
|
||||||
|
|
||||||
|
if (_doCleanRebuild)
|
||||||
|
{
|
||||||
|
target = "build -t:Rebuild";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = "build";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// -sc|--self-contained... Publish the .NET runtime with your application so the runtime doesn't need to be installed on the target machine.
|
// -sc|--self-contained... Publish the .NET runtime with your application so the runtime doesn't need to be installed on the target machine.
|
||||||
// -> This might be useful to build the final game
|
// -> This might be useful to build the final game
|
||||||
// -o|--ouput <OUTPUT_DIRECTORY>... might be useful for building the final game
|
// -o|--ouput <OUTPUT_DIRECTORY>... might be useful for building the final game
|
||||||
processInfo.SetArguments(scope $"build -c {(_releaseBuild ? "Release" : "Debug")}");
|
processInfo.SetArguments(scope $"{target} -c {(_releaseBuild ? "Release" : "Debug")}");
|
||||||
|
|
||||||
_process = new SpawnedProcess();
|
_process = new SpawnedProcess();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user