From f10a4db85cc0d67561f0c75a0e2529a15da1acca Mon Sep 17 00:00:00 2001
From: Cristian Maglie <c.maglie@arduino.cc>
Date: Thu, 10 Dec 2020 01:21:03 +0100
Subject: [PATCH] Always set the versioned runtime.tool property for all
 installed tools

For example if we have bossac 1.7.1 and 1.9.0 installed, this will
result in the following properties available during upload:

{runtime.tools.bossac-1.7.0-arduino3.path} => /path/to/bossac/1.7.0
{runtime.tools.bossac-1.9.0-arduino3.path} => /path/to/bossac/1.9.0
{runtime.tools.bossac.path} => /path/to/bossac/1.9.0

some platforms fails to correctly specify the version of the tool in the
package_index.json but they do the correct specification in the recipes.
This patch allows to not fail in this latter case.
---
 commands/upload/upload.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/commands/upload/upload.go b/commands/upload/upload.go
index ae2412eff16..bd55c7ecd5d 100644
--- a/commands/upload/upload.go
+++ b/commands/upload/upload.go
@@ -213,6 +213,9 @@ func runProgramAction(pm *packagemanager.PackageManager,
 		uploadProperties.Merge(programmer.Properties)
 	}
 
+	for _, tool := range pm.GetAllInstalledToolsReleases() {
+		uploadProperties.Merge(tool.RuntimeProperties())
+	}
 	if requiredTools, err := pm.FindToolsRequiredForBoard(board); err == nil {
 		for _, requiredTool := range requiredTools {
 			logrus.WithField("tool", requiredTool).Info("Tool required for upload")