From ff7f0d1e4c85fcb004c107c07b94c48dd66f6497 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Fri, 30 Aug 2019 23:07:30 +0000 Subject: [PATCH 1/2] 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 https://github.com/arduino/arduino-builder/issues/327 Signed-off-by: Earle F. Philhower, III --- legacy/builder/builder_utils/utils.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/legacy/builder/builder_utils/utils.go b/legacy/builder/builder_utils/utils.go index 337b82be780..0a5c98035c6 100644 --- a/legacy/builder/builder_utils/utils.go +++ b/legacy/builder/builder_utils/utils.go @@ -154,11 +154,13 @@ 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) { + 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...) } } From ca843a7565d1faf6b16635a6e778b73753a0ab48 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 2 Sep 2019 15:56:12 +0000 Subject: [PATCH 2/2] Add comment to force rebuild --- legacy/builder/builder_utils/utils.go | 1 + 1 file changed, 1 insertion(+) diff --git a/legacy/builder/builder_utils/utils.go b/legacy/builder/builder_utils/utils.go index 0a5c98035c6..86299560597 100644 --- a/legacy/builder/builder_utils/utils.go +++ b/legacy/builder/builder_utils/utils.go @@ -155,6 +155,7 @@ func findAllFilesInFolder(sourcePath string, recurse bool) ([]string, error) { for _, folder := range folders { 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)