Skip to content

Commit 1fe73d8

Browse files
committed
Factored tools runtime properties generation
1 parent 5ea3897 commit 1fe73d8

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

arduino/cores/packagemanager/package_manager.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,16 @@ func (pme *Explorer) ResolveFQBN(fqbn *cores.FQBN) (
321321
buildProperties.Merge(platformRelease.RuntimeProperties())
322322
buildProperties.SetPath("build.core.path", buildPlatformRelease.InstallDir.Join("cores", coreParts[0]))
323323
buildProperties.SetPath("build.system.path", buildPlatformRelease.InstallDir.Join("system"))
324+
for _, tool := range pme.GetAllInstalledToolsReleases() {
325+
buildProperties.Merge(tool.RuntimeProperties())
326+
}
327+
requiredTools, err := pme.FindToolsRequiredForBuild(platformRelease, buildPlatformRelease)
328+
if err != nil {
329+
return targetPackage, platformRelease, board, buildProperties, buildPlatformRelease, err
330+
}
331+
for _, tool := range requiredTools {
332+
buildProperties.Merge(tool.RuntimeProperties())
333+
}
324334

325335
// No errors... phew!
326336
return targetPackage, platformRelease, board, buildProperties, buildPlatformRelease, nil

commands/upload/upload.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -292,20 +292,6 @@ func runProgramAction(pme *packagemanager.Explorer,
292292
uploadProperties.Merge(programmer.Properties)
293293
}
294294

295-
for _, tool := range pme.GetAllInstalledToolsReleases() {
296-
uploadProperties.Merge(tool.RuntimeProperties())
297-
}
298-
if requiredTools, err := pme.FindToolsRequiredForBuild(boardPlatform, buildPlatform); err == nil {
299-
for _, requiredTool := range requiredTools {
300-
logrus.WithField("tool", requiredTool).Info("Tool required for upload")
301-
if requiredTool.IsInstalled() {
302-
uploadProperties.Merge(requiredTool.RuntimeProperties())
303-
} else {
304-
errStream.Write([]byte(tr("Warning: tool '%s' is not installed. It might not be available for your OS.", requiredTool)))
305-
}
306-
}
307-
}
308-
309295
// Certain tools require the user to provide custom fields at run time,
310296
// if they've been provided set them
311297
// For more info:

legacy/builder/setup_build_properties.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,6 @@ func (s *SetupBuildProperties) Run(ctx *types.Context) error {
9090
buildProperties.SetPath("build.variant.path", variantPlatformRelease.InstallDir.Join("variants", variant))
9191
}
9292

93-
for _, tool := range ctx.AllTools {
94-
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+".path", tool.InstallDir)
95-
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+"-"+tool.Version.String()+".path", tool.InstallDir)
96-
}
97-
for _, tool := range ctx.RequiredTools {
98-
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+".path", tool.InstallDir)
99-
buildProperties.SetPath("runtime.tools."+tool.Tool.Name+"-"+tool.Version.String()+".path", tool.InstallDir)
100-
}
101-
10293
if !buildProperties.ContainsKey("software") {
10394
buildProperties.Set("software", DEFAULT_SOFTWARE)
10495
}

0 commit comments

Comments
 (0)