diff --git a/IDE/src/BuildContext.bf b/IDE/src/BuildContext.bf index 6d487155..b9bd2429 100644 --- a/IDE/src/BuildContext.bf +++ b/IDE/src/BuildContext.bf @@ -10,6 +10,7 @@ namespace IDE { class BuildContext { + public int32 mUpdateCnt; public Project mHotProject; public Workspace.Options mWorkspaceOptions; public Dictionary mImpLibMap = new .() ~ @@ -567,113 +568,144 @@ namespace IDE } } - if (project.mNeedsTargetRebuild) - { - /*if (File.Delete(targetPath).Failed(true)) - { - OutputLine("Failed to delete {0}", targetPath); - return false; - }*/ + /*if (File.Delete(targetPath).Failed(true)) + { + OutputLine("Failed to delete {0}", targetPath); + return false; + }*/ - switch (options.mBuildOptions.mCLibType) - { - case .None: - linkLine.Append("-nodefaultlib "); - case .Dynamic: - //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprt " : "-defaultlib:msvcrt "); - linkLine.Append("-defaultlib:msvcrt "); - case .Static: - //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmt " : "-defaultlib:libcmt "); - linkLine.Append("-defaultlib:libcmt "); - case .DynamicDebug: - //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprtd " : "-defaultlib:msvcrtd "); - linkLine.Append("-defaultlib:msvcrtd "); - case .StaticDebug: - //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmtd " : "-defaultlib:libcmtd "); - linkLine.Append("-defaultlib:libcmtd "); - case .SystemMSVCRT: - linkLine.Append("-nodefaultlib "); + switch (options.mBuildOptions.mCLibType) + { + case .None: + linkLine.Append("-nodefaultlib "); + case .Dynamic: + //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprt " : "-defaultlib:msvcrt "); + linkLine.Append("-defaultlib:msvcrt "); + case .Static: + //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmt " : "-defaultlib:libcmt "); + linkLine.Append("-defaultlib:libcmt "); + case .DynamicDebug: + //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:msvcprtd " : "-defaultlib:msvcrtd "); + linkLine.Append("-defaultlib:msvcrtd "); + case .StaticDebug: + //linkLine.Append((workspaceOptions.mMachineType == .x86) ? "-defaultlib:libcpmtd " : "-defaultlib:libcmtd "); + linkLine.Append("-defaultlib:libcmtd "); + case .SystemMSVCRT: + linkLine.Append("-nodefaultlib "); - String minRTModName = scope String(); - if ((project.mGeneralOptions.mTargetType == .BeefWindowsApplication) || - (project.mGeneralOptions.mTargetType == .C_WindowsApplication)) - minRTModName.Append("g"); - if (options.mBuildOptions.mBeefLibType == .DynamicDebug) - minRTModName.Append("d"); - if (!minRTModName.IsEmpty) - minRTModName.Insert(0, "_"); - - if (workspaceOptions.mMachineType == .x86) - linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib "); - else - linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib "); - linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib version.lib comdlg32.lib chkstk.obj -ignore:4049 -ignore:4217 "); - } - linkLine.Append("-nologo "); - //linkLine.Append("-fixed "); - - // Incremental just seems to be slower for Beef. Test on larger projects to verify - linkLine.Append("-incremental:no "); - - if (options.mBuildOptions.mStackSize > 0) - linkLine.AppendF("-stack:{} ", options.mBuildOptions.mStackSize); - - linkLine.Append("-pdb:"); - let pdbName = scope String(); - GetPdbPath(targetPath, workspaceOptions, options, pdbName); - IDEUtils.AppendWithOptionalQuotes(linkLine, pdbName); - linkLine.Append(" "); - - //TODO: Only add -debug if we have some debug info? - //if (isDebug) - if (workspaceOptions.mEmitDebugInfo != .No) - linkLine.Append("-debug "); - - if (workspaceOptions.mBfOptimizationLevel.IsOptimized()) - //linkLine.Append("-opt:ref -verbose "); - linkLine.Append("-opt:ref "); - else - linkLine.Append("-opt:noref "); + String minRTModName = scope String(); + if ((project.mGeneralOptions.mTargetType == .BeefWindowsApplication) || + (project.mGeneralOptions.mTargetType == .C_WindowsApplication)) + minRTModName.Append("g"); + if (options.mBuildOptions.mBeefLibType == .DynamicDebug) + minRTModName.Append("d"); + if (!minRTModName.IsEmpty) + minRTModName.Insert(0, "_"); if (workspaceOptions.mMachineType == .x86) - { - for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths) - { - linkLine.AppendF("-libpath:\"{0}\" ", libPath); - } - linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x86\" "); - } + linkLine.Append(gApp.mInstallDir, @"lib\x86\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT32", minRTModName, ".lib "); else + linkLine.Append(gApp.mInstallDir, @"lib\x64\msvcrt.lib Beef", IDEApp.sRTVersionStr,"MinRT64", minRTModName, ".lib "); + linkLine.Append("ntdll.lib user32.lib kernel32.lib gdi32.lib winmm.lib shell32.lib ole32.lib rpcrt4.lib version.lib comdlg32.lib chkstk.obj -ignore:4049 -ignore:4217 "); + } + linkLine.Append("-nologo "); + //linkLine.Append("-fixed "); + + // Incremental just seems to be slower for Beef. Test on larger projects to verify + linkLine.Append("-incremental:no "); + + if (options.mBuildOptions.mStackSize > 0) + linkLine.AppendF("-stack:{} ", options.mBuildOptions.mStackSize); + + linkLine.Append("-pdb:"); + let pdbName = scope String(); + GetPdbPath(targetPath, workspaceOptions, options, pdbName); + IDEUtils.AppendWithOptionalQuotes(linkLine, pdbName); + linkLine.Append(" "); + + //TODO: Only add -debug if we have some debug info? + //if (isDebug) + if (workspaceOptions.mEmitDebugInfo != .No) + linkLine.Append("-debug "); + + if (workspaceOptions.mBfOptimizationLevel.IsOptimized()) + //linkLine.Append("-opt:ref -verbose "); + linkLine.Append("-opt:ref "); + else + linkLine.Append("-opt:noref "); + + if (workspaceOptions.mMachineType == .x86) + { + for (var libPath in gApp.mSettings.mVSSettings.mLib32Paths) { - for (var libPath in gApp.mSettings.mVSSettings.mLib64Paths) - { - linkLine.AppendF("-libpath:\"{0}\" ", libPath); - } - linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x64\" "); + linkLine.AppendF("-libpath:\"{0}\" ", libPath); } - - String targetDir = scope String(); - Path.GetDirectoryPath(targetPath, targetDir); - linkLine.Append("-libpath:"); - IDEUtils.AppendWithOptionalQuotes(linkLine, targetDir); - linkLine.Append(" "); - - if (options.mBuildOptions.mOtherLinkFlags.Length != 0) + linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x86\" "); + } + else + { + for (var libPath in gApp.mSettings.mVSSettings.mLib64Paths) { - var linkFlags = scope String(); - gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags); - linkLine.Append(linkFlags, " "); + linkLine.AppendF("-libpath:\"{0}\" ", libPath); } + linkLine.Append("-libpath:\"", gApp.mInstallDir, "lib\\x64\" "); + } - let winOptions = project.mWindowsOptions; - + String targetDir = scope String(); + Path.GetDirectoryPath(targetPath, targetDir); + linkLine.Append("-libpath:"); + IDEUtils.AppendWithOptionalQuotes(linkLine, targetDir); + linkLine.Append(" "); + + if (options.mBuildOptions.mOtherLinkFlags.Length != 0) + { + var linkFlags = scope String(); + gApp.ResolveConfigString(workspaceOptions, project, options, options.mBuildOptions.mOtherLinkFlags, "link flags", linkFlags); + linkLine.Append(linkFlags, " "); + } + + let winOptions = project.mWindowsOptions; + + String projectBuildDir = scope String(); + gApp.GetProjectBuildDir(project, projectBuildDir); + + String cacheStr = scope String(); + + void AddBuildFileDependency(StringView filePath) + { + int64 fileTime = 0; + if (!filePath.IsEmpty) + fileTime = File.GetLastWriteTime(filePath).GetValueOrDefault().ToFileTime(); + cacheStr.AppendF("{}\t{}\n", filePath, fileTime); + } + + cacheStr.AppendF("Args\t{}\n", linkLine); + cacheStr.AppendF("Toolset\t{}\n", workspaceOptions.mToolsetType); + AddBuildFileDependency(project.mWindowsOptions.mIconFile); + AddBuildFileDependency(project.mWindowsOptions.mManifestFile); + cacheStr.AppendF("Description\t{}\n", project.mWindowsOptions.mDescription); + cacheStr.AppendF("Comments\t{}\n", project.mWindowsOptions.mComments); + cacheStr.AppendF("Company\t{}\n", project.mWindowsOptions.mCompany); + cacheStr.AppendF("Product\t{}\n", project.mWindowsOptions.mProduct); + cacheStr.AppendF("Copyright\t{}\n", project.mWindowsOptions.mCopyright); + cacheStr.AppendF("FileVersion\t{}\n", project.mWindowsOptions.mFileVersion); + cacheStr.AppendF("ProductVersion\t{}\n", project.mWindowsOptions.mProductVersion); + + String prevCacheStr = scope .(); + gApp.mBfBuildCompiler.GetBuildValue(projectBuildDir, "Link", prevCacheStr); + if (prevCacheStr != cacheStr) + { + project.mNeedsTargetRebuild = true; + gApp.mBfBuildCompiler.SetBuildValue(projectBuildDir, "Link", cacheStr); + gApp.mBfBuildCompiler.WriteBuildCache(projectBuildDir); + } + + if (project.mNeedsTargetRebuild) + { if ((!String.IsNullOrWhiteSpace(project.mWindowsOptions.mIconFile)) || (!String.IsNullOrWhiteSpace(project.mWindowsOptions.mManifestFile)) || (winOptions.HasVersionInfo())) - { - String projectBuildDir = scope String(); - gApp.GetProjectBuildDir(project, projectBuildDir); - + { String resOutPath = scope String(); resOutPath.Append(projectBuildDir, "\\Resource.res"); diff --git a/IDE/src/Compiler/BfCompiler.bf b/IDE/src/Compiler/BfCompiler.bf index 48e465f2..554a3b99 100644 --- a/IDE/src/Compiler/BfCompiler.bf +++ b/IDE/src/Compiler/BfCompiler.bf @@ -70,6 +70,15 @@ namespace IDE.Compiler [StdCall, CLink] static extern void BfCompiler_ClearBuildCache(void* bfCompiler); + [StdCall, CLink] + static extern void BfCompiler_SetBuildValue(void* bfCompiler, char8* cacheDir, char8* key, char8* value); + + [StdCall, CLink] + static extern char8* BfCompiler_GetBuildValue(void* bfCompiler, char8* cacheDir, char8* key); + + [StdCall, CLink] + static extern void BfCompiler_WriteBuildCache(void* bfCompiler, char8* cacheDir); + [StdCall, CLink] static extern char8* BfCompiler_GetOutputFileNames(void* bfCompiler, void* bfProject, out bool hadOutputChanges); @@ -591,6 +600,22 @@ namespace IDE.Compiler BfCompiler_ClearBuildCache(mNativeBfCompiler); } + public void SetBuildValue(String cacheDir, String key, String value) + { + BfCompiler_SetBuildValue(mNativeBfCompiler, cacheDir, key, value); + } + + public void GetBuildValue(String cacheDir, String key, String outValue) + { + char8* cStr = BfCompiler_GetBuildValue(mNativeBfCompiler, cacheDir, key); + outValue.Append(cStr); + } + + public void WriteBuildCache(String cacheDir) + { + BfCompiler_WriteBuildCache(mNativeBfCompiler, cacheDir); + } + public bool GetHasHotPendingDataChanges() { return BfCompiler_GetHasHotPendingDataChanges(mNativeBfCompiler); diff --git a/IDE/src/FileEditData.bf b/IDE/src/FileEditData.bf index 8a2e9f7e..764e8c1e 100644 --- a/IDE/src/FileEditData.bf +++ b/IDE/src/FileEditData.bf @@ -85,6 +85,8 @@ namespace IDE { var editWidgetContent = (SourceEditWidgetContent)mEditWidget.mEditWidgetContent; mFileDeleted = !editWidgetContent.Reload(mFilePath, mQueuedContent); + if (editWidgetContent.mSourceViewPanel.mLoadedHash.GetKind() == mLoadedHash.GetKind()) + editWidgetContent.mSourceViewPanel.mLoadedHash = mLoadedHash; mLastFileTextVersion = mEditWidget.Content.mData.mCurTextVersionId; } return true; diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index d85acb20..7a4cba99 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -390,6 +390,11 @@ namespace IDE { mProject = project; } + + public ~this() + { + + } } public enum ArgsFileKind @@ -7319,6 +7324,13 @@ namespace IDE if (ignoreCommand) { // Nothing + if (let targetCompletedCmd = next as TargetCompletedCmd) + { + String projectBuildDir = scope String(); + gApp.GetProjectBuildDir(targetCompletedCmd.mProject, projectBuildDir); + gApp.mBfBuildCompiler.SetBuildValue(projectBuildDir, "Link", "FAILED"); + gApp.mBfBuildCompiler.WriteBuildCache(projectBuildDir); + } } else if (next is ProcessBfCompileCmd) { @@ -11105,6 +11117,8 @@ namespace IDE if (mBuildContext != null) { + mBuildContext.mUpdateCnt++; + bool isCompiling = (!mExecutionInstances.IsEmpty) || (!mExecutionQueue.IsEmpty); if (mBuildContext.mScriptManager != null) { @@ -11429,7 +11443,13 @@ namespace IDE if (editData.mQueuedContent == null) editData.mQueuedContent = new String(); editData.mQueuedContent.Clear(); - if (LoadTextFile(fileName, editData.mQueuedContent, false) case .Err(let err)) + if (LoadTextFile(fileName, editData.mQueuedContent, false, scope() => + { + if (editData.mLoadedHash.GetKind() != .None) + { + editData.mLoadedHash = SourceHash.Create(editData.mLoadedHash.GetKind(), editData.mQueuedContent); + } + }) case .Err(let err)) { if (err case .FileOpenError(.SharingViolation)) { diff --git a/IDE/src/ui/ProjectProperties.bf b/IDE/src/ui/ProjectProperties.bf index 256ff4ce..4235fc79 100644 --- a/IDE/src/ui/ProjectProperties.bf +++ b/IDE/src/ui/ProjectProperties.bf @@ -952,15 +952,7 @@ namespace IDE.ui for (var propEntry in propEntries) { if (propEntry.HasChanged()) - { - if (propEntry.mProperties != null) - { - bool wantsExeRebuild = false; - propEntry.mProperties.Get("RebuildTarget", out wantsExeRebuild); - if (wantsExeRebuild) - mProject.mNeedsTargetRebuild = true; - } - + { configDataHadChange = true; propEntry.ApplyValue(); } diff --git a/IDE/src/ui/StatusBar.bf b/IDE/src/ui/StatusBar.bf index 1b6da8a6..7494bc78 100644 --- a/IDE/src/ui/StatusBar.bf +++ b/IDE/src/ui/StatusBar.bf @@ -312,7 +312,7 @@ namespace IDE.ui g.DrawString("Source Changed", GS!(200), GS!(-1.3f), FontAlign.Centered, GS!(120)); } - void DrawStatusBox(StringView str) + void DrawStatusBox(StringView str, int32 updateCnt = -1) { if (mStatusBoxUpdateCnt == -1) mStatusBoxUpdateCnt = 0; @@ -325,7 +325,11 @@ namespace IDE.ui completionRect.Inflate(-1, -1); //float pulseSpeed = Math.Min(mStatusBoxUpdateCnt * 0.001f, 0.2f); float pulseSpeed = 0.2f; + if (updateCnt != -1) + pulseSpeed = Math.Max(0.14f, pulseSpeed - updateCnt * 0.00005f); float pulsePct = -Math.Cos(Math.Max(mStatusBoxUpdateCnt - 30, 0) * pulseSpeed); + if (updateCnt != -1) + pulsePct *= Math.Max(0.4f, 1.0f - updateCnt * 0.0004f); using (g.PushColor(Color.FromHSV(0.1f, 0.5f, (float)Math.Max(pulsePct * 0.15f + 0.3f, 0.3f)))) g.FillRect(completionRect.mX, completionRect.mY, completionRect.mWidth, completionRect.mHeight); @@ -356,7 +360,7 @@ namespace IDE.ui } else if ((gApp.mBuildContext != null) && (!completionPct.HasValue)) { - DrawStatusBox("Custom Build Commands..."); + DrawStatusBox("Custom Build Commands...", gApp.mBuildContext.mUpdateCnt); } else mStatusBoxUpdateCnt = -1; diff --git a/IDEHelper/Compiler/BfCodeGen.cpp b/IDEHelper/Compiler/BfCodeGen.cpp index 8141b32c..42d48394 100644 --- a/IDEHelper/Compiler/BfCodeGen.cpp +++ b/IDEHelper/Compiler/BfCodeGen.cpp @@ -44,7 +44,7 @@ //#define DBG_FORCE_SYNCHRONIZED // This is used for the Release DLL thunk and the build.dat file -#define BF_CODEGEN_VERSION 13 +#define BF_CODEGEN_VERSION 14 #undef DEBUG @@ -85,7 +85,8 @@ void BfCodeGenDirectoryData::Read() return; #endif - while (!fileStream.Eof()) + int numFiles = fileStream.ReadInt32(); + for (int fileIdx = 0; fileIdx < numFiles; fileIdx++) { String fileName = fileStream.ReadAscii32SizedString(); BfCodeGenFileData fileData; @@ -95,6 +96,14 @@ void BfCodeGenDirectoryData::Read() mFileMap[fileName] = fileData; } + int numValues = fileStream.ReadInt32(); + for (int valIdx = 0; valIdx < numValues; valIdx++) + { + String key = fileStream.ReadAscii32SizedString(); + String value = fileStream.ReadAscii32SizedString(); + mBuildSettings[key] = value; + } + mFileTime = GetFileTimeWrite(fileName); } @@ -129,6 +138,7 @@ void BfCodeGenDirectoryData::Write() fileStream.Write(BF_CODEGEN_VERSION); fileStream.WriteT(mCodeGen->mBackendHash); + fileStream.Write((int)mFileMap.size()); for (auto& pair : mFileMap) { fileStream.Write(pair.mKey); @@ -137,6 +147,13 @@ void BfCodeGenDirectoryData::Write() fileStream.Write(&pair.mValue.mLastWasObjectWrite, sizeof(bool)); } + fileStream.Write((int)mBuildSettings.size()); + for (auto& pair : mBuildSettings) + { + fileStream.Write(pair.mKey); + fileStream.Write(pair.mValue); + } + fileStream.Close(); mFileTime = GetFileTimeWrite(fileName); } @@ -161,6 +178,7 @@ void BfCodeGenDirectoryData::Verify() void BfCodeGenDirectoryData::Clear() { mFileMap.Clear(); + mBuildSettings.Clear(); } bool BfCodeGenDirectoryData::CheckCache(const StringImpl& fileName, Val128 hash, Val128* outOrderedHash, bool disallowObjectWrite) @@ -211,6 +229,21 @@ void BfCodeGenDirectoryData::FileFailed() mFileFailed = true; } +String BfCodeGenDirectoryData::GetValue(const StringImpl& key) +{ + String* valuePtr = NULL; + if (mBuildSettings.TryGetValue(key, &valuePtr)) + { + return *valuePtr; + } + return String(); +} + +void BfCodeGenDirectoryData::SetValue(const StringImpl& key, const StringImpl& value) +{ + mBuildSettings[key] = value; +} + ////////////////////////////////////////////////////////////////////////// void BfCodeGenRequest::DbgSaveData() @@ -285,22 +318,8 @@ void BfCodeGenThread::RunLoop() #ifndef CODEGEN_DISABLE_CACHE { - AutoCrit autoCrit(mCodeGen->mCacheCritSect); - - BfCodeGenDirectoryData** dirCachePtr = NULL; - if (mCodeGen->mDirectoryCache.TryAdd(cacheDir, NULL, &dirCachePtr)) - { - dirCache = new BfCodeGenDirectoryData(); - *dirCachePtr = dirCache; - dirCache->mCodeGen = mCodeGen; - dirCache->mDirectoryName = cacheDir; - if (!mCodeGen->mDisableCacheReads) - dirCache->Read(); - } - else - { - dirCache = *dirCachePtr; - } + AutoCrit autoCrit(mCodeGen->mCacheCritSect); + dirCache = mCodeGen->GetDirCache(cacheDir); //For testing only! /*{ @@ -872,6 +891,27 @@ void BfCodeGen::WriteObjectFile(BfModule* bfModule, const StringImpl& outFileNam #endif } +String BfCodeGen::GetBuildValue(const StringImpl& buildDir, const StringImpl& key) +{ + AutoCrit autoCrit(mCacheCritSect); + BfCodeGenDirectoryData* dirCache = GetDirCache(buildDir); + return dirCache->GetValue(key); +} + +void BfCodeGen::SetBuildValue(const StringImpl& buildDir, const StringImpl & key, const StringImpl & value) +{ + AutoCrit autoCrit(mCacheCritSect); + BfCodeGenDirectoryData* dirCache = GetDirCache(buildDir); + dirCache->SetValue(key, value); +} + +void BfCodeGen::WriteBuildCache(const StringImpl& buildDir) +{ + AutoCrit autoCrit(mCacheCritSect); + BfCodeGenDirectoryData* dirCache = GetDirCache(buildDir); + dirCache->Write(); +} + void BfCodeGen::RequestComplete(BfCodeGenRequest* request) { mCompletionCount++; @@ -936,6 +976,26 @@ void BfCodeGen::ProcessErrors(BfPassInstance* passInstance, bool canceled) } } +BfCodeGenDirectoryData * BfCodeGen::GetDirCache(const StringImpl & cacheDir) +{ + BfCodeGenDirectoryData* dirCache = NULL; + BfCodeGenDirectoryData** dirCachePtr = NULL; + if (mDirectoryCache.TryAdd(cacheDir, NULL, &dirCachePtr)) + { + dirCache = new BfCodeGenDirectoryData(); + *dirCachePtr = dirCache; + dirCache->mCodeGen = this; + dirCache->mDirectoryName = cacheDir; + if (!mDisableCacheReads) + dirCache->Read(); + } + else + { + dirCache = *dirCachePtr; + } + return dirCache; +} + void BfCodeGen::Cancel() { for (auto thread : mThreads) diff --git a/IDEHelper/Compiler/BfCodeGen.h b/IDEHelper/Compiler/BfCodeGen.h index a9afa42f..6a9d89ec 100644 --- a/IDEHelper/Compiler/BfCodeGen.h +++ b/IDEHelper/Compiler/BfCodeGen.h @@ -111,6 +111,7 @@ class BfCodeGenDirectoryData public: BfCodeGen* mCodeGen; Dictionary mFileMap; + Dictionary mBuildSettings; String mDirectoryName; bool mDirty; bool mVerified; @@ -137,6 +138,8 @@ public: void SetHash(const StringImpl& fileName, Val128 hash, Val128 orderedHash, bool isObjectWrite); void ClearHash(const StringImpl& fileName); void FileFailed(); + String GetValue(const StringImpl& key); + void SetValue(const StringImpl& key, const StringImpl& value); }; class BfCodeGenFileEntry @@ -202,6 +205,7 @@ public: void ClearBuildCache(); void RequestComplete(BfCodeGenRequest* request); void ProcessErrors(BfPassInstance* passInstance, bool canceled); + BfCodeGenDirectoryData* GetDirCache(const StringImpl& cacheDir); public: BfCodeGen(); @@ -209,7 +213,10 @@ public: void ResetStats(); void UpdateStats(); - void WriteObjectFile(BfModule* module, const StringImpl& outFileName, const BfCodeGenOptions& options); + void WriteObjectFile(BfModule* module, const StringImpl& outFileName, const BfCodeGenOptions& options); + String GetBuildValue(const StringImpl& buildDir, const StringImpl& key); + void SetBuildValue(const StringImpl& buildDir, const StringImpl& key, const StringImpl& value); + void WriteBuildCache(const StringImpl& buildDir); void Cancel(); bool Finish(); }; diff --git a/IDEHelper/Compiler/BfCompiler.cpp b/IDEHelper/Compiler/BfCompiler.cpp index 42e5ecad..f99cd5d8 100644 --- a/IDEHelper/Compiler/BfCompiler.cpp +++ b/IDEHelper/Compiler/BfCompiler.cpp @@ -7790,6 +7790,23 @@ BF_EXPORT void BF_CALLTYPE BfCompiler_ClearBuildCache(BfCompiler* bfCompiler) bfCompiler->ClearBuildCache(); } +BF_EXPORT void BF_CALLTYPE BfCompiler_SetBuildValue(BfCompiler* bfCompiler, char* cacheDir, char* key, char* value) +{ + bfCompiler->mCodeGen.SetBuildValue(cacheDir, key, value); +} + +BF_EXPORT const char* BF_CALLTYPE BfCompiler_GetBuildValue(BfCompiler* bfCompiler, char* cacheDir, char* key) +{ + String& outString = *gTLStrReturn.Get(); + outString = bfCompiler->mCodeGen.GetBuildValue(cacheDir, key); + return outString.c_str(); +} + +BF_EXPORT void BF_CALLTYPE BfCompiler_WriteBuildCache(BfCompiler* bfCompiler, char* cacheDir) +{ + bfCompiler->mCodeGen.WriteBuildCache(cacheDir); +} + BF_EXPORT void BF_CALLTYPE BfCompiler_Delete(BfCompiler* bfCompiler) { delete bfCompiler; @@ -8210,3 +8227,4 @@ BF_EXPORT void BF_CALLTYPE BfCompiler_ForceRebuild(BfCompiler* bfCompiler) { bfCompiler->mOptions.mForceRebuildIdx++; } + diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index ff4ff659..c725a90b 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -10937,7 +10937,10 @@ BfModuleMethodInstance BfModule::GetMethodInstance(BfTypeInstance* typeInst, BfM { // Just leave the new items projectList.RemoveRange(0, typeProjectsCounts); - std::sort(projectList.begin(), projectList.end()); + std::sort(projectList.begin(), projectList.end(), [](BfProject* lhs, BfProject*rhs) + { + return lhs->mName < rhs->mName; + }); } else {