Skip to content

Commit

Permalink
Fixed wrong tool selection if many packagers provides it
Browse files Browse the repository at this point in the history
Fix #73
  • Loading branch information
cmaglie committed Oct 31, 2018
1 parent 7796f0b commit 924dfbc
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions arduino/cores/packagemanager/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,8 +355,9 @@ func (pm *PackageManager) GetAllInstalledToolsReleases() []*cores.ToolRelease {
}

func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*cores.ToolRelease, error) {
// core := board.Properties["build.core"]
pm.Log.Infof("Searching tools required for board %s", board)

// core := board.Properties["build.core"]
platform := board.PlatformRelease

// maps "PACKAGER:TOOL" => ToolRelease
Expand All @@ -368,18 +369,19 @@ func (pm *PackageManager) FindToolsRequiredForBoard(board *cores.Board) ([]*core
for _, tool := range targetPackage.Tools {
rel := tool.GetLatestInstalled()
if rel != nil {
foundTools[rel.Tool.String()] = rel
foundTools[rel.Tool.Name] = rel
}
}
}

// replace the default tools above with the specific required by the current platform
for _, toolDep := range platform.Dependencies {
pm.Log.WithField("tool", toolDep).Infof("Required tool")
tool := pm.FindToolDependency(toolDep)
if tool == nil {
return nil, fmt.Errorf("tool release not found: %s", toolDep)
}
foundTools[tool.Tool.String()] = tool
foundTools[tool.Tool.Name] = tool
}

requiredTools := []*cores.ToolRelease{}
Expand Down

0 comments on commit 924dfbc

Please sign in to comment.