Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added ObjFileIsUpToDate method to sourceFile
  • Loading branch information
cmaglie committed Jul 14, 2025
commit eee25d119aacfbfd2fbde36ccc6ae657d349f13f
4 changes: 1 addition & 3 deletions internal/arduino/builder/internal/detector/detector.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
) error {
sourceFile := sourceFileQueue.Pop()
sourcePath := sourceFile.SourcePath
depPath := sourceFile.DepfilePath
objPath := sourceFile.ObjectPath

// TODO: This should perhaps also compare against the
// include.cache file timestamp. Now, it only checks if the file
Expand All @@ -336,7 +334,7 @@ func (l *SketchLibrariesDetector) findMissingIncludesInCompilationUnit(
// TODO: This reads the dependency file, but the actual building
// does it again. Should the result be somehow cached? Perhaps
// remove the object file if it is found to be stale?
unchanged, err := utils.ObjFileIsUpToDate(sourcePath, objPath, depPath)
unchanged, err := sourceFile.ObjFileIsUpToDate()
if err != nil {
return err
}
Expand Down
6 changes: 6 additions & 0 deletions internal/arduino/builder/internal/detector/source_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"fmt"
"slices"

"github.com/arduino/arduino-cli/internal/arduino/builder/internal/utils"
"github.com/arduino/go-paths-helper"
)

Expand Down Expand Up @@ -80,6 +81,11 @@ func makeSourceFile(sourceRoot, buildRoot, sourceFilePath *paths.Path, extraIncl
return res, nil
}

// ObjFileIsUpToDate checks if the compile object file is up to date.
func (f *sourceFile) ObjFileIsUpToDate() (unchanged bool, err error) {
return utils.ObjFileIsUpToDate(f.SourcePath, f.ObjectPath, f.DepfilePath)
}

// uniqueSourceFileQueue is a queue of source files that does not allow duplicates.
type uniqueSourceFileQueue []*sourceFile

Expand Down