Skip to content

Commit 0c64d15

Browse files
Add appendIncludeFolder helper function
This helper does not do much, but it will be expanded in a later commit. Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
1 parent 87f3397 commit 0c64d15

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/arduino.cc/builder/container_find_includes.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ import (
4242
type ContainerFindIncludes struct{}
4343

4444
func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
45-
ctx.IncludeFolders = append(ctx.IncludeFolders, ctx.BuildProperties[constants.BUILD_PROPERTIES_BUILD_CORE_PATH])
45+
appendIncludeFolder(ctx, ctx.BuildProperties[constants.BUILD_PROPERTIES_BUILD_CORE_PATH])
4646
if ctx.BuildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT_PATH] != constants.EMPTY_STRING {
47-
ctx.IncludeFolders = append(ctx.IncludeFolders, ctx.BuildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT_PATH])
47+
appendIncludeFolder(ctx, ctx.BuildProperties[constants.BUILD_PROPERTIES_BUILD_VARIANT_PATH])
4848
}
4949

5050
sketchBuildPath := ctx.SketchBuildPath
@@ -73,6 +73,11 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
7373
return nil
7474
}
7575

76+
// Append the given folder to the include path.
77+
func appendIncludeFolder(ctx *types.Context, folder string) {
78+
ctx.IncludeFolders = append(ctx.IncludeFolders, folder)
79+
}
80+
7681
func runCommand(ctx *types.Context, command types.Command) error {
7782
PrintRingNameIfDebug(ctx, command)
7883
err := command.Run(ctx)
@@ -111,7 +116,7 @@ func findIncludesUntilDone(ctx *types.Context, sourceFilePath string) error {
111116
// include path and queue its source files for further
112117
// include scanning
113118
ctx.ImportedLibraries = append(ctx.ImportedLibraries, library)
114-
ctx.IncludeFolders = append(ctx.IncludeFolders, library.SrcFolder)
119+
appendIncludeFolder(ctx, library.SrcFolder)
115120
sourceFolders := types.LibraryToSourceFolder(library)
116121
for _, sourceFolder := range sourceFolders {
117122
queueSourceFilesFromFolder(ctx.CollectedSourceFiles, sourceFolder.Folder, sourceFolder.Recurse)

0 commit comments

Comments
 (0)