1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 19:48:20 +02:00

Fixed issue of file hashing causing too much rebuilding

This commit is contained in:
Brian Fiete 2020-04-14 11:37:27 -07:00
parent 592471434f
commit 807b71d433
10 changed files with 53 additions and 22 deletions

View file

@ -419,7 +419,7 @@ namespace IDE.Compiler
projectSourceCommand.mProjectSource.mLoadFailed = data == null;
if ((!mIsResolveOnly) && (data != null))
IDEApp.sApp.mWorkspace.ProjectSourceCompiled(projectSource, data, char8IdData, canMoveSourceString);
IDEApp.sApp.mWorkspace.ProjectSourceCompiled(projectSource, data, hash, char8IdData, canMoveSourceString);
var bfParser = mBfSystem.CreateParser(projectSourceCommand.mProjectSource);
if (data != null)

View file

@ -112,7 +112,7 @@ namespace IDE.Compiler
projectSource.GetFullImportPath(fullPath);
if (Path.Equals(fullPath, entry.mFilePath))
{
app.mBfResolveCompiler.QueueProjectSource(projectSource, false);
app.mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
needsResolveAll = true;
DeferRefreshVisibleViews(entry.mExludeSourceViewPanel);
}

View file

@ -57,12 +57,18 @@ namespace IDE.Compiler
mResolveAllWait = 2;
}
public virtual void QueueProjectSource(ProjectSource projectSource, bool wantsHash)
public virtual void QueueProjectSource(ProjectSource projectSource, SourceHash sourceHash, bool wantsHash)
{
ProjectSourceCommand command = new ProjectSourceCommand();
command.mProjectSource = projectSource;
command.mSourceString = new String();
command.mSourceHash = sourceHash;
var wantsHash;
if (!(sourceHash case .None))
wantsHash = false;
IDEApp.sApp.FindProjectSourceContent(projectSource, out command.mSourceCharIdData, false, command.mSourceString, wantsHash ? &command.mSourceHash : null);
if (gApp.mBfBuildCompiler == this)
{
if (gApp.mDbgVersionedCompileDir != null)

View file

@ -3170,6 +3170,13 @@ namespace IDE
public Dialog Fail(String text, Widget addWidget = null, WidgetWindow parentWindow = null)
{
var text;
if (text.Contains('\t'))
{
text = scope:: String()..Append(text);
text.Replace("\t", " ");
}
// Always write to STDOUT even if we're running as a GUI, allowing cases like RunAndWait to pass us a stdout handle
Console.Error.WriteLine("ERROR: {0}", text);
@ -7946,7 +7953,7 @@ namespace IDE
return hadBeef;
}
public bool QueueParseBeefFiles(BfCompiler bfCompiler, bool forceQueue, ProjectFolder projectFolder)
public bool QueueParseBeefFiles(BfCompiler bfCompiler, bool forceQueue, ProjectFolder projectFolder, Project hotProject)
{
bool hadBeef = false;
@ -7970,7 +7977,7 @@ namespace IDE
if (bfCompiler != null)
{
// Process change in resolve compiler
bfCompiler.QueueProjectSource(projectSource, !bfCompiler.mIsResolveOnly);
bfCompiler.QueueProjectSource(projectSource, .None, !bfCompiler.mIsResolveOnly);
}
}
else // Actual build
@ -7980,7 +7987,15 @@ namespace IDE
// 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.
projectSource.mHasChangedSinceLastCompile = false;
bfCompiler.QueueProjectSource(projectSource, !bfCompiler.mIsResolveOnly);
SourceHash sourceHash = .None;
if ((hotProject != null) && (!mWorkspace.mCompileInstanceList.IsEmpty))
{
let compileInstance = mWorkspace.GetProjectSourceCompileInstance(projectSource, 0);
sourceHash = compileInstance.mSourceHash;
}
bfCompiler.QueueProjectSource(projectSource, sourceHash, !bfCompiler.mIsResolveOnly);
hadBeef = true;
}
}
@ -7990,7 +8005,7 @@ namespace IDE
if (item is ProjectFolder)
{
var innerProjectFolder = (ProjectFolder)item;
hadBeef |= QueueParseBeefFiles(bfCompiler, forceQueue, innerProjectFolder);
hadBeef |= QueueParseBeefFiles(bfCompiler, forceQueue, innerProjectFolder, hotProject);
}
}
@ -8255,7 +8270,7 @@ namespace IDE
if (IsProjectEnabled(project))
{
if (reparseFiles)
QueueParseBeefFiles(mBfResolveCompiler, false, project.mRootFolder);
QueueParseBeefFiles(mBfResolveCompiler, false, project.mRootFolder, null);
mBfResolveCompiler.QueueDeferredResolveAll();
mBfResolveCompiler.QueueRefreshViewCommand();
}
@ -8263,7 +8278,7 @@ namespace IDE
else
{
if (reparseFiles)
QueueParseBeefFiles(mBfResolveCompiler, false, project.mRootFolder);
QueueParseBeefFiles(mBfResolveCompiler, false, project.mRootFolder, null);
}
}
@ -8423,7 +8438,7 @@ namespace IDE
{
if (SetupBeefProjectSettings(bfSystem, bfCompiler, project))
{
doCompile |= QueueParseBeefFiles(bfCompiler, !workspaceOptions.mIncrementalBuild, project.mRootFolder);
doCompile |= QueueParseBeefFiles(bfCompiler, !workspaceOptions.mIncrementalBuild, project.mRootFolder, hotProject);
}
else if (IsProjectEnabled(project))
success = false;
@ -10932,7 +10947,7 @@ namespace IDE
return;
var resolveCompiler = GetProjectCompilerForFile(projectSource.mPath);
if (resolveCompiler == mBfResolveCompiler)
resolveCompiler.QueueProjectSource(projectSource, false);
resolveCompiler.QueueProjectSource(projectSource, .None, false);
projectSource.mHasChangedSinceLastCompile = true;
}
});
@ -11835,8 +11850,8 @@ namespace IDE
{
if (IsBeefFile(newPath))
{
mBfResolveCompiler.QueueProjectSource(projectSource, false);
mBfBuildCompiler.QueueProjectSource(projectSource, true);
mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
mBfBuildCompiler.QueueProjectSource(projectSource, .None, true);
}
else
{
@ -12115,7 +12130,7 @@ namespace IDE
{
if (mBfResolveCompiler != null)
{
mBfResolveCompiler.QueueProjectSource(projectSource, false);
mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
mBfResolveCompiler.QueueDeferredResolveAll();
mBfResolveCompiler.QueueRefreshViewCommand();
}

View file

@ -7,6 +7,7 @@ using Beefy.utils;
using System.Diagnostics;
using System.Threading;
using IDE.Util;
using IDE.util;
namespace IDE
{
@ -316,6 +317,7 @@ namespace IDE
public class ProjectSourceCompileInstance
{
public String mSource ~ delete _;
public SourceHash mSourceHash;
public IdSpan mSourceCharIdData ~ _.Dispose();
public int32 mRefCount = 1;
@ -1126,7 +1128,7 @@ namespace IDE
}
}
public void ProjectSourceCompiled(ProjectSource projectSource, String source, IdSpan sourceCharIdData, bool canMoveSourceString = false)
public void ProjectSourceCompiled(ProjectSource projectSource, String source, SourceHash sourceHash, IdSpan sourceCharIdData, bool canMoveSourceString = false)
{
using (mMonitor.Enter())
{
@ -1141,6 +1143,7 @@ namespace IDE
source.MoveTo(projectSourceCompileInstance.mSource, true);
else
projectSourceCompileInstance.mSource.Set(source);
projectSourceCompileInstance.mSourceHash = sourceHash;
projectSourceCompileInstance.mSourceCharIdData = sourceCharIdData.Duplicate();
ProjectItem* keyPtr;

View file

@ -708,7 +708,7 @@ namespace IDE.ui
if ((IDEApp.IsBeefFile(filePath)) && (gApp.mBfResolveCompiler != null))
{
for (var projectSource in editData.mProjectSources)
gApp.mBfResolveCompiler.QueueProjectSource(projectSource, false);
gApp.mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
gApp.mBfResolveCompiler.QueueDeferredResolveAll();
}

View file

@ -360,7 +360,7 @@ namespace IDE.ui
var resolveCompiler = gApp.GetProjectCompilerForFile(projectSource.mName);
if (resolveCompiler != null)
{
resolveCompiler.QueueProjectSource(projectSource, false);
resolveCompiler.QueueProjectSource(projectSource, .None, false);
resolveCompiler.QueueDeferredResolveAll();
}
projectSource.mHasChangedSinceLastCompile = true;

View file

@ -740,7 +740,7 @@ namespace IDE.ui
if ((mKind == Kind.Rename) && (IDEApp.IsBeefFile(editData.mFilePath)))
{
for (var projectSource in editData.mProjectSources)
app.mBfResolveCompiler.QueueProjectSource(projectSource, false);
app.mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
app.mBfResolveCompiler.QueueDeferredResolveAll();
}
}

View file

@ -83,7 +83,7 @@ namespace IDE.Util
for (var projectSource in editData.mProjectSources)
{
projectSource.HasChangedSinceLastCompile = true;
IDEApp.sApp.mBfResolveCompiler.QueueProjectSource(projectSource, false);
IDEApp.sApp.mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
}
}
}
@ -127,7 +127,7 @@ namespace IDE.Util
for (var projectSource in editData.mProjectSources)
{
projectSource.HasChangedSinceLastCompile = true;
IDEApp.sApp.mBfResolveCompiler.QueueProjectSource(projectSource, false);
IDEApp.sApp.mBfResolveCompiler.QueueProjectSource(projectSource, .None, false);
}
}
}

View file

@ -1290,8 +1290,8 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
if (bfParser != NULL)
{
mSignatureHashCtx->MixinStr(bfParser->mFileName);
mSignatureHashCtx->Mixin(bfParser->mParserData->mMD5Hash);
mFullHashCtx->MixinStr(bfParser->mFileName);
mFullHashCtx->Mixin(bfParser->mParserData->mMD5Hash);
}
HashNode(*mSignatureHashCtx, typeDeclaration->mTypeNode);
for (auto& baseClassNode : typeDeclaration->mBaseClasses)
@ -2066,6 +2066,13 @@ void BfDefBuilder::FinishTypeDef(bool wantsToString)
HashContext inlineHashCtx;
if (mCurSource != NULL)
{
auto bfParser = mCurSource->ToParser();
if (bfParser != NULL)
inlineHashCtx.MixinStr(bfParser->mFileName);
}
//for (auto methodDef : mCurTypeDef->mMethods)
for (int methodIdx = 0; methodIdx < (int)mCurTypeDef->mMethods.size(); methodIdx++)
{