Skip to content

Commit eee25d1

Browse files
committed
Added ObjFileIsUpToDate method to sourceFile
1 parent ba8b764 commit eee25d1

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

internal/arduino/builder/internal/detector/detector.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,6 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
321321
) error {
322322
sourceFile := sourceFileQueue.Pop()
323323
sourcePath := sourceFile.SourcePath
324-
depPath := sourceFile.DepfilePath
325-
objPath := sourceFile.ObjectPath
326324

327325
// TODO: This should perhaps also compare against the
328326
// include.cache file timestamp. Now, it only checks if the file
@@ -336,7 +334,7 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
336334
// TODO: This reads the dependency file, but the actual building
337335
// does it again. Should the result be somehow cached? Perhaps
338336
// remove the object file if it is found to be stale?
339-
unchanged, err := utils.ObjFileIsUpToDate(sourcePath, objPath, depPath)
337+
unchanged, err := sourceFile.ObjFileIsUpToDate()
340338
if err != nil {
341339
return err
342340
}

internal/arduino/builder/internal/detector/source_file.go

Lines changed: 6 additions & 0 deletions
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 (f *sourceFile) ObjFileIsUpToDate() (unchanged bool, err error) {
86+
return utils.ObjFileIsUpToDate(f.SourcePath, f.ObjectPath, f.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)