From ca89e26664a64000513f024dbac80ff99c712229 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 3 Oct 2024 16:54:37 +0200 Subject: [PATCH] Preload all source headers before writing the lib cache --- .../arduino/libraries/librariesmanager/librariesmanager.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/arduino/libraries/librariesmanager/librariesmanager.go b/internal/arduino/libraries/librariesmanager/librariesmanager.go index 8406e179011..b4b7c43f54e 100644 --- a/internal/arduino/libraries/librariesmanager/librariesmanager.go +++ b/internal/arduino/libraries/librariesmanager/librariesmanager.go @@ -251,6 +251,11 @@ func (lm *LibrariesManager) loadLibrariesFromDir(librariesDir *LibrariesDir) []* s := status.Newf(codes.FailedPrecondition, "creating lib cache %[1]s: %[2]s", cacheFilePath, err) return append(statuses, s) } + // Preload source files and header + for _, lib := range loadedLibs { + lib.SourceHeaders() + } + // Write the cache err = loadedLibs.MarshalBinary(cache, librariesDir.Path) cache.Close() if err != nil {