@@ -35,12 +35,14 @@ import (
35
35
"strconv"
36
36
"time"
37
37
38
+ bldr "github.com/arduino/arduino-cli/arduino/builder"
38
39
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
39
40
"github.com/arduino/arduino-cli/legacy/builder/constants"
40
41
"github.com/arduino/arduino-cli/legacy/builder/i18n"
41
42
"github.com/arduino/arduino-cli/legacy/builder/phases"
42
43
"github.com/arduino/arduino-cli/legacy/builder/types"
43
44
"github.com/arduino/arduino-cli/legacy/builder/utils"
45
+ "github.com/arduino/go-paths-helper"
44
46
)
45
47
46
48
var MAIN_FILE_VALID_EXTENSIONS = map [string ]bool {".ino" : true , ".pde" : true }
@@ -54,10 +56,15 @@ const DEFAULT_SOFTWARE = "ARDUINO"
54
56
type Builder struct {}
55
57
56
58
func (s * Builder ) Run (ctx * types.Context ) error {
57
- commands := []types.Command {
58
- & GenerateBuildPathIfMissing {},
59
- & EnsureBuildPathExists {},
59
+ if ctx .BuildPath == nil {
60
+ ctx .BuildPath = paths .New (bldr .GenBuildPath (ctx .SketchLocation .String ()))
61
+ }
62
+
63
+ if err := bldr .EnsureBuildPathExists (ctx .BuildPath .String ()); err != nil {
64
+ return err
65
+ }
60
66
67
+ commands := []types.Command {
61
68
& ContainerSetupHardwareToolsLibsSketchAndProps {},
62
69
63
70
& ContainerBuildOptions {},
@@ -141,10 +148,15 @@ func (s *PreprocessSketch) Run(ctx *types.Context) error {
141
148
type Preprocess struct {}
142
149
143
150
func (s * Preprocess ) Run (ctx * types.Context ) error {
144
- commands := []types. Command {
145
- & GenerateBuildPathIfMissing {},
146
- & EnsureBuildPathExists {},
151
+ if ctx . BuildPath == nil {
152
+ ctx . BuildPath = paths . New ( bldr . GenBuildPath ( ctx . SketchLocation . String ()))
153
+ }
147
154
155
+ if err := bldr .EnsureBuildPathExists (ctx .BuildPath .String ()); err != nil {
156
+ return err
157
+ }
158
+
159
+ commands := []types.Command {
148
160
& ContainerSetupHardwareToolsLibsSketchAndProps {},
149
161
150
162
& ContainerBuildOptions {},
@@ -168,9 +180,11 @@ func (s *Preprocess) Run(ctx *types.Context) error {
168
180
type ParseHardwareAndDumpBuildProperties struct {}
169
181
170
182
func (s * ParseHardwareAndDumpBuildProperties ) Run (ctx * types.Context ) error {
171
- commands := []types.Command {
172
- & GenerateBuildPathIfMissing {},
183
+ if ctx .BuildPath == nil {
184
+ ctx .BuildPath = paths .New (bldr .GenBuildPath (ctx .SketchLocation .String ()))
185
+ }
173
186
187
+ commands := []types.Command {
174
188
& ContainerSetupHardwareToolsLibsSketchAndProps {},
175
189
176
190
& DumpBuildProperties {},
0 commit comments