Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0616fae

Browse files
committedApr 15, 2023
Removed legacy HardwareLoader
1 parent f47a7bf commit 0616fae

7 files changed

+8
-79
lines changed
 

‎legacy/builder/container_setup.go

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ func (s *ContainerSetupHardwareToolsLibsSketchAndProps) Run(ctx *types.Context)
3030
commands := []types.Command{
3131
&AddAdditionalEntriesToContext{},
3232
&FailIfBuildPathEqualsSketchPath{},
33-
&HardwareLoader{},
3433
&LibrariesLoader{},
3534
}
3635

‎legacy/builder/hardware_loader.go

-28
This file was deleted.

‎legacy/builder/test/hardware_loader_test.go

+4-29
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,7 @@ func TestLoadHardware(t *testing.T) {
3636
}
3737
ctx = prepareBuilderTestContext(t, ctx, nil, "")
3838

39-
commands := []types.Command{
40-
&builder.HardwareLoader{},
41-
}
42-
for _, command := range commands {
43-
err := command.Run(ctx)
44-
NoError(t, err)
45-
}
46-
47-
packages := ctx.Hardware
39+
packages := ctx.PackageManager.GetPackages()
4840
require.Equal(t, 1, len(packages))
4941
require.NotNil(t, packages["arduino"])
5042
require.Equal(t, 2, len(packages["arduino"].Platforms))
@@ -77,14 +69,13 @@ func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) {
7769

7870
commands := []types.Command{
7971
&builder.AddAdditionalEntriesToContext{},
80-
&builder.HardwareLoader{},
8172
}
8273
for _, command := range commands {
8374
err := command.Run(ctx)
8475
NoError(t, err)
8576
}
8677

87-
packages := ctx.Hardware
78+
packages := ctx.PackageManager.GetPackages()
8879

8980
if runtime.GOOS == "windows" {
9081
//a package is a symlink, and windows does not support them
@@ -143,15 +134,7 @@ func TestLoadHardwareWithBoardManagerFolderStructure(t *testing.T) {
143134
}
144135
ctx = prepareBuilderTestContext(t, ctx, nil, "")
145136

146-
commands := []types.Command{
147-
&builder.HardwareLoader{},
148-
}
149-
for _, command := range commands {
150-
err := command.Run(ctx)
151-
NoError(t, err)
152-
}
153-
154-
packages := ctx.Hardware
137+
packages := ctx.PackageManager.GetPackages()
155138
require.Equal(t, 3, len(packages))
156139
require.NotNil(t, packages["arduino"])
157140
require.Equal(t, 1, len(packages["arduino"].Platforms))
@@ -191,15 +174,7 @@ func TestLoadLotsOfHardware(t *testing.T) {
191174
}
192175
ctx = prepareBuilderTestContext(t, ctx, nil, "")
193176

194-
commands := []types.Command{
195-
&builder.HardwareLoader{},
196-
}
197-
for _, command := range commands {
198-
err := command.Run(ctx)
199-
NoError(t, err)
200-
}
201-
202-
packages := ctx.Hardware
177+
packages := ctx.PackageManager.GetPackages()
203178

204179
if runtime.GOOS == "windows" {
205180
//a package is a symlink, and windows does not support them

‎legacy/builder/test/libraries_loader_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func TestLoadLibrariesAVR(t *testing.T) {
4848

4949
commands := []types.Command{
5050
&builder.AddAdditionalEntriesToContext{},
51-
&builder.HardwareLoader{},
5251
&builder.LibrariesLoader{},
5352
}
5453
for _, command := range commands {
@@ -154,7 +153,6 @@ func TestLoadLibrariesSAM(t *testing.T) {
154153

155154
commands := []types.Command{
156155
&builder.AddAdditionalEntriesToContext{},
157-
&builder.HardwareLoader{},
158156
&builder.LibrariesLoader{},
159157
}
160158
for _, command := range commands {
@@ -257,7 +255,6 @@ func TestLoadLibrariesMyAVRPlatform(t *testing.T) {
257255

258256
commands := []types.Command{
259257
&builder.AddAdditionalEntriesToContext{},
260-
&builder.HardwareLoader{},
261258
&builder.LibrariesLoader{},
262259
}
263260
for _, command := range commands {

‎legacy/builder/test/setup_build_properties_test.go

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ func TestSetupBuildProperties(t *testing.T) {
3636

3737
commands := []types.Command{
3838
&builder.AddAdditionalEntriesToContext{},
39-
&builder.HardwareLoader{},
4039
&builder.SetupBuildProperties{},
4140
}
4241
for _, command := range commands {
@@ -95,7 +94,6 @@ func TestSetupBuildPropertiesWithSomeCustomOverrides(t *testing.T) {
9594

9695
commands := []types.Command{
9796
&builder.AddAdditionalEntriesToContext{},
98-
&builder.HardwareLoader{},
9997
&builder.SetupBuildProperties{},
10098
&builder.SetCustomBuildProperties{},
10199
}
@@ -126,7 +124,6 @@ func TestSetupBuildPropertiesUserHardware(t *testing.T) {
126124

127125
commands := []types.Command{
128126
&builder.AddAdditionalEntriesToContext{},
129-
&builder.HardwareLoader{},
130127
&builder.SetupBuildProperties{},
131128
}
132129
for _, command := range commands {

‎legacy/builder/test/tools_loader_test.go

+4-13
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121

2222
"github.com/arduino/arduino-cli/arduino/cores"
2323
"github.com/arduino/arduino-cli/arduino/cores/packagemanager"
24-
"github.com/arduino/arduino-cli/legacy/builder"
2524
"github.com/arduino/arduino-cli/legacy/builder/types"
2625
paths "github.com/arduino/go-paths-helper"
2726
"github.com/stretchr/testify/require"
@@ -67,9 +66,7 @@ func TestLoadTools(t *testing.T) {
6766
}
6867
ctx = prepareBuilderTestContext(t, ctx, nil, "")
6968

70-
NoError(t, (&builder.HardwareLoader{}).Run(ctx))
71-
72-
tools := ctx.AllTools
69+
tools := ctx.PackageManager.GetAllInstalledToolsReleases()
7370
require.Equal(t, 9, len(tools))
7471

7572
sort.Sort(ByToolIDAndVersion(tools))
@@ -109,9 +106,7 @@ func TestLoadToolsWithBoardManagerFolderStructure(t *testing.T) {
109106
}
110107
ctx = prepareBuilderTestContext(t, ctx, nil, "")
111108

112-
NoError(t, (&builder.HardwareLoader{}).Run(ctx))
113-
114-
tools := ctx.AllTools
109+
tools := ctx.PackageManager.GetAllInstalledToolsReleases()
115110
require.Equal(t, 3, len(tools))
116111

117112
sort.Sort(ByToolIDAndVersion(tools))
@@ -134,9 +129,7 @@ func TestLoadLotsOfTools(t *testing.T) {
134129
}
135130
ctx = prepareBuilderTestContext(t, ctx, nil, "")
136131

137-
NoError(t, (&builder.HardwareLoader{}).Run(ctx))
138-
139-
tools := ctx.AllTools
132+
tools := ctx.PackageManager.GetAllInstalledToolsReleases()
140133
require.Equal(t, 12, len(tools))
141134

142135
sort.Sort(ByToolIDAndVersion(tools))
@@ -191,7 +184,5 @@ func TestAllToolsContextIsPopulated(t *testing.T) {
191184
PackageManager: pme,
192185
}
193186

194-
hl := &builder.HardwareLoader{}
195-
require.NoError(t, hl.Run(ctx))
196-
require.NotEmpty(t, ctx.AllTools)
187+
require.NotEmpty(t, ctx.PackageManager.GetAllInstalledToolsReleases())
197188
}

‎legacy/builder/types/context.go

-2
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ type Context struct {
7979
BuildOptionsJsonPrevious string
8080

8181
PackageManager *packagemanager.Explorer
82-
Hardware cores.Packages
83-
AllTools []*cores.ToolRelease
8482
RequiredTools []*cores.ToolRelease
8583
TargetBoard *cores.Board
8684
TargetBoardBuildProperties *properties.Map

0 commit comments

Comments
 (0)
Please sign in to comment.