Skip to content

Commit 62960f3

Browse files
committed
Reordered properties construction for clarity
1 parent 2fed55c commit 62960f3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Diff for: internal/arduino/builder/compilation.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -118,20 +118,13 @@ func (b *Builder) compileFileWithRecipe(
118118
includes []string,
119119
recipe string,
120120
) (*paths.Path, error) {
121-
properties := b.buildProperties.Clone()
122-
properties.Set("compiler.warning_flags", properties.Get("compiler.warning_flags."+b.logger.WarningsLevel()))
123-
properties.Set("includes", strings.Join(includes, " "))
124-
properties.SetPath("source_file", source)
125121
relativeSource, err := sourcePath.RelTo(source)
126122
if err != nil {
127123
return nil, err
128124
}
129125
depsFile := buildPath.Join(relativeSource.String() + ".d")
130126
objectFile := buildPath.Join(relativeSource.String() + ".o")
131-
132-
properties.SetPath("object_file", objectFile)
133-
err = objectFile.Parent().MkdirAll()
134-
if err != nil {
127+
if err := objectFile.Parent().MkdirAll(); err != nil {
135128
return nil, err
136129
}
137130

@@ -140,6 +133,11 @@ func (b *Builder) compileFileWithRecipe(
140133
return nil, err
141134
}
142135

136+
properties := b.buildProperties.Clone()
137+
properties.Set("compiler.warning_flags", properties.Get("compiler.warning_flags."+b.logger.WarningsLevel()))
138+
properties.Set("includes", strings.Join(includes, " "))
139+
properties.SetPath("source_file", source)
140+
properties.SetPath("object_file", objectFile)
143141
command, err := b.prepareCommandForRecipe(properties, recipe, false)
144142
if err != nil {
145143
return nil, err

0 commit comments

Comments
 (0)