Skip to content

Commit

Permalink
[breaking] Removed Profile protoc message in favor of `SketchProfil…
Browse files Browse the repository at this point in the history
…e` (#2507)
  • Loading branch information
cmaglie committed Jan 18, 2024
1 parent 96b411f commit 47645e9
Show file tree
Hide file tree
Showing 10 changed files with 547 additions and 616 deletions.
6 changes: 1 addition & 5 deletions commands/instances.go
Expand Up @@ -145,11 +145,7 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro
profile = p
responseCallback(&rpc.InitResponse{
Message: &rpc.InitResponse_Profile{
Profile: &rpc.Profile{
Name: req.GetProfile(),
Fqbn: profile.FQBN,
// TODO: Other profile infos may be provided here...
},
Profile: profile.ToRpc(),
},
})
}
Expand Down
15 changes: 15 additions & 0 deletions docs/UPGRADING.md
Expand Up @@ -4,6 +4,21 @@ Here you can find a list of migration guides to handle breaking changes between

## 0.36.0

### The gRPC `cc.arduino.cli.commands.v1.Profile` message has been removed in favor of `SketchProfile`

The message `Profile` has been replaced with `SketchProfile` in the `InitResponse.profile` field:

```proto
message InitResponse {
oneof message {
Progress init_progress = 1;
google.rpc.Status error = 2;
// Selected profile information
SketchProfile profile = 3;
}
}
```

### The gRPC `cc.arduino.cli.commands.v1.LoadSketchResponse` message has been changed.

Previously the `LoadSketchResponse` containted all the information about the sketch:
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/compile/compile.go
Expand Up @@ -166,7 +166,7 @@ func runCompileCommand(cmd *cobra.Command, args []string) {
feedback.WarnAboutDeprecatedFiles(sk)

var inst *rpc.Instance
var profile *rpc.Profile
var profile *rpc.SketchProfile

if profileArg.Get() == "" {
inst, profile = instance.CreateAndInitWithProfile(sk.GetDefaultProfile().GetName(), sketchPath)
Expand Down
6 changes: 3 additions & 3 deletions internal/cli/instance/instance.go
Expand Up @@ -37,7 +37,7 @@ func CreateAndInit() *rpc.Instance {
// CreateAndInitWithProfile returns a new initialized instance using the given profile of the given sketch.
// If Create fails the CLI prints an error and exits since to execute further operations a valid Instance is mandatory.
// If Init returns errors they're printed only.
func CreateAndInitWithProfile(profileName string, sketchPath *paths.Path) (*rpc.Instance, *rpc.Profile) {
func CreateAndInitWithProfile(profileName string, sketchPath *paths.Path) (*rpc.Instance, *rpc.SketchProfile) {
instance, err := create()
if err != nil {
feedback.Fatal(tr("Error creating instance: %v", err), feedback.ErrGeneric)
Expand Down Expand Up @@ -67,7 +67,7 @@ func Init(instance *rpc.Instance) {
// InitWithProfile initializes instance by loading libraries and platforms specified in the given profile of the given sketch.
// In case of loading failures return a list of errors for each platform or library that we failed to load.
// Required Package and library indexes files are automatically downloaded.
func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) *rpc.Profile {
func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *paths.Path) *rpc.SketchProfile {
downloadCallback := feedback.ProgressBar()
taskCallback := feedback.TaskProgress()

Expand All @@ -76,7 +76,7 @@ func InitWithProfile(instance *rpc.Instance, profileName string, sketchPath *pat
initReq.SketchPath = sketchPath.String()
initReq.Profile = profileName
}
var profile *rpc.Profile
var profile *rpc.SketchProfile
err := commands.Init(initReq, func(res *rpc.InitResponse) {
if st := res.GetError(); st != nil {
feedback.Warning(tr("Error initializing instance: %v", st.GetMessage()))
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/monitor/monitor.go
Expand Up @@ -93,7 +93,7 @@ func runMonitorCmd(

var (
inst *rpc.Instance
profile *rpc.Profile
profile *rpc.SketchProfile
fqbn string
defaultPort, defaultProtocol string
)
Expand Down
2 changes: 1 addition & 1 deletion internal/cli/upload/upload.go
Expand Up @@ -100,7 +100,7 @@ func runUploadCommand(args []string, uploadFieldsArgs map[string]string) {
}

var inst *rpc.Instance
var profile *rpc.Profile
var profile *rpc.SketchProfile

if profileArg.Get() == "" {
inst, profile = instance.CreateAndInitWithProfile(sketch.GetDefaultProfile().GetName(), sketchPath)
Expand Down
922 changes: 461 additions & 461 deletions rpc/cc/arduino/cli/commands/v1/commands.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rpc/cc/arduino/cli/commands/v1/commands.proto
Expand Up @@ -237,7 +237,7 @@ message InitResponse {
Progress init_progress = 1;
google.rpc.Status error = 2;
// Selected profile information
Profile profile = 3;
SketchProfile profile = 3;
}
}

Expand Down
199 changes: 63 additions & 136 deletions rpc/cc/arduino/cli/commands/v1/common.pb.go

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions rpc/cc/arduino/cli/commands/v1/common.proto
Expand Up @@ -173,13 +173,6 @@ message Board {
string fqbn = 2;
}

message Profile {
// Name used to identify the profile within the sketch.
string name = 1;
// FQBN specified in the profile.
string fqbn = 2;
}

message HelpResources {
// A URL provided by the author of the platform's package, intended to point
// to their online help service.
Expand Down

0 comments on commit 47645e9

Please sign in to comment.