1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-13 22:04:09 +02:00

Properply rebuilds hash after a hot compile

This commit is contained in:
Brian Fiete 2020-04-16 00:33:29 -07:00
parent 11a46fa422
commit e7540ddef0
3 changed files with 23 additions and 8 deletions

View file

@ -62,13 +62,17 @@ namespace IDE.Compiler
ProjectSourceCommand command = new ProjectSourceCommand(); ProjectSourceCommand command = new ProjectSourceCommand();
command.mProjectSource = projectSource; command.mProjectSource = projectSource;
command.mSourceString = new String(); command.mSourceString = new String();
command.mSourceHash = sourceHash;
var wantsHash; var wantsHash;
if (!(sourceHash case .None))
wantsHash = false;
IDEApp.sApp.FindProjectSourceContent(projectSource, out command.mSourceCharIdData, false, command.mSourceString, wantsHash ? &command.mSourceHash : null); IDEApp.sApp.FindProjectSourceContent(projectSource, out command.mSourceCharIdData, false, command.mSourceString, wantsHash ? &command.mSourceHash : null);
if (!(sourceHash case .None))
{
if (command.mSourceHash != sourceHash)
projectSource.mWasBuiltWithOldHash = true;
command.mSourceHash = sourceHash;
}
if (gApp.mBfBuildCompiler == this) if (gApp.mBfBuildCompiler == this)
{ {
if (gApp.mDbgVersionedCompileDir != null) if (gApp.mDbgVersionedCompileDir != null)

View file

@ -7982,18 +7982,27 @@ namespace IDE
} }
else // Actual build else // Actual build
{ {
if ((projectSource.HasChangedSinceLastCompile) || (projectSource.mLoadFailed) || (forceQueue)) bool wantsHashRefresh = false;
if ((hotProject == null) && (projectSource.mWasBuiltWithOldHash))
wantsHashRefresh = true;
if ((projectSource.HasChangedSinceLastCompile) || (projectSource.mLoadFailed) || (forceQueue) || (wantsHashRefresh))
{ {
// mHasChangedSinceLastCompile is safe to set 'false' here since it just determines whether or not // mHasChangedSinceLastCompile is safe to set 'false' here since it just determines whether or not
// we rebuild the TypeDefs from the sources. It isn't affected by any compilation errors. // we rebuild the TypeDefs from the sources. It isn't affected by any compilation errors.
projectSource.mHasChangedSinceLastCompile = false; projectSource.mHasChangedSinceLastCompile = false;
projectSource.mWasBuiltWithOldHash = false;
SourceHash sourceHash = .None; SourceHash sourceHash = .None;
if ((hotProject != null) && (!mWorkspace.mCompileInstanceList.IsEmpty))
if (hotProject != null)
{
if (!mWorkspace.mCompileInstanceList.IsEmpty)
{ {
let compileInstance = mWorkspace.GetProjectSourceCompileInstance(projectSource, 0); let compileInstance = mWorkspace.GetProjectSourceCompileInstance(projectSource, 0);
sourceHash = compileInstance.mSourceHash; sourceHash = compileInstance.mSourceHash;
} }
}
bfCompiler.QueueProjectSource(projectSource, sourceHash, !bfCompiler.mIsResolveOnly); bfCompiler.QueueProjectSource(projectSource, sourceHash, !bfCompiler.mIsResolveOnly);
hadBeef = true; hadBeef = true;

View file

@ -13,6 +13,7 @@ using IDE.ui;
using IDE.Util; using IDE.Util;
using System.Threading; using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using IDE.util;
namespace IDE namespace IDE
{ {
@ -276,6 +277,7 @@ namespace IDE
public FileEditData mEditData; public FileEditData mEditData;
public bool mHasChangedSinceLastCompile = true; public bool mHasChangedSinceLastCompile = true;
public bool mWasBuiltWithOldHash;
public bool mHasChangedSinceLastSuccessfulCompile = true; public bool mHasChangedSinceLastSuccessfulCompile = true;
public bool mLoadFailed; public bool mLoadFailed;
public bool HasChangedSinceLastCompile public bool HasChangedSinceLastCompile