mirror of https://github.com/godotengine/godot
Fix C# "out of sync" notice with external editors
Change what triggers our re-evaluation of the last valid build datetime stored internally. Move that datetime in `BuildManager`.
This commit is contained in:
parent
36e943b6b2
commit
9d283063a0
|
|
@ -24,6 +24,20 @@ namespace GodotTools.Build
|
||||||
public static event Action<string> StdOutputReceived;
|
public static event Action<string> StdOutputReceived;
|
||||||
public static event Action<string> StdErrorReceived;
|
public static event Action<string> StdErrorReceived;
|
||||||
|
|
||||||
|
public static DateTime LastValidBuildDateTime { get; private set; }
|
||||||
|
|
||||||
|
static BuildManager()
|
||||||
|
{
|
||||||
|
UpdateLastValidBuildDateTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void UpdateLastValidBuildDateTime()
|
||||||
|
{
|
||||||
|
var dllName = $"{GodotSharpDirs.ProjectAssemblyName}.dll";
|
||||||
|
var path = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, "Debug", dllName);
|
||||||
|
LastValidBuildDateTime = File.GetLastWriteTime(path);
|
||||||
|
}
|
||||||
|
|
||||||
private static void RemoveOldIssuesFile(BuildInfo buildInfo)
|
private static void RemoveOldIssuesFile(BuildInfo buildInfo)
|
||||||
{
|
{
|
||||||
string issuesFile = GetIssuesFilePath(buildInfo);
|
string issuesFile = GetIssuesFilePath(buildInfo);
|
||||||
|
|
|
||||||
|
|
@ -89,8 +89,11 @@ namespace GodotTools.Build
|
||||||
GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
|
GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
|
||||||
|
|
||||||
if (Internal.IsAssembliesReloadingNeeded())
|
if (Internal.IsAssembliesReloadingNeeded())
|
||||||
|
{
|
||||||
|
BuildManager.UpdateLastValidBuildDateTime();
|
||||||
Internal.ReloadAssemblies(softReload: false);
|
Internal.ReloadAssemblies(softReload: false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void RebuildProject()
|
private void RebuildProject()
|
||||||
{
|
{
|
||||||
|
|
@ -107,8 +110,11 @@ namespace GodotTools.Build
|
||||||
GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
|
GodotSharpEditor.Instance.GetNode<HotReloadAssemblyWatcher>("HotReloadAssemblyWatcher").RestartTimer();
|
||||||
|
|
||||||
if (Internal.IsAssembliesReloadingNeeded())
|
if (Internal.IsAssembliesReloadingNeeded())
|
||||||
|
{
|
||||||
|
BuildManager.UpdateLastValidBuildDateTime();
|
||||||
Internal.ReloadAssemblies(softReload: false);
|
Internal.ReloadAssemblies(softReload: false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void CleanProject()
|
private void CleanProject()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,6 @@ namespace GodotTools
|
||||||
|
|
||||||
public bool SkipBuildBeforePlaying { get; set; } = false;
|
public bool SkipBuildBeforePlaying { get; set; } = false;
|
||||||
|
|
||||||
public DateTime LastValidBuildDateTime { get; private set; }
|
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private bool CreateProjectSolutionIfNeeded()
|
private bool CreateProjectSolutionIfNeeded()
|
||||||
{
|
{
|
||||||
|
|
@ -441,21 +439,6 @@ namespace GodotTools
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLastValidBuildDateTime()
|
|
||||||
{
|
|
||||||
var dllName = $"{GodotSharpDirs.ProjectAssemblyName}.dll";
|
|
||||||
var path = Path.Combine(GodotSharpDirs.ProjectBaseOutputPath, "Debug", dllName);
|
|
||||||
LastValidBuildDateTime = File.GetLastWriteTime(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BuildFinished(BuildResult buildResult)
|
|
||||||
{
|
|
||||||
if (buildResult == BuildResult.Success)
|
|
||||||
{
|
|
||||||
UpdateLastValidBuildDateTime();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void BuildStateChanged()
|
private void BuildStateChanged()
|
||||||
{
|
{
|
||||||
if (_bottomPanelBtn != null)
|
if (_bottomPanelBtn != null)
|
||||||
|
|
@ -466,8 +449,6 @@ namespace GodotTools
|
||||||
{
|
{
|
||||||
base._EnablePlugin();
|
base._EnablePlugin();
|
||||||
|
|
||||||
UpdateLastValidBuildDateTime();
|
|
||||||
|
|
||||||
ProjectSettings.SettingsChanged += GodotSharpDirs.DetermineProjectLocation;
|
ProjectSettings.SettingsChanged += GodotSharpDirs.DetermineProjectLocation;
|
||||||
|
|
||||||
if (Instance != null)
|
if (Instance != null)
|
||||||
|
|
@ -640,7 +621,6 @@ namespace GodotTools
|
||||||
var inspectorPlugin = new InspectorPlugin();
|
var inspectorPlugin = new InspectorPlugin();
|
||||||
AddInspectorPlugin(inspectorPlugin);
|
AddInspectorPlugin(inspectorPlugin);
|
||||||
_inspectorPluginWeak = WeakRef(inspectorPlugin);
|
_inspectorPluginWeak = WeakRef(inspectorPlugin);
|
||||||
BuildManager.BuildFinished += BuildFinished;
|
|
||||||
|
|
||||||
BuildManager.Initialize();
|
BuildManager.Initialize();
|
||||||
RiderPathManager.Initialize();
|
RiderPathManager.Initialize();
|
||||||
|
|
@ -657,7 +637,6 @@ namespace GodotTools
|
||||||
|
|
||||||
// Custom signals aren't automatically disconnected currently.
|
// Custom signals aren't automatically disconnected currently.
|
||||||
MSBuildPanel.BuildStateChanged -= BuildStateChanged;
|
MSBuildPanel.BuildStateChanged -= BuildStateChanged;
|
||||||
BuildManager.BuildFinished -= BuildFinished;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _ExitTree()
|
public override void _ExitTree()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotTools.Build;
|
||||||
using GodotTools.Internals;
|
using GodotTools.Internals;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using static GodotTools.Internals.Globals;
|
|
||||||
|
|
||||||
namespace GodotTools
|
namespace GodotTools
|
||||||
{
|
{
|
||||||
|
|
@ -16,15 +16,21 @@ namespace GodotTools
|
||||||
RestartTimer();
|
RestartTimer();
|
||||||
|
|
||||||
if (Internal.IsAssembliesReloadingNeeded())
|
if (Internal.IsAssembliesReloadingNeeded())
|
||||||
|
{
|
||||||
|
BuildManager.UpdateLastValidBuildDateTime();
|
||||||
Internal.ReloadAssemblies(softReload: false);
|
Internal.ReloadAssemblies(softReload: false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void TimerTimeout()
|
private void TimerTimeout()
|
||||||
{
|
{
|
||||||
if (Internal.IsAssembliesReloadingNeeded())
|
if (Internal.IsAssembliesReloadingNeeded())
|
||||||
|
{
|
||||||
|
BuildManager.UpdateLastValidBuildDateTime();
|
||||||
Internal.ReloadAssemblies(softReload: false);
|
Internal.ReloadAssemblies(softReload: false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
public void RestartTimer()
|
public void RestartTimer()
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
using GodotTools.Build;
|
||||||
using GodotTools.Utils;
|
using GodotTools.Utils;
|
||||||
|
|
||||||
namespace GodotTools.Inspector
|
namespace GodotTools.Inspector
|
||||||
|
|
@ -24,7 +25,7 @@ namespace GodotTools.Inspector
|
||||||
{
|
{
|
||||||
if (script is not CSharpScript) continue;
|
if (script is not CSharpScript) continue;
|
||||||
|
|
||||||
if (File.GetLastWriteTime(script.ResourcePath) > GodotSharpEditor.Instance.LastValidBuildDateTime)
|
if (File.GetLastWriteTime(script.ResourcePath) > BuildManager.LastValidBuildDateTime)
|
||||||
{
|
{
|
||||||
AddCustomControl(new InspectorOutOfSyncWarning());
|
AddCustomControl(new InspectorOutOfSyncWarning());
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue