8000 check whether prevOpts is nil in WipeoutBuildPathIfBuildOptionsChanged's Run by d-a-v · Pull Request #1118 · arduino/arduino-cli · GitHub
[go: up one dir, main page]

Skip to content

check whether prevOpts is nil in WipeoutBuildPathIfBuildOptionsChanged's Run #1118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
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
+ debug message
  • Loading branch information
d-a-v authored and silvanocerza committed May 10, 2021
commit fa9f4f639647a65477966bda0938b809acb2c906
1 change: 1 addition & 0 deletions legacy/builder/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const MSG_USING_CACHED_INCLUDES = "Using cached library dependencies for file: {
const MSG_WARNING_LIB_INVALID_CATEGORY = "WARNING: Category '{0}' in library {1} is not valid. Setting to '{2}'"
const MSG_WARNING_PLATFORM_OLD_VALUES = "Warning: platform.txt from core '{0}' contains deprecated {1}, automatically converted to {2}. Consider upgrading this core."
const MSG_WARNING_SPURIOUS_FILE_IN_LIB = "WARNING: Spurious {0} folder in '{1}' library"
const MSG_INVESTIGATE = " (unusual state to investigate)"
const PACKAGE_NAME = "name"
const PACKAGE_TOOLS = "tools"
const PLATFORM_ARCHITECTURE = "architecture"
Expand Down
9 changes: 7 additions & 2 deletions legacy/builder/wipeout_build_path_if_build_options_changed.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,19 @@ func (s *WipeoutBuildPathIfBuildOptionsChanged) Run(ctx *types.Context) error {
json.Unmarshal([]byte(buildOptionsJson), &opts)
json.Unmarshal([]byte(previousBuildOptionsJson), &prevOpts)

if prevOpts == nil {
ctx.GetLogger().Println(constants.LOG_LEVEL_DEBUG, constants.MSG_BUILD_OPTIONS_CHANGED + constants.MSG_INVESTIGATE);
return doCleanup(ctx.BuildPath)
}

// If SketchLocation path is different but filename is the same, consider it equal
if prevOpts != nil && filepath.Base(opts.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
if filepath.Base(opts.Get("sketchLocation")) == filepath.Base(prevOpts.Get("sketchLocation")) {
opts.Remove("sketchLocation")
prevOpts.Remove("sketchLocation")
}

// If options are not changed check if core has
if prevOpts != nil && opts.Equals(prevOpts) {
if opts.Equals(prevOpts) {
// check if any of the files contained in the core folders has changed
// since the json was generated - like platform.txt or similar
// if so, trigger a "safety" wipe
Expand Down
0