Skip to content
Merged
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
Reordered properties construction for clarity
  • Loading branch information
cmaglie committed Jul 14, 2025
commit d0d41738ac8f58f18ca577b21d975a31e49c1a5c
14 changes: 6 additions & 8 deletions internal/arduino/builder/compilation.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,13 @@ func (b *Builder) compileFileWithRecipe(
includes []string,
recipe string,
) (*paths.Path, error) {
properties := b.buildProperties.Clone()
properties.Set("compiler.warning_flags", properties.Get("compiler.warning_flags."+b.logger.WarningsLevel()))
properties.Set("includes", strings.Join(includes, " "))
properties.SetPath("source_file", source)
relativeSource, err := sourcePath.RelTo(source)
if err != nil {
return nil, err
}
depsFile := buildPath.Join(relativeSource.String() + ".d")
objectFile := buildPath.Join(relativeSource.String() + ".o")

properties.SetPath("object_file", objectFile)
err = objectFile.Parent().MkdirAll()
if err != nil {
if err := objectFile.Parent().MkdirAll(); err != nil {
return nil, err
}

Expand All @@ -141,6 +134,11 @@ func (b *Builder) compileFileWithRecipe(
return nil, err
}

properties := b.buildProperties.Clone()
properties.Set("compiler.warning_flags", properties.Get("compiler.warning_flags."+b.logger.WarningsLevel()))
properties.Set("includes", strings.Join(includes, " "))
properties.SetPath("source_file", source)
properties.SetPath("object_file", objectFile)
command, err := b.prepareCommandForRecipe(properties, recipe, false)
if err != nil {
return nil, err
Expand Down