Skip to content
Merged
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ import (
"arduino.cc/builder/utils"
"os"
"path/filepath"
"regexp"
)

type WipeoutBuildPathIfBuildOptionsChanged struct{}
Expand All @@ -44,7 +45,6 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(context map[string]interface
if !utils.MapHas(context, constants.CTX_BUILD_OPTIONS_PREVIOUS_JSON) {
return nil
}

buildOptionsJson := context[constants.CTX_BUILD_OPTIONS_JSON].(string)
previousBuildOptionsJson := context[constants.CTX_BUILD_OPTIONS_PREVIOUS_JSON].(string)
logger := context[constants.CTX_LOGGER].(i18n.Logger)
Expand All @@ -53,6 +53,15 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(context map[string]interface
return nil
}

re := regexp.MustCompile("(?m)^.*" + constants.CTX_SKETCH_LOCATION + ".*$[\r\n]+")
buildOptionsJson = re.ReplaceAllString(buildOptionsJson, "")
previousBuildOptionsJson = re.ReplaceAllString(previousBuildOptionsJson, "")

// if the only difference is the sketch path skip deleting everything
if buildOptionsJson == previousBuildOptionsJson {
return nil
}

logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_BUILD_OPTIONS_CHANGED)

buildPath := context[constants.CTX_BUILD_PATH].(string)
Expand Down