Skip to content

Commit 944d076

Browse files
committed
Added ObjFileIsUpToDate method to sourceFile
1 parent b126a73 commit 944d076

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Diff for: internal/arduino/builder/internal/detector/detector.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,6 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
293293
) error {
294294
sourceFile := sourceFileQueue.Pop()
295295
sourcePath := sourceFile.SourcePath
296-
depPath := sourceFile.DepfilePath
297-
objPath := sourceFile.ObjectPath
298296

299297
// TODO: This should perhaps also compare against the
300298
// include.cache file timestamp. Now, it only checks if the file
@@ -308,7 +306,7 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
308306
// TODO: This reads the dependency file, but the actual building
309307
// does it again. Should the result be somehow cached? Perhaps
310308
// remove the object file if it is found to be stale?
311-
unchanged, err := utils.ObjFileIsUpToDate(sourcePath, objPath, depPath)
309+
unchanged, err := sourceFile.ObjFileIsUpToDate()
312310
if err != nil {
313311
return err
314312
}

Diff for: internal/arduino/builder/internal/detector/source_file.go

+6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"fmt"
2020
"slices"
2121

22+
"github.com/arduino/arduino-cli/internal/arduino/builder/internal/utils"
2223
"github.com/arduino/go-paths-helper"
2324
)
2425

@@ -80,6 +81,11 @@ func makeSourceFile(sourceRoot, buildRoot, sourceFilePath *paths.Path, extraIncl
8081
return res, nil
8182
}
8283

84+
// ObjFileIsUpToDate checks if the compile object file is up to date.
85+
func (s *sourceFile) ObjFileIsUpToDate() (unchanged bool, err error) {
86+
return utils.ObjFileIsUpToDate(s.SourcePath, s.ObjectPath, s.DepfilePath)
87+
}
88+
8389
// uniqueSourceFileQueue is a queue of source files that does not allow duplicates.
8490
type uniqueSourceFileQueue []*sourceFile
8591

0 commit comments

Comments
 (0)