Skip to content

Commit 2444448

Browse files
facchinmcmaglie
authored andcommitted
Recreate the archive if ANY of the core files (including platform.txt) has changed
1 parent 1b629fd commit 2444448

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

src/arduino.cc/builder/phases/core_builder.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,11 @@ func compileCore(buildPath string, buildProperties properties.Map, verbose bool,
8484
}
8585
}
8686

87+
// Recreate the archive if ANY of the core files (including platform.txt) has changed
88+
realCoreFolder := utils.GetParentFolder(coreFolder, 2)
89+
8790
targetArchivedCore := builder_utils.GetCoreArchivePath(buildProperties[constants.BUILD_PROPERTIES_FQBN])
88-
noNeedToRecompile := builder_utils.CheckIfRecompileIsAvoidable(coreFolder, targetArchivedCore)
91+
noNeedToRecompile := builder_utils.CheckIfRecompileIsAvoidable(realCoreFolder, targetArchivedCore)
8992

9093
if noNeedToRecompile {
9194
// use archived core

src/arduino.cc/builder/utils/utils.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,16 @@ func FindFilesInFolder(files *[]string, folder string, extensions CheckExtension
365365
return gohasissues.Walk(folder, walkFunc)
366366
}
367367

368+
func GetParentFolder(basefolder string, n int) string {
369+
tempFolder := basefolder
370+
i := 0
371+
for i < n {
372+
tempFolder = filepath.Dir(tempFolder)
373+
i++
374+
}
375+
return tempFolder
376+
}
377+
368378
func AppendIfNotPresent(target []string, elements ...string) []string {
369379
for _, element := range elements {
370380
if !SliceContains(target, element) {

0 commit comments

Comments
 (0)