Skip to content

Commit

Permalink
Don't scan hidden directories in arduino-builder (.git, etc.) (#366)
Browse files Browse the repository at this point in the history
* Don't scan hidden directories in arduino-builder

Arduino-builder scans the core to determine if core config files have
changed between invocations.  Unfortunately, it goes into SCCS dirs
such as .git (which can have 100,000+ files).  This is wasted effort
and can cause massive amounts of runtime and memory use when core
developers are building in their git clones.

Use a new function already added by the builder/utils.go to determine
if a file or folder is SCCS, and if so skip it in the rebuild-required
check.

Fixes arduino/arduino-builder#327

Signed-off-by: Earle F. Philhower, III <earlephilhower@yahoo.com>

* Add comment to force rebuild
  • Loading branch information
earlephilhower authored and Roberto Sora committed Sep 5, 2019
1 parent c0d3fa2 commit 3be2287
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions legacy/builder/builder_utils/utils.go
Expand Up @@ -154,11 +154,14 @@ func findAllFilesInFolder(sourcePath string, recurse bool) ([]string, error) {
}

for _, folder := range folders {
otherSources, err := findAllFilesInFolder(filepath.Join(sourcePath, folder.Name()), recurse)
if err != nil {
return nil, i18n.WrapError(err)
if !utils.IsSCCSOrHiddenFile(folder) {
// Skip SCCS directories as they do not influence the build and can be very large
otherSources, err := findAllFilesInFolder(filepath.Join(sourcePath, folder.Name()), recurse)
if err != nil {
return nil, i18n.WrapError(err)
}
sources = append(sources, otherSources...)
}
sources = append(sources, otherSources...)
}
}

Expand Down

0 comments on commit 3be2287

Please sign in to comment.