Commit a900cfb2 authored by Cristian Maglie's avatar Cristian Maglie

Fixed compile regression (#1867)

parent c2af7c5a
......@@ -50,11 +50,10 @@ func (s *HardwareLoader) Run(ctx *types.Context) error {
pm := pmb.Build()
pme, _ /* never release... */ := pm.NewExplorer()
ctx.AllTools = pme.GetAllInstalledToolsReleases()
ctx.PackageManager = pme
}
ctx.AllTools = ctx.PackageManager.GetAllInstalledToolsReleases()
ctx.Hardware = ctx.PackageManager.GetPackages()
return nil
}
......@@ -20,6 +20,7 @@ import (
"testing"
"github.com/arduino/arduino-cli/arduino/cores"
"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
"github.com/arduino/arduino-cli/legacy/builder"
"github.com/arduino/arduino-cli/legacy/builder/types"
paths "github.com/arduino/go-paths-helper"
......@@ -179,3 +180,20 @@ func TestLoadLotsOfTools(t *testing.T) {
require.Equal(t, "arduino:openocd@0.9.0-arduino", tools[idx].String())
requireEquivalentPaths(t, tools[idx].InstallDir.String(), "downloaded_board_manager_stuff/arduino/tools/openocd/0.9.0-arduino")
}
func TestAllToolsContextIsPopulated(t *testing.T) {
pmb := packagemanager.NewBuilder(nil, nil, nil, nil, "")
pmb.LoadHardwareFromDirectories(paths.NewPathList("downloaded_board_manager_stuff"))
pmb.LoadToolsFromBundleDirectory(paths.New("downloaded_tools", "tools_builtin"))
pm := pmb.Build()
pme, release := pm.NewExplorer()
defer release()
ctx := &types.Context{
PackageManager: pme,
}
hl := &builder.HardwareLoader{}
require.NoError(t, hl.Run(ctx))
require.NotEmpty(t, ctx.AllTools)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment