From f85af84dcd8e1295bda029b012d753dfe715c4c8 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 16 Nov 2023 11:12:58 +0100 Subject: [PATCH] Added specific exit-code for "missing programmer" kind of errors. (#2429) * Added gRPC message errors * Implemented specific exit-code for "programmer not found" error --- arduino/errors.go | 3 +- commands/daemon/debug.go | 3 +- internal/cli/burnbootloader/burnbootloader.go | 11 +- internal/cli/compile/compile.go | 9 +- internal/cli/debug/debug.go | 14 +- internal/cli/feedback/errorcodes.go | 14 ++ internal/cli/upload/upload.go | 9 +- rpc/cc/arduino/cli/commands/v1/common.pb.go | 217 +++++++++++------- rpc/cc/arduino/cli/commands/v1/common.proto | 4 + 9 files changed, 196 insertions(+), 88 deletions(-) diff --git a/arduino/errors.go b/arduino/errors.go index c9f81e8f270..5edb9257fba 100644 --- a/arduino/errors.go +++ b/arduino/errors.go @@ -290,7 +290,8 @@ func (e *MissingProgrammerError) Error() string { // ToRPCStatus converts the error into a *status.Status func (e *MissingProgrammerError) ToRPCStatus() *status.Status { - return status.New(codes.InvalidArgument, e.Error()) + s, _ := status.New(codes.InvalidArgument, e.Error()).WithDetails(&rpc.MissingProgrammerError{}) + return s } // ProgrammerRequiredForUploadError is returned when the upload can be done only using a programmer diff --git a/commands/daemon/debug.go b/commands/daemon/debug.go index 0e024881788..f888336d3d9 100644 --- a/commands/daemon/debug.go +++ b/commands/daemon/debug.go @@ -63,5 +63,6 @@ func (s *ArduinoCoreServerImpl) Debug(stream rpc.ArduinoCoreService_DebugServer) // GetDebugConfig return metadata about a debug session func (s *ArduinoCoreServerImpl) GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) { - return cmd.GetDebugConfig(ctx, req) + res, err := cmd.GetDebugConfig(ctx, req) + return res, convertErrorToRPCStatus(err) } diff --git a/internal/cli/burnbootloader/burnbootloader.go b/internal/cli/burnbootloader/burnbootloader.go index ce2befcdfd2..0792f1c87e7 100644 --- a/internal/cli/burnbootloader/burnbootloader.go +++ b/internal/cli/burnbootloader/burnbootloader.go @@ -17,8 +17,10 @@ package burnbootloader import ( "context" + "errors" "os" + "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/commands/upload" "github.com/arduino/arduino-cli/i18n" "github.com/arduino/arduino-cli/internal/cli/arguments" @@ -82,7 +84,14 @@ func runBootloaderCommand(command *cobra.Command, args []string) { Programmer: programmer.String(instance, fqbn.String()), DryRun: dryRun, }, stdOut, stdErr); err != nil { - feedback.Fatal(tr("Error during Upload: %v", err), feedback.ErrGeneric) + errcode := feedback.ErrGeneric + if errors.Is(err, &arduino.ProgrammerRequiredForUploadError{}) { + errcode = feedback.ErrMissingProgrammer + } + if errors.Is(err, &arduino.MissingProgrammerError{}) { + errcode = feedback.ErrMissingProgrammer + } + feedback.Fatal(tr("Error during Upload: %v", err), errcode) } feedback.PrintResult(res()) } diff --git a/internal/cli/compile/compile.go b/internal/cli/compile/compile.go index a09685980ae..d68b248027e 100644 --- a/internal/cli/compile/compile.go +++ b/internal/cli/compile/compile.go @@ -280,7 +280,14 @@ func runCompileCommand(cmd *cobra.Command, args []string) { } if res, err := upload.Upload(context.Background(), uploadRequest, stdOut, stdErr); err != nil { - feedback.Fatal(tr("Error during Upload: %v", err), feedback.ErrGeneric) + errcode := feedback.ErrGeneric + if errors.Is(err, &arduino.ProgrammerRequiredForUploadError{}) { + errcode = feedback.ErrMissingProgrammer + } + if errors.Is(err, &arduino.MissingProgrammerError{}) { + errcode = feedback.ErrMissingProgrammer + } + feedback.Fatal(tr("Error during Upload: %v", err), errcode) } else { uploadRes = res } diff --git a/internal/cli/debug/debug.go b/internal/cli/debug/debug.go index 6bf1a1c74ca..65d2459012e 100644 --- a/internal/cli/debug/debug.go +++ b/internal/cli/debug/debug.go @@ -18,9 +18,11 @@ package debug import ( "context" "encoding/json" + "errors" "os" "os/signal" + "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/commands/debug" "github.com/arduino/arduino-cli/commands/sketch" "github.com/arduino/arduino-cli/i18n" @@ -93,7 +95,11 @@ func runDebugCommand(command *cobra.Command, args []string) { if printInfo { if res, err := debug.GetDebugConfig(context.Background(), debugConfigRequested); err != nil { - feedback.Fatal(tr("Error getting Debug info: %v", err), feedback.ErrBadArgument) + errcode := feedback.ErrBadArgument + if errors.Is(err, &arduino.MissingProgrammerError{}) { + errcode = feedback.ErrMissingProgrammer + } + feedback.Fatal(tr("Error getting Debug info: %v", err), errcode) } else { feedback.PrintResult(newDebugInfoResult(res)) } @@ -109,7 +115,11 @@ func runDebugCommand(command *cobra.Command, args []string) { feedback.FatalError(err, feedback.ErrBadArgument) } if _, err := debug.Debug(context.Background(), debugConfigRequested, in, out, ctrlc); err != nil { - feedback.Fatal(tr("Error during Debug: %v", err), feedback.ErrGeneric) + errcode := feedback.ErrGeneric + if errors.Is(err, &arduino.MissingProgrammerError{}) { + errcode = feedback.ErrMissingProgrammer + } + feedback.Fatal(tr("Error during Debug: %v", err), errcode) } } diff --git a/internal/cli/feedback/errorcodes.go b/internal/cli/feedback/errorcodes.go index 1e1a0edf19e..0f92ee07c73 100644 --- a/internal/cli/feedback/errorcodes.go +++ b/internal/cli/feedback/errorcodes.go @@ -42,4 +42,18 @@ const ( // ErrBadArgument is returned when the arguments are not valid (7) ErrBadArgument + + // ErrFailedToListenToTCPPort is returned if the CLI failed to open a TCP port + // to listen for incoming connections (8) + ErrFailedToListenToTCPPort + + // ErrBadTCPPortArgument is returned if the TCP port argument is not valid (9) + ErrBadTCPPortArgument + + // ErrInitializingInventory is returned when the inventory cannot be initialized, + // usually depends on a wrong configuration of the data dir (10) + ErrInitializingInventory + + // ErrMissingProgrammer is returned when the programmer argument is missing (11) + ErrMissingProgrammer ) diff --git a/internal/cli/upload/upload.go b/internal/cli/upload/upload.go index 8e62d9d5041..400a9dc152b 100644 --- a/internal/cli/upload/upload.go +++ b/internal/cli/upload/upload.go @@ -193,7 +193,14 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) { UserFields: fields, } if res, err := upload.Upload(context.Background(), req, stdOut, stdErr); err != nil { - feedback.FatalError(err, feedback.ErrGeneric) + errcode := feedback.ErrGeneric + if errors.Is(err, &arduino.ProgrammerRequiredForUploadError{}) { + errcode = feedback.ErrMissingProgrammer + } + if errors.Is(err, &arduino.MissingProgrammerError{}) { + errcode = feedback.ErrMissingProgrammer + } + feedback.FatalError(err, errcode) } else { io := stdIOResult() feedback.PrintResult(&uploadResult{ diff --git a/rpc/cc/arduino/cli/commands/v1/common.pb.go b/rpc/cc/arduino/cli/commands/v1/common.pb.go index acb781a213a..0ec5c062526 100644 --- a/rpc/cc/arduino/cli/commands/v1/common.pb.go +++ b/rpc/cc/arduino/cli/commands/v1/common.pb.go @@ -491,6 +491,46 @@ func (x *Programmer) GetName() string { return "" } +// MissingProgrammerError is a status error detail that is returned when +// the operation can not be completed due to a missing programmer argument. +type MissingProgrammerError struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MissingProgrammerError) Reset() { + *x = MissingProgrammerError{} + if protoimpl.UnsafeEnabled { + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MissingProgrammerError) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MissingProgrammerError) ProtoMessage() {} + +func (x *MissingProgrammerError) ProtoReflect() protoreflect.Message { + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use MissingProgrammerError.ProtoReflect.Descriptor instead. +func (*MissingProgrammerError) Descriptor() ([]byte, []int) { + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{7} +} + type Platform struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -537,7 +577,7 @@ type Platform struct { func (x *Platform) Reset() { *x = Platform{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[7] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -550,7 +590,7 @@ func (x *Platform) String() string { func (*Platform) ProtoMessage() {} func (x *Platform) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[7] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -563,7 +603,7 @@ func (x *Platform) ProtoReflect() protoreflect.Message { // Deprecated: Use Platform.ProtoReflect.Descriptor instead. func (*Platform) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{7} + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{8} } func (x *Platform) GetId() string { @@ -682,7 +722,7 @@ type InstalledPlatformReference struct { func (x *InstalledPlatformReference) Reset() { *x = InstalledPlatformReference{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[8] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -695,7 +735,7 @@ func (x *InstalledPlatformReference) String() string { func (*InstalledPlatformReference) ProtoMessage() {} func (x *InstalledPlatformReference) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[8] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -708,7 +748,7 @@ func (x *InstalledPlatformReference) ProtoReflect() protoreflect.Message { // Deprecated: Use InstalledPlatformReference.ProtoReflect.Descriptor instead. func (*InstalledPlatformReference) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{8} + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{9} } func (x *InstalledPlatformReference) GetId() string { @@ -754,7 +794,7 @@ type Board struct { func (x *Board) Reset() { *x = Board{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[9] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -767,7 +807,7 @@ func (x *Board) String() string { func (*Board) ProtoMessage() {} func (x *Board) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[9] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[10] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -780,7 +820,7 @@ func (x *Board) ProtoReflect() protoreflect.Message { // Deprecated: Use Board.ProtoReflect.Descriptor instead. func (*Board) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{9} + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{10} } func (x *Board) GetName() string { @@ -811,7 +851,7 @@ type Profile struct { func (x *Profile) Reset() { *x = Profile{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[10] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -824,7 +864,7 @@ func (x *Profile) String() string { func (*Profile) ProtoMessage() {} func (x *Profile) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[10] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[11] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -837,7 +877,7 @@ func (x *Profile) ProtoReflect() protoreflect.Message { // Deprecated: Use Profile.ProtoReflect.Descriptor instead. func (*Profile) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{10} + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{11} } func (x *Profile) GetName() string { @@ -867,7 +907,7 @@ type HelpResources struct { func (x *HelpResources) Reset() { *x = HelpResources{} if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[11] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -880,7 +920,7 @@ func (x *HelpResources) String() string { func (*HelpResources) ProtoMessage() {} func (x *HelpResources) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[11] + mi := &file_cc_arduino_cli_commands_v1_common_proto_msgTypes[12] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -893,7 +933,7 @@ func (x *HelpResources) ProtoReflect() protoreflect.Message { // Deprecated: Use HelpResources.ProtoReflect.Descriptor instead. func (*HelpResources) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{11} + return file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP(), []int{12} } func (x *HelpResources) GetOnline() string { @@ -954,59 +994,61 @@ var file_cc_arduino_cli_commands_v1_common_proto_rawDesc = []byte{ 0x66, 0x6f, 0x72, 0x6d, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0xd6, 0x03, 0x0a, 0x08, 0x50, 0x6c, 0x61, - 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, - 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, - 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x1e, 0x0a, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, 0x61, 0x69, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, - 0x18, 0x0a, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x07, 0x77, 0x65, 0x62, 0x73, 0x69, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, - 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, - 0x39, 0x0a, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x21, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, - 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x61, - 0x72, 0x64, 0x52, 0x06, 0x62, 0x6f, 0x61, 0x72, 0x64, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6d, 0x61, - 0x6e, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, - 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x6c, 0x79, - 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, - 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, - 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, - 0x04, 0x68, 0x65, 0x6c, 0x70, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, - 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, - 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x70, 0x52, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, 0x18, 0x0a, 0x07, - 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, - 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, - 0x67, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x0f, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0x22, 0x88, 0x01, 0x0a, 0x1a, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x50, - 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, - 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, - 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x2f, 0x0a, 0x05, - 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x31, 0x0a, - 0x07, 0x50, 0x72, 0x6f, 0x66, 0x69, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, - 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, - 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x65, 0x6c, 0x70, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x06, 0x6f, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, - 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, - 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, - 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, - 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, - 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x18, 0x0a, 0x16, 0x4d, 0x69, 0x73, 0x73, + 0x69, 0x6e, 0x67, 0x50, 0x72, 0x6f, 0x67, 0x72, 0x61, 0x6d, 0x6d, 0x65, 0x72, 0x45, 0x72, 0x72, + 0x6f, 0x72, 0x22, 0xd6, 0x03, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, 0x6d, 0x12, + 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, + 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x12, 0x16, 0x0a, + 0x06, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, + 0x61, 0x74, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x61, 0x69, + 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x6d, + 0x61, 0x69, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x77, 0x65, 0x62, + 0x73, 0x69, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x77, 0x65, 0x62, 0x73, + 0x69, 0x74, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x07, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x39, 0x0a, 0x06, 0x62, 0x6f, 0x61, + 0x72, 0x64, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x63, 0x2e, 0x61, + 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, + 0x6e, 0x64, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x52, 0x06, 0x62, 0x6f, + 0x61, 0x72, 0x64, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x6c, 0x79, + 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x11, 0x6d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x6c, 0x79, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, + 0x6c, 0x65, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, 0x74, 0x65, + 0x64, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x72, 0x65, 0x63, 0x61, + 0x74, 0x65, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x3d, 0x0a, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x18, + 0x0c, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, + 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x2e, + 0x76, 0x31, 0x2e, 0x48, 0x65, 0x6c, 0x70, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, + 0x52, 0x04, 0x68, 0x65, 0x6c, 0x70, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, + 0x64, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x65, 0x64, + 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x69, 0x73, 0x73, 0x69, 0x6e, 0x67, 0x5f, 0x6d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x6d, 0x69, 0x73, 0x73, + 0x69, 0x6e, 0x67, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x22, 0x88, 0x01, 0x0a, 0x1a, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x65, 0x64, 0x50, 0x6c, 0x61, 0x74, 0x66, 0x6f, 0x72, + 0x6d, 0x52, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, + 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, + 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 0x5f, + 0x64, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x69, 0x6e, 0x73, 0x74, 0x61, + 0x6c, 0x6c, 0x44, 0x69, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x70, 0x61, 0x63, 0x6b, 0x61, 0x67, 0x65, + 0x5f, 0x75, 0x72, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x70, 0x61, 0x63, 0x6b, + 0x61, 0x67, 0x65, 0x55, 0x72, 0x6c, 0x22, 0x2f, 0x0a, 0x05, 0x42, 0x6f, 0x61, 0x72, 0x64, 0x12, + 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x31, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x66, 0x69, + 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x66, 0x71, 0x62, 0x6e, 0x22, 0x27, 0x0a, 0x0d, 0x48, 0x65, + 0x6c, 0x70, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x73, 0x12, 0x16, 0x0a, 0x06, 0x6f, + 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6f, 0x6e, 0x6c, + 0x69, 0x6e, 0x65, 0x42, 0x48, 0x5a, 0x46, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, + 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, + 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, + 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, + 0x73, 0x2f, 0x76, 0x31, 0x3b, 0x63, 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x73, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -1021,7 +1063,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_rawDescGZIP() []byte { return file_cc_arduino_cli_commands_v1_common_proto_rawDescData } -var file_cc_arduino_cli_commands_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_cc_arduino_cli_commands_v1_common_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_cc_arduino_cli_commands_v1_common_proto_goTypes = []interface{}{ (*Instance)(nil), // 0: cc.arduino.cli.commands.v1.Instance (*DownloadProgress)(nil), // 1: cc.arduino.cli.commands.v1.DownloadProgress @@ -1030,18 +1072,19 @@ var file_cc_arduino_cli_commands_v1_common_proto_goTypes = []interface{}{ (*DownloadProgressEnd)(nil), // 4: cc.arduino.cli.commands.v1.DownloadProgressEnd (*TaskProgress)(nil), // 5: cc.arduino.cli.commands.v1.TaskProgress (*Programmer)(nil), // 6: cc.arduino.cli.commands.v1.Programmer - (*Platform)(nil), // 7: cc.arduino.cli.commands.v1.Platform - (*InstalledPlatformReference)(nil), // 8: cc.arduino.cli.commands.v1.InstalledPlatformReference - (*Board)(nil), // 9: cc.arduino.cli.commands.v1.Board - (*Profile)(nil), // 10: cc.arduino.cli.commands.v1.Profile - (*HelpResources)(nil), // 11: cc.arduino.cli.commands.v1.HelpResources + (*MissingProgrammerError)(nil), // 7: cc.arduino.cli.commands.v1.MissingProgrammerError + (*Platform)(nil), // 8: cc.arduino.cli.commands.v1.Platform + (*InstalledPlatformReference)(nil), // 9: cc.arduino.cli.commands.v1.InstalledPlatformReference + (*Board)(nil), // 10: cc.arduino.cli.commands.v1.Board + (*Profile)(nil), // 11: cc.arduino.cli.commands.v1.Profile + (*HelpResources)(nil), // 12: cc.arduino.cli.commands.v1.HelpResources } var file_cc_arduino_cli_commands_v1_common_proto_depIdxs = []int32{ 2, // 0: cc.arduino.cli.commands.v1.DownloadProgress.start:type_name -> cc.arduino.cli.commands.v1.DownloadProgressStart 3, // 1: cc.arduino.cli.commands.v1.DownloadProgress.update:type_name -> cc.arduino.cli.commands.v1.DownloadProgressUpdate 4, // 2: cc.arduino.cli.commands.v1.DownloadProgress.end:type_name -> cc.arduino.cli.commands.v1.DownloadProgressEnd - 9, // 3: cc.arduino.cli.commands.v1.Platform.boards:type_name -> cc.arduino.cli.commands.v1.Board - 11, // 4: cc.arduino.cli.commands.v1.Platform.help:type_name -> cc.arduino.cli.commands.v1.HelpResources + 10, // 3: cc.arduino.cli.commands.v1.Platform.boards:type_name -> cc.arduino.cli.commands.v1.Board + 12, // 4: cc.arduino.cli.commands.v1.Platform.help:type_name -> cc.arduino.cli.commands.v1.HelpResources 5, // [5:5] is the sub-list for method output_type 5, // [5:5] is the sub-list for method input_type 5, // [5:5] is the sub-list for extension type_name @@ -1140,7 +1183,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { } } file_cc_arduino_cli_commands_v1_common_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Platform); i { + switch v := v.(*MissingProgrammerError); i { case 0: return &v.state case 1: @@ -1152,7 +1195,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { } } file_cc_arduino_cli_commands_v1_common_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*InstalledPlatformReference); i { + switch v := v.(*Platform); i { case 0: return &v.state case 1: @@ -1164,7 +1207,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { } } file_cc_arduino_cli_commands_v1_common_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Board); i { + switch v := v.(*InstalledPlatformReference); i { case 0: return &v.state case 1: @@ -1176,7 +1219,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { } } file_cc_arduino_cli_commands_v1_common_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Profile); i { + switch v := v.(*Board); i { case 0: return &v.state case 1: @@ -1188,6 +1231,18 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { } } file_cc_arduino_cli_commands_v1_common_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Profile); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_cc_arduino_cli_commands_v1_common_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*HelpResources); i { case 0: return &v.state @@ -1211,7 +1266,7 @@ func file_cc_arduino_cli_commands_v1_common_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_cc_arduino_cli_commands_v1_common_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/rpc/cc/arduino/cli/commands/v1/common.proto b/rpc/cc/arduino/cli/commands/v1/common.proto index b1ec5ca0e24..12dae0adb6b 100644 --- a/rpc/cc/arduino/cli/commands/v1/common.proto +++ b/rpc/cc/arduino/cli/commands/v1/common.proto @@ -74,6 +74,10 @@ message Programmer { string name = 3; } +// MissingProgrammerError is a status error detail that is returned when +// the operation can not be completed due to a missing programmer argument. +message MissingProgrammerError {} + message Platform { // Platform ID (e.g., `arduino:avr`). string id = 1;