Skip to content

Commit d7cacff

Browse files
author
Luca Bianconi
committed
fix: update core cache correctly
1 parent 613b46a commit d7cacff

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Diff for: legacy/builder/phases/core_builder.go

+2-5
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,8 @@ func compileCore(ctx *types.Context, buildPath *paths.Path, buildCachePath *path
9595
if buildCachePath != nil {
9696
archivedCoreName := GetCachedCoreArchiveDirName(buildProperties.Get(constants.BUILD_PROPERTIES_FQBN),
9797
buildProperties.Get("compiler.optimization_flags"), realCoreFolder)
98-
targetArchivedCore = buildCachePath.Join(archivedCoreName).Join("core.a")
98+
buildcache.GetOrCreate(buildCachePath, archivedCoreName)
99+
targetArchivedCore = buildCachePath.Join(archivedCoreName, "core.a")
99100
canUseArchivedCore := !ctx.OnlyUpdateCompilationDatabase &&
100101
!ctx.Clean &&
101102
!builder_utils.CoreOrReferencedCoreHasChanged(realCoreFolder, targetCoreFolder, targetArchivedCore)
@@ -121,11 +122,7 @@ func compileCore(ctx *types.Context, buildPath *paths.Path, buildCachePath *path
121122

122123
// archive core.a
123124
if targetArchivedCore != nil && !ctx.OnlyUpdateCompilationDatabase {
124-
if err := targetArchivedCore.Parent().Mkdir(); err != nil {
125-
return nil, nil, fmt.Errorf(tr("creating core cache folder: %s", err))
126-
}
127125
err := archiveFile.CopyTo(targetArchivedCore)
128-
buildcache.GetOrCreate(targetArchivedCore.Parent().Parent(), targetArchivedCore.Parent().Base())
129126
if ctx.Verbose {
130127
if err == nil {
131128
ctx.Info(tr("Archiving built core (caching) in: %[1]s", targetArchivedCore))

0 commit comments

Comments
 (0)