Skip to content

Commit 3a08c41

Browse files
Call findIncludesUntilDone from only one place
Previously, it was called once for the main cpp file, and then in a loop for any extra source files from the sketch or dependent libraries. However, this can be simplified by just adding the main .cpp file to the queue, and then letting the loop handle it. This produces a tiny change in the order in which source files are processed for includes, but any setups affected by this are already prone to errors. Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
1 parent 85de69a commit 3a08c41

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/arduino.cc/builder/container_find_includes.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
4949

5050
sketchBuildPath := ctx.SketchBuildPath
5151
sketch := ctx.Sketch
52-
err := findIncludesUntilDone(ctx, filepath.Join(sketchBuildPath, filepath.Base(sketch.MainFile.Name)+".cpp"))
53-
if err != nil {
54-
return i18n.WrapError(err)
55-
}
52+
ctx.CollectedSourceFiles.Push(filepath.Join(sketchBuildPath, filepath.Base(sketch.MainFile.Name)+".cpp"))
5653

5754
foldersWithSources := ctx.FoldersWithSourceFiles
5855
foldersWithSources.Push(types.SourceFolder{Folder: ctx.SketchBuildPath, Recurse: false})
@@ -61,7 +58,7 @@ func (s *ContainerFindIncludes) Run(ctx *types.Context) error {
6158
foldersWithSources.Push(types.SourceFolder{Folder: srcSubfolderPath, Recurse: true})
6259
}
6360

64-
err = runCommand(ctx, &CollectAllSourceFilesFromFoldersWithSources{})
61+
err := runCommand(ctx, &CollectAllSourceFilesFromFoldersWithSources{})
6562
if err != nil {
6663
return i18n.WrapError(err)
6764
}

0 commit comments

Comments
 (0)