1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Improved comptime rebuilds when files and directories change

This commit is contained in:
Brian Fiete 2021-12-29 10:07:36 -05:00
parent af8bd5a813
commit 915a8df50e
10 changed files with 236 additions and 70 deletions

View file

@ -6565,6 +6565,8 @@ bool BfCompiler::DoCompile(const StringImpl& outputDirectory)
}
}
mRebuildFileSet.Clear();
// Inc revision for next run through Compile
mRevision++;
mHasComptimeRebuilds = false;
@ -8149,7 +8151,7 @@ String BfCompiler::GetGeneratorString(BfTypeDef* typeDef, BfTypeInstance* typeIn
SetAndRestoreValue<BfTypeInstance*> prevTypeInstance(mContext->mUnreifiedModule->mCurTypeInstance, typeInst);
BfExprEvaluator exprEvaluator(mContext->mUnreifiedModule);
exprEvaluator.mBfEvalExprFlags = BfEvalExprFlags_Comptime;
exprEvaluator.mBfEvalExprFlags = (BfEvalExprFlags)(BfEvalExprFlags_Comptime | BfEvalExprFlags_NoCeRebuildFlags);
SizedArray<BfIRValue, 1> irArgs;
if (args != NULL)
@ -8189,7 +8191,7 @@ String BfCompiler::GetGeneratorTypeDefList()
BfProject* curProject = NULL;
Dictionary<BfProject*, int> projectIds;
BfResolvePassData resolvePassData;
BfResolvePassData resolvePassData;
SetAndRestoreValue<BfResolvePassData*> prevResolvePassData(mResolvePassData, &resolvePassData);
BfPassInstance passInstance(mSystem);
SetAndRestoreValue<BfPassInstance*> prevPassInstance(mPassInstance, &passInstance);
@ -8226,7 +8228,7 @@ String BfCompiler::GetGeneratorTypeDefList()
String BfCompiler::GetGeneratorInitData(const StringImpl& typeName, const StringImpl& args)
{
BfResolvePassData resolvePassData;
BfResolvePassData resolvePassData;
SetAndRestoreValue<BfResolvePassData*> prevResolvePassData(mResolvePassData, &resolvePassData);
BfPassInstance passInstance(mSystem);
SetAndRestoreValue<BfPassInstance*> prevPassInstance(mPassInstance, &passInstance);
@ -9444,6 +9446,22 @@ BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetAutocompleteInfo(BfCompiler* bfC
return autoCompleteResultString.c_str();
}
BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetRebuildFileSet(BfCompiler* bfCompiler)
{
String& autoCompleteResultString = *gTLStrReturn.Get();
for (auto& val : bfCompiler->mRebuildFileSet)
{
autoCompleteResultString += val;
autoCompleteResultString += "\n";
}
return autoCompleteResultString.c_str();
}
BF_EXPORT void BF_CALLTYPE BfCompiler_FileChanged(BfCompiler* bfCompiler, const char* dirPath)
{
bfCompiler->mRebuildChangedFileSet.Add(dirPath);
}
BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetSymbolReferences(BfCompiler* bfCompiler, BfPassInstance* bfPassInstance, BfResolvePassData* resolvePassData)
{
BP_ZONE("BfCompiler_GetSymbolReferences");