Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit da308d8

Browse files
remove legacy/constans pkg
1 parent 7748942 commit da308d8

File tree

5 files changed

+15
-66
lines changed

5 files changed

+15
-66
lines changed

‎arduino/builder/export_cmake.go‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import (
3030
"github.com/arduino/arduino-cli/arduino/builder/utils"
3131
"github.com/arduino/arduino-cli/arduino/globals"
3232
"github.com/arduino/arduino-cli/arduino/libraries"
33-
"github.com/arduino/arduino-cli/legacy/builder/constants"
3433
)
3534

3635
var lineMatcher = regexp.MustCompile(`^#line\s\d+\s"`)
@@ -283,7 +282,7 @@ func (b *Builder) ExportProjectCMake(
283282
var dynamicLibsFromGccMinusL []string
284283
var linkDirectories []string
285284

286-
extractCompileFlags(b.buildProperties, constants.RECIPE_C_COMBINE_PATTERN, &defines, &dynamicLibsFromGccMinusL, &linkerflags, &linkDirectories)
285+
extractCompileFlags(b.buildProperties, "recipe.c.combine.pattern", &defines, &dynamicLibsFromGccMinusL, &linkerflags, &linkDirectories)
287286
extractCompileFlags(b.buildProperties, "recipe.c.o.pattern", &defines, &dynamicLibsFromGccMinusL, &linkerflags, &linkDirectories)
288287
extractCompileFlags(b.buildProperties, "recipe.cpp.o.pattern", &defines, &dynamicLibsFromGccMinusL, &linkerflags, &linkDirectories)
289288

‎legacy/builder/constants/constants.go‎

Lines changed: 0 additions & 47 deletions
This file was deleted.

‎legacy/builder/test/helper_tools_downloader.go‎

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"strings"
2727
"testing"
2828

29-
"github.com/arduino/arduino-cli/legacy/builder/constants"
3029
"github.com/arduino/go-paths-helper"
3130
"github.com/arduino/go-properties-orderedmap"
3231
"github.com/pkg/errors"
@@ -264,12 +263,12 @@ func findCoreUrl(index map[string]interface{}, core Core) (string, error) {
264263
packages := index["packages"].([]interface{})
265264
for _, p := range packages {
266265
pack := p.(map[string]interface{})
267-
if pack[constants.PACKAGE_NAME].(string) == core.Maintainer {
266+
if pack["name"].(string) == core.Maintainer {
268267
packagePlatforms := pack["platforms"].([]interface{})
269268
for _, pt := range packagePlatforms {
270269
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
273272
}
274273
}
275274
}
@@ -394,7 +393,7 @@ func allBoardsManagerToolsAlreadyDownloadedAndUnpacked(targetPath *paths.Path, t
394393
}
395394

396395
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()
398397
}
399398

400399
func allToolsAlreadyDownloadedAndUnpacked(targetPath *paths.Path, tools []Tool) bool {
@@ -513,10 +512,10 @@ func downloadAndUnpackBoardsManagerTool(tool Tool, url string, targetPath *paths
513512
}
514513
defer unpackFolder.RemoveAll()
515514

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 {
517516
return errors.WithStack(err)
518517
}
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 {
520519
return errors.WithStack(err)
521520
}
522521
return nil
@@ -646,17 +645,17 @@ func findToolUrl(index map[string]interface{}, tool Tool, host []string) (string
646645
packages := index["packages"].([]interface{})
647646
for _, p := range packages {
648647
pack := p.(map[string]interface{})
649-
packageTools := pack[constants.PACKAGE_TOOLS].([]interface{})
648+
packageTools := pack["tools"].([]interface{})
650649
for _, pt := range packageTools {
651650
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)
654653
if name == tool.Name && version == tool.Version {
655654
systems := packageTool["systems"].([]interface{})
656655
for _, s := range systems {
657656
system := s.(map[string]interface{})
658657
if slices.Contains(host, system["host"].(string)) {
659-
return system[constants.TOOL_URL].(string), nil
658+
return system["url"].(string), nil
660659
}
661660
}
662661
}

‎legacy/builder/test/libraries_loader_test.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222

2323
"github.com/arduino/arduino-cli/arduino/builder/detector"
2424
"github.com/arduino/arduino-cli/arduino/libraries"
25-
"github.com/arduino/arduino-cli/legacy/builder/constants"
2625
"github.com/arduino/arduino-cli/legacy/builder/types"
2726
paths "github.com/arduino/go-paths-helper"
2827
"github.com/stretchr/testify/require"
@@ -74,7 +73,7 @@ func TestLoadLibrariesAVR(t *testing.T) {
7473
require.True(t, Abs(t, paths.New("downloaded_libraries/Adafruit_PN532")).EquivalentTo(libs[idx].InstallDir))
7574
require.True(t, Abs(t, paths.New("downloaded_libraries/Adafruit_PN532")).EquivalentTo(libs[idx].SourceDir))
7675
require.Equal(t, 1, len(libs[idx].Architectures))
77-
require.Equal(t, constants.LIBRARY_ALL_ARCHS, libs[idx].Architectures[0])
76+
require.Equal(t, "*", libs[idx].Architectures[0])
7877
require.False(t, libs[idx].IsLegacy)
7978

8079
idx++
@@ -90,7 +89,7 @@ func TestLoadLibrariesAVR(t *testing.T) {
9089
require.True(t, Abs(t, paths.New("downloaded_libraries/Bridge")).EquivalentTo(bridgeLib.InstallDir))
9190
require.True(t, Abs(t, paths.New("downloaded_libraries/Bridge/src")).EquivalentTo(bridgeLib.SourceDir))
9291
require.Equal(t, 1, len(bridgeLib.Architectures))
93-
require.Equal(t, constants.LIBRARY_ALL_ARCHS, bridgeLib.Architectures[0])
92+
require.Equal(t, "*", bridgeLib.Architectures[0])
9493
require.Equal(t, "Arduino", bridgeLib.Author)
9594
require.Equal(t, "Arduino <info@arduino.cc>", bridgeLib.Maintainer)
9695

‎legacy/builder/test/merge_sketch_with_bootloader_test.go‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"strings"
2222
"testing"
2323

24-
"github.com/arduino/arduino-cli/legacy/builder/constants"
2524
"github.com/arduino/arduino-cli/legacy/builder/types"
2625
paths "github.com/arduino/go-paths-helper"
2726
"github.com/stretchr/testify/require"
@@ -138,8 +137,8 @@ func TestMergeSketchWithBootloaderWhenNoBootloaderAvailable(t *testing.T) {
138137

139138
buildPath := ctx.Builder.GetBuildPath()
140139
buildProperties := ctx.Builder.GetBuildProperties()
141-
buildProperties.Remove(constants.BUILD_PROPERTIES_BOOTLOADER_NOBLINK)
142-
buildProperties.Remove(constants.BUILD_PROPERTIES_BOOTLOADER_FILE)
140+
buildProperties.Remove("bootloader.noblink")
141+
buildProperties.Remove("bootloader.file")
143142

144143
err := ctx.Builder.MergeSketchWithBootloader(ctx.OnlyUpdateCompilationDatabase)
145144
require.NoError(t, err)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /