Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
803782c
cosmetic: renamed import
cmaglie Apr 27, 2022
e82a46d
Simplify function pm.DownloadPlatformRelease
cmaglie Mar 31, 2022
1b1867f
Implementation of the Profiles parser
cmaglie Mar 14, 2022
da64af5
Added methods to get profiles from sketch
cmaglie Mar 14, 2022
670c9f1
Added gRPC parameters to support profiles
cmaglie Mar 14, 2022
79eb7f4
Added function to load packages for profiles
cmaglie Mar 14, 2022
183a8bb
Added support for profiles in compile command
cmaglie Apr 26, 2022
1b53f59
Added progress callback and installMissing flag (stubs) in pm.Prepare…
cmaglie Mar 31, 2022
4f8244a
Added auto-install procedures for profiles
cmaglie Mar 31, 2022
c21147b
Handle platform not found errors
cmaglie Mar 31, 2022
8527015
Draft implementation of upload with profiles
cmaglie Mar 28, 2022
10d95b2
Made packagemamager.loadToolsFromPackage public
cmaglie Apr 29, 2022
6cc5d65
Simplified callbacks in commands.Init
cmaglie Apr 29, 2022
18b0d34
cosmetic: added shortcut variable for library manager
cmaglie Apr 29, 2022
4a26bd4
cosmetic: added shortcut variable for package manager; small readabil…
cmaglie Apr 29, 2022
5449677
Wiring profiles into arduino-cli and gRPC implementation
cmaglie May 2, 2022
5972501
Made gRPC Init return a full Profile structure
cmaglie May 2, 2022
efa8899
(tech debt) Disable profiles if compiling with --libraries/--library
cmaglie May 2, 2022
61081f1
Fixed some linter warnings
cmaglie May 2, 2022
6156a26
Apply suggestions from code review
cmaglie May 5, 2022
9d1ec03
Added profiles specification docs
cmaglie May 10, 2022
d998f7f
Allow both sketch.yaml and .yml (with priority for .yaml)
cmaglie May 10, 2022
be8b325
Correctly handle nil return value
cmaglie May 10, 2022
614d652
Apply suggestions from code review
cmaglie May 19, 2022
8cdb8cb
Apply suggestions from code review
cmaglie May 19, 2022
bae72d0
Provide `core install` suggestions only when compiling without profiles
cmaglie May 19, 2022
170382d
Remove stray comment
cmaglie May 19, 2022
633022f
Fixed some comments in protoc files
cmaglie May 19, 2022
1fdbce6
Apply suggestions from code review
cmaglie May 19, 2022
b206d47
Apply suggestions from code review
cmaglie May 20, 2022
453f750
Implemented missing AsYaml methods and added tests
cmaglie May 20, 2022
75f4117
Apply suggestions from code review
cmaglie May 20, 2022
8203266
run of prettier formatter
cmaglie May 20, 2022
e20117f
Preserve profiles ordering in profiles.yaml
cmaglie May 20, 2022
21e8e86
Apply suggestions from code review
cmaglie May 20, 2022
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
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: per1234 <[email protected]>
  • Loading branch information
cmaglie and per1234 committed May 20, 2022
commit 6156a26399aed1932388b42ee730d099ac521763
10 changes: 5 additions & 5 deletions arduino/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,21 +212,21 @@ func (e *UnknownProfileError) ToRPCStatus() *status.Status {
return status.New(codes.NotFound, e.Error())
}

// InvlaidProfileError is returned when the profile has errors
type InvlaidProfileError struct {
// InvalidProfileError is returned when the profile has errors
type InvalidProfileError struct {
Cause error
}

func (e *InvlaidProfileError) Error() string {
func (e *InvalidProfileError) Error() string {
return composeErrorMsg(tr("Invalid profile"), e.Cause)
}

func (e *InvlaidProfileError) Unwrap() error {
func (e *InvalidProfileError) Unwrap() error {
return e.Cause
}

// ToRPCStatus converts the error into a *status.Status
func (e *InvlaidProfileError) ToRPCStatus() *status.Status {
func (e *InvalidProfileError) ToRPCStatus() *status.Status {
return status.New(codes.FailedPrecondition, e.Error())
}

Expand Down
8 changes: 4 additions & 4 deletions arduino/sketch/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"gopkg.in/yaml.v2"
)

// Project represents all the
// Project represents all the profiles defined for the sketch
type Project struct {
Profiles map[string]*Profile `yaml:"profiles"`
DefaultProfile string `yaml:"default_profile"`
Expand Down Expand Up @@ -141,9 +141,9 @@ func (p *ProfilePlatformReference) UnmarshalYAML(unmarshal func(interface{}) err
return err
}
if platformID, ok := data["platform"]; !ok {
return fmt.Errorf(tr("missing 'platform' directive"))
return fmt.Errorf(tr("missing '%s' directive", "platform"))
} else if platformID, platformVersion, ok := parseNameAndVersion(platformID); !ok {
return fmt.Errorf(tr("invalid 'platform' directive"))
return fmt.Errorf(tr("invalid '%s' directive", "platform"))
} else if c, err := semver.Parse(platformVersion); err != nil {
return fmt.Errorf("%s: %w", tr("error parsing version constraints"), err)
} else if split := strings.SplitN(platformID, ":", 2); len(split) != 2 {
Expand All @@ -157,7 +157,7 @@ func (p *ProfilePlatformReference) UnmarshalYAML(unmarshal func(interface{}) err
if rawIndexURL, ok := data["platform_index_url"]; ok {
indexURL, err := url.Parse(rawIndexURL)
if err != nil {
return fmt.Errorf("%s: %w", tr("invlid platform index URL:"), err)
return fmt.Errorf("%s: %w", tr("invalid platform index URL:"), err)
}
p.PlatformIndexURL = indexURL
}
Expand Down
4 changes: 2 additions & 2 deletions cli/arguments/profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ func (f *Profile) AddToCommand(cmd *cobra.Command) {
// TODO: register autocompletion
}

// Get returns the profile
// Get returns the profile name
func (f *Profile) Get() string {
return f.profile
}

// String returns the profile
// String returns the profile name
func (f *Profile) String() string {
return f.profile
}
Expand Down
2 changes: 1 addition & 1 deletion cli/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func CreateAndInit() *rpc.Instance {
return inst
}

// CreateAndInitWithProfile return a new initialized instance using the given profile in the give sketch.
// 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) {
Expand Down
4 changes: 2 additions & 2 deletions rpc/cc/arduino/cli/commands/v1/commands.proto
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ message InitRequest {
Instance instance = 1;
// Profile to use
string profile = 2;
// The path where the sketch is stored (contains also the profile.yml path)
// The path where the sketch is stored
string sketch_path = 3;
}

Expand All @@ -214,7 +214,7 @@ message InitResponse {
oneof message {
Progress init_progress = 1;
google.rpc.Status error = 2;
// Fqbn selected in profile (optional)
// FQBN selected in profile (optional)
Profile profile = 3;
}
}
Expand Down