Skip to content

Commit aec990d

Browse files
committed
Made wipe() a proper method -> Buidler.wipeBuildPath()
1 parent cb5f4e7 commit aec990d

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

arduino/builder/build_options_manager.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,21 @@ func (b *Builder) createBuildOptionsJSON() error {
106106
}
107107

108108
func (b *Builder) wipeBuildPath() error {
109-
wipe := func() error {
110-
// FIXME: this should go outside legacy and behind a `logrus` call so users can
111-
// control when this should be printed.
112-
// logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED + constants.MSG_REBUILD_ALL)
113-
if err := b.buildOptions.buildPath.RemoveAll(); err != nil {
114-
return errors.WithMessage(err, tr("cleaning build path"))
115-
}
116-
if err := b.buildOptions.buildPath.MkdirAll(); err != nil {
117-
return errors.WithMessage(err, tr("cleaning build path"))
118-
}
119-
return nil
109+
// FIXME: this should go outside legacy and behind a `logrus` call so users can
110+
// control when this should be printed.
111+
// logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED + constants.MSG_REBUILD_ALL)
112+
if err := b.buildOptions.buildPath.RemoveAll(); err != nil {
113+
return errors.WithMessage(err, tr("cleaning build path"))
120114
}
115+
if err := b.buildOptions.buildPath.MkdirAll(); err != nil {
116+
return errors.WithMessage(err, tr("cleaning build path"))
117+
}
118+
return nil
119+
}
121120

121+
func (b *Builder) wipeBuildPathIfBuildOptionsChanged() error {
122122
if b.buildOptions.clean {
123-
return wipe()
123+
return b.wipeBuildPath()
124124
}
125125

126126
// Load previous build options map
@@ -140,7 +140,7 @@ func (b *Builder) wipeBuildPath() error {
140140
var prevOpts *properties.Map
141141
if err := json.Unmarshal(buildOptionsJSONPrevious, &prevOpts); err != nil || prevOpts == nil {
142142
b.logger.Info(tr("%[1]s invalid, rebuilding all", "build.options.json"))
143-
return wipe()
143+
return b.wipeBuildPath()
144144
}
145145

146146
// Since we might apply a side effect we clone it
@@ -169,5 +169,5 @@ func (b *Builder) wipeBuildPath() error {
169169
}
170170
}
171171

172-
return wipe()
172+
return b.wipeBuildPath()
173173
}

arduino/builder/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func (b *Builder) preprocess() error {
249249
return err
250250
}
251251

252-
if err := b.wipeBuildPath(); err != nil {
252+
if err := b.wipeBuildPathIfBuildOptionsChanged(); err != nil {
253253
return err
254254
}
255255
if err := b.createBuildOptionsJSON(); err != nil {

0 commit comments

Comments
 (0)