Skip to content

Renamed FQBN.Packager -> FQBN.Vendor #2836

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion commands/service_board_details.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (s *arduinoCoreServerImpl) BoardDetails(ctx context.Context, req *rpc.Board
details.Name = board.Name()
details.Fqbn = board.FQBN()
details.PropertiesId = board.BoardID
details.Official = fqbn.Packager == "arduino"
details.Official = fqbn.Vendor == "arduino"
details.Version = board.PlatformRelease.Version.String()
details.IdentificationProperties = []*rpc.BoardIdentificationProperties{}
for _, p := range board.GetIdentificationProperties() {
Expand Down
2 changes: 1 addition & 1 deletion commands/service_compile.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (s *arduinoCoreServerImpl) Compile(req *rpc.CompileRequest, stream rpc.Ardu
if err != nil {
if targetPlatform == nil {
return &cmderrors.PlatformNotFoundError{
Platform: fmt.Sprintf("%s:%s", fqbn.Packager, fqbn.Architecture),
Platform: fmt.Sprintf("%s:%s", fqbn.Vendor, fqbn.Architecture),
Cause: errors.New(i18n.Tr("platform not installed")),
}
}
Expand Down
4 changes: 2 additions & 2 deletions commands/service_upload.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *arduinoCoreServerImpl) SupportedUserFields(ctx context.Context, req *rp
_, platformRelease, _, boardProperties, _, err := pme.ResolveFQBN(fqbn)
if platformRelease == nil {
return nil, &cmderrors.PlatformNotFoundError{
Platform: fmt.Sprintf("%s:%s", fqbn.Packager, fqbn.Architecture),
Platform: fmt.Sprintf("%s:%s", fqbn.Vendor, fqbn.Architecture),
Cause: err,
}
} else if err != nil {
Expand Down Expand Up @@ -293,7 +293,7 @@ func (s *arduinoCoreServerImpl) runProgramAction(ctx context.Context, pme *packa
_, boardPlatform, board, boardProperties, buildPlatform, err := pme.ResolveFQBN(fqbn)
if boardPlatform == nil {
return nil, &cmderrors.PlatformNotFoundError{
Platform: fmt.Sprintf("%s:%s", fqbn.Packager, fqbn.Architecture),
Platform: fmt.Sprintf("%s:%s", fqbn.Vendor, fqbn.Architecture),
Cause: err,
}
} else if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions internal/arduino/cores/packagemanager/package_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@ func (pme *Explorer) ResolveFQBN(fqbn *fqbn.FQBN) (
*properties.Map, *cores.PlatformRelease, error) {

// Find package
targetPackage := pme.packages[fqbn.Packager]
targetPackage := pme.packages[fqbn.Vendor]
if targetPackage == nil {
return nil, nil, nil, nil, nil,
errors.New(i18n.Tr("unknown package %s", fqbn.Packager))
errors.New(i18n.Tr("unknown package %s", fqbn.Vendor))
}

// Find platform
Expand Down
4 changes: 2 additions & 2 deletions internal/cli/board/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ func (dr listResult) String() string {
var coreName = ""
fqbn, err := fqbn.Parse(b.Fqbn)
if err == nil {
coreName = fmt.Sprintf("%s:%s", fqbn.Packager, fqbn.Architecture)
coreName = fmt.Sprintf("%s:%s", fqbn.Vendor, fqbn.Architecture)
}

t.AddRow(address, protocol, protocolLabel, board, fqbn, coreName)
Expand Down Expand Up @@ -217,7 +217,7 @@ func (dr watchEventResult) String() string {
var coreName = ""
fqbn, err := fqbn.Parse(b.Fqbn)
if err == nil {
coreName = fmt.Sprintf("%s:%s", fqbn.Packager, fqbn.Architecture)
coreName = fmt.Sprintf("%s:%s", fqbn.Vendor, fqbn.Architecture)
}

t.AddRow(address, protocol, event, board, fqbn, coreName)
Expand Down
8 changes: 4 additions & 4 deletions pkg/fqbn/fqbn.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (

// FQBN represents an Fully Qualified Board Name string
type FQBN struct {
Packager string
Vendor string
Architecture string
BoardID string
Configs *properties.Map
Expand Down Expand Up @@ -54,7 +54,7 @@ func Parse(fqbnIn string) (*FQBN, error) {
}

fqbn := &FQBN{
Packager: fqbnParts[0],
Vendor: fqbnParts[0],
Architecture: fqbnParts[1],
BoardID: fqbnParts[2],
Configs: properties.NewMap(),
Expand Down Expand Up @@ -95,7 +95,7 @@ func Parse(fqbnIn string) (*FQBN, error) {
// Clone returns a copy of this FQBN.
func (fqbn *FQBN) Clone() *FQBN {
return &FQBN{
Packager: fqbn.Packager,
Vendor: fqbn.Vendor,
Architecture: fqbn.Architecture,
BoardID: fqbn.BoardID,
Configs: fqbn.Configs.Clone(),
Expand All @@ -122,7 +122,7 @@ func (fqbn *FQBN) Match(target *FQBN) bool {

// StringWithoutConfig returns the FQBN without the Config part
func (fqbn *FQBN) StringWithoutConfig() string {
return fqbn.Packager + ":" + fqbn.Architecture + ":" + fqbn.BoardID
return fqbn.Vendor + ":" + fqbn.Architecture + ":" + fqbn.BoardID
}

// String returns the FQBN as a string
Expand Down
16 changes: 8 additions & 8 deletions pkg/fqbn/fqbn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func TestFQBN(t *testing.T) {
a, err := fqbn.Parse("arduino:avr:uno")
require.Equal(t, "arduino:avr:uno", a.String())
require.NoError(t, err)
require.Equal(t, a.Packager, "arduino")
require.Equal(t, a.Vendor, "arduino")
require.Equal(t, a.Architecture, "avr")
require.Equal(t, a.BoardID, "uno")
require.Zero(t, a.Configs.Size())
Expand All @@ -35,23 +35,23 @@ func TestFQBN(t *testing.T) {
b1, err := fqbn.Parse("arduino::uno")
require.Equal(t, "arduino::uno", b1.String())
require.NoError(t, err)
require.Equal(t, b1.Packager, "arduino")
require.Equal(t, b1.Vendor, "arduino")
require.Equal(t, b1.Architecture, "")
require.Equal(t, b1.BoardID, "uno")
require.Zero(t, b1.Configs.Size())

b2, err := fqbn.Parse(":avr:uno")
require.Equal(t, ":avr:uno", b2.String())
require.NoError(t, err)
require.Equal(t, b2.Packager, "")
require.Equal(t, b2.Vendor, "")
require.Equal(t, b2.Architecture, "avr")
require.Equal(t, b2.BoardID, "uno")
require.Zero(t, b2.Configs.Size())

b3, err := fqbn.Parse("::uno")
require.Equal(t, "::uno", b3.String())
require.NoError(t, err)
require.Equal(t, b3.Packager, "")
require.Equal(t, b3.Vendor, "")
require.Equal(t, b3.Architecture, "")
require.Equal(t, b3.BoardID, "uno")
require.Zero(t, b3.Configs.Size())
Expand Down Expand Up @@ -89,15 +89,15 @@ func TestFQBN(t *testing.T) {
c, err := fqbn.Parse("arduino:avr:uno:cpu=atmega")
require.Equal(t, "arduino:avr:uno:cpu=atmega", c.String())
require.NoError(t, err)
require.Equal(t, c.Packager, "arduino")
require.Equal(t, c.Vendor, "arduino")
require.Equal(t, c.Architecture, "avr")
require.Equal(t, c.BoardID, "uno")
require.Equal(t, "properties.Map{\n \"cpu\": \"atmega\",\n}", c.Configs.Dump())

d, err := fqbn.Parse("arduino:avr:uno:cpu=atmega,speed=1000")
require.Equal(t, "arduino:avr:uno:cpu=atmega,speed=1000", d.String())
require.NoError(t, err)
require.Equal(t, d.Packager, "arduino")
require.Equal(t, d.Vendor, "arduino")
require.Equal(t, d.Architecture, "avr")
require.Equal(t, d.BoardID, "uno")
require.Equal(t, "properties.Map{\n \"cpu\": \"atmega\",\n \"speed\": \"1000\",\n}", d.Configs.Dump())
Expand All @@ -122,7 +122,7 @@ func TestFQBN(t *testing.T) {
e, err := fqbn.Parse("arduino:avr:uno:cpu=")
require.Equal(t, "arduino:avr:uno:cpu=", e.String())
require.NoError(t, err)
require.Equal(t, e.Packager, "arduino")
require.Equal(t, e.Vendor, "arduino")
require.Equal(t, e.Architecture, "avr")
require.Equal(t, e.BoardID, "uno")
require.Equal(t, "properties.Map{\n \"cpu\": \"\",\n}", e.Configs.Dump())
Expand All @@ -131,7 +131,7 @@ func TestFQBN(t *testing.T) {
f, err := fqbn.Parse("arduino:avr:uno:cpu=atmega,speed=1000,extra=core=arduino")
require.Equal(t, "arduino:avr:uno:cpu=atmega,speed=1000,extra=core=arduino", f.String())
require.NoError(t, err)
require.Equal(t, f.Packager, "arduino")
require.Equal(t, f.Vendor, "arduino")
require.Equal(t, f.Architecture, "avr")
require.Equal(t, f.BoardID, "uno")
require.Equal(t,
Expand Down