@@ -26,7 +26,6 @@ import (
26
26
"strings"
27
27
"testing"
28
28
29
- "github.com/arduino/arduino-cli/legacy/builder/constants"
30
29
"github.com/arduino/go-paths-helper"
31
30
"github.com/arduino/go-properties-orderedmap"
32
31
"github.com/pkg/errors"
@@ -264,12 +263,12 @@ func findCoreUrl(index map[string]interface{}, core Core) (string, error) {
264
263
packages := index ["packages" ].([]interface {})
265
264
for _ , p := range packages {
266
265
pack := p .(map [string ]interface {})
267
- if pack [constants . PACKAGE_NAME ].(string ) == core .Maintainer {
266
+ if pack ["name" ].(string ) == core .Maintainer {
268
267
packagePlatforms := pack ["platforms" ].([]interface {})
269
268
for _ , pt := range packagePlatforms {
270
269
packagePlatform := pt .(map [string ]interface {})
271
- if packagePlatform [constants . PLATFORM_ARCHITECTURE ] == core .Arch && packagePlatform [constants . PLATFORM_VERSION ] == core .Version {
272
- return packagePlatform [constants . PLATFORM_URL ].(string ), nil
270
+ if packagePlatform ["architecture" ] == core .Arch && packagePlatform ["version" ] == core .Version {
271
+ return packagePlatform ["url" ].(string ), nil
273
272
}
274
273
}
275
274
}
@@ -394,7 +393,7 @@ func allBoardsManagerToolsAlreadyDownloadedAndUnpacked(targetPath *paths.Path, t
394
393
}
395
394
396
395
func boardManagerToolAlreadyDownloadedAndUnpacked (targetPath * paths.Path , tool Tool ) bool {
397
- return targetPath .Join (tool .Package , constants . FOLDER_TOOLS , tool .Name , tool .Version ).Exist ()
396
+ return targetPath .Join (tool .Package , "tools" , tool .Name , tool .Version ).Exist ()
398
397
}
399
398
400
399
func allToolsAlreadyDownloadedAndUnpacked (targetPath * paths.Path , tools []Tool ) bool {
@@ -513,10 +512,10 @@ func downloadAndUnpackBoardsManagerTool(tool Tool, url string, targetPath *paths
513
512
}
514
513
defer unpackFolder .RemoveAll ()
515
514
516
- if err := targetPath .Join (tool .Package , constants . FOLDER_TOOLS , tool .Name ).MkdirAll (); err != nil {
515
+ if err := targetPath .Join (tool .Package , "tools" , tool .Name ).MkdirAll (); err != nil {
517
516
return errors .WithStack (err )
518
517
}
519
- if err := unpackFolder .Join (files [0 ].Base ()).CopyDirTo (targetPath .Join (tool .Package , constants . FOLDER_TOOLS , tool .Name , tool .Version )); err != nil {
518
+ if err := unpackFolder .Join (files [0 ].Base ()).CopyDirTo (targetPath .Join (tool .Package , "tools" , tool .Name , tool .Version )); err != nil {
520
519
return errors .WithStack (err )
521
520
}
522
521
return nil
@@ -646,17 +645,17 @@ func findToolUrl(index map[string]interface{}, tool Tool, host []string) (string
646
645
packages := index ["packages" ].([]interface {})
647
646
for _ , p := range packages {
648
647
pack := p .(map [string ]interface {})
649
- packageTools := pack [constants . PACKAGE_TOOLS ].([]interface {})
648
+ packageTools := pack ["tools" ].([]interface {})
650
649
for _ , pt := range packageTools {
651
650
packageTool := pt .(map [string ]interface {})
652
- name := packageTool [constants . TOOL_NAME ].(string )
653
- version := packageTool [constants . TOOL_VERSION ].(string )
651
+ name := packageTool ["name" ].(string )
652
+ version := packageTool ["version" ].(string )
654
653
if name == tool .Name && version == tool .Version {
655
654
systems := packageTool ["systems" ].([]interface {})
656
655
for _ , s := range systems {
657
656
system := s .(map [string ]interface {})
658
657
if slices .Contains (host , system ["host" ].(string )) {
659
- return system [constants . TOOL_URL ].(string ), nil
658
+ return system ["url" ].(string ), nil
660
659
}
661
660
}
662
661
}
0 commit comments