diff --git a/.codecov.yml b/.codecov.yml index b0b47133cab..d73052e7522 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -1,7 +1,9 @@ comment: off -# ignore: -# - legacy/**/* +ignore: + - rpc/** + - i18n/cmd/** + - i18n/rice-box.go coverage: status: diff --git a/.github/workflows/arduino-stats.yaml b/.github/workflows/arduino-stats.yaml index 8866b3d8787..cd793740009 100644 --- a/.github/workflows/arduino-stats.yaml +++ b/.github/workflows/arduino-stats.yaml @@ -48,3 +48,4 @@ jobs: tags: - "project:arduino-cli" - "cdn:downloads.arduino.cc" + - "workflow:${{ github.workflow }}" diff --git a/.github/workflows/github-stats.yaml b/.github/workflows/github-stats.yaml index afea107a772..a78fe223e49 100644 --- a/.github/workflows/github-stats.yaml +++ b/.github/workflows/github-stats.yaml @@ -88,3 +88,4 @@ jobs: tags: - "project:arduino-cli" - "cdn:github.com" + - "workflow:${{ github.workflow }}" diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 0d1d426c746..4555f12f7ea 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -46,3 +46,4 @@ jobs: host: ${{ github.repository }} tags: - "project:arduino-cli" + - "workflow:${{ github.workflow }}" diff --git a/Taskfile.yml b/Taskfile.yml index 6377dc6ac9b..d7b434a966f 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -124,7 +124,7 @@ tasks: i18n:pull: desc: Pull i18n files from transifex cmds: - - go run ./i18n/cmd/main.go transifex pull -l {{.I18N_LANGS}} ./i18n/data + - go run ./i18n/cmd/main.go transifex pull ./i18n/data - task: i18n:generate i18n:push: @@ -169,4 +169,3 @@ vars: DOCS_VERSION: dev DOCS_ALIAS: "" DOCS_REMOTE: "origin" - I18N_LANGS: "pt_BR" diff --git a/arduino/builder/sketch_test.go b/arduino/builder/sketch_test.go index 1c186067a3a..dbe040edae4 100644 --- a/arduino/builder/sketch_test.go +++ b/arduino/builder/sketch_test.go @@ -207,7 +207,7 @@ func TestCopyAdditionalFiles(t *testing.T) { require.Len(t, s1.AdditionalFiles, 1) // copy the sketch over, create a fake main file we don't care about it - // but we need it for `SketchLoad` to suceed later + // but we need it for `SketchLoad` to succeed later err = builder.SketchCopyAdditionalFiles(s1, tmp) require.Nil(t, err) fakeIno := filepath.Join(tmp, fmt.Sprintf("%s.ino", filepath.Base(tmp))) diff --git a/arduino/cores/cores.go b/arduino/cores/cores.go index 6bf0634d86a..bcacea1154e 100644 --- a/arduino/cores/cores.go +++ b/arduino/cores/cores.go @@ -40,14 +40,14 @@ type PlatformRelease struct { Resource *resources.DownloadResource Version *semver.Version BoardsManifest []*BoardManifest - Dependencies ToolDependencies // The Dependency entries to load tools. - Platform *Platform `json:"-"` - Properties *properties.Map `json:"-"` - Boards map[string]*Board `json:"-"` - Programmers map[string]*properties.Map `json:"-"` - Menus *properties.Map `json:"-"` - InstallDir *paths.Path `json:"-"` - IsIDEBundled bool `json:"-"` + Dependencies ToolDependencies // The Dependency entries to load tools. + Platform *Platform `json:"-"` + Properties *properties.Map `json:"-"` + Boards map[string]*Board `json:"-"` + Programmers map[string]*Programmer `json:"-"` + Menus *properties.Map `json:"-"` + InstallDir *paths.Path `json:"-"` + IsIDEBundled bool `json:"-"` } // BoardManifest contains information about a board. These metadata are usually @@ -117,7 +117,7 @@ func (platform *Platform) GetOrCreateRelease(version *semver.Version) (*Platform Version: version, Boards: map[string]*Board{}, Properties: properties.NewMap(), - Programmers: map[string]*properties.Map{}, + Programmers: map[string]*Programmer{}, Platform: platform, } platform.Releases[tag] = release diff --git a/arduino/cores/packagemanager/loader.go b/arduino/cores/packagemanager/loader.go index f2ed7ff1a17..6d97f8ef66c 100644 --- a/arduino/cores/packagemanager/loader.go +++ b/arduino/cores/packagemanager/loader.go @@ -284,10 +284,10 @@ func (pm *PackageManager) loadPlatformRelease(platform *cores.PlatformRelease, p // Create programmers properties if programmersProperties, err := properties.SafeLoad(programmersTxtPath.String()); err == nil { - platform.Programmers = properties.MergeMapsOfProperties( - map[string]*properties.Map{}, - platform.Programmers, // TODO: Very weird, why not an empty one? - programmersProperties.FirstLevelOf()) + for programmerID, programmerProperties := range programmersProperties.FirstLevelOf() { + platform.Programmers[programmerID] = pm.loadProgrammer(programmerProperties) + platform.Programmers[programmerID].PlatformRelease = platform + } } else { return err } @@ -299,6 +299,13 @@ func (pm *PackageManager) loadPlatformRelease(platform *cores.PlatformRelease, p return nil } +func (pm *PackageManager) loadProgrammer(programmerProperties *properties.Map) *cores.Programmer { + return &cores.Programmer{ + Name: programmerProperties.Get("name"), + Properties: programmerProperties, + } +} + func (pm *PackageManager) loadBoards(platform *cores.PlatformRelease) error { if platform.InstallDir == nil { return fmt.Errorf("platform not installed") diff --git a/arduino/cores/programmers.go b/arduino/cores/programmers.go new file mode 100644 index 00000000000..dfa89615045 --- /dev/null +++ b/arduino/cores/programmers.go @@ -0,0 +1,25 @@ +// This file is part of arduino-cli. +// +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package cores + +import "github.com/arduino/go-properties-orderedmap" + +// Programmer represents an external programmer +type Programmer struct { + Name string + Properties *properties.Map + PlatformRelease *PlatformRelease +} diff --git a/cli/burnbootloader/burnbootloader.go b/cli/burnbootloader/burnbootloader.go new file mode 100644 index 00000000000..37fd6d10a72 --- /dev/null +++ b/cli/burnbootloader/burnbootloader.go @@ -0,0 +1,129 @@ +// This file is part of arduino-cli. +// +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package burnbootloader + +import ( + "context" + "os" + + "github.com/arduino/arduino-cli/cli/errorcodes" + "github.com/arduino/arduino-cli/cli/feedback" + "github.com/arduino/arduino-cli/cli/instance" + "github.com/arduino/arduino-cli/commands/upload" + rpc "github.com/arduino/arduino-cli/rpc/commands" + "github.com/arduino/arduino-cli/table" + "github.com/arduino/go-paths-helper" + "github.com/sirupsen/logrus" + "github.com/spf13/cobra" +) + +var ( + fqbn string + port string + verbose bool + verify bool + importDir string + programmer string + burnBootloader bool +) + +// NewCommand created a new `burn-bootloader` command +func NewCommand() *cobra.Command { + burnBootloaderCommand := &cobra.Command{ + Use: "burn-bootloader", + Short: "Upload the bootloader.", + Long: "Upload the bootloader on the board using an external programmer.", + Example: " " + os.Args[0] + " burn-bootloader -b arduino:avr:uno -P atmel-ice", + Args: cobra.MaximumNArgs(1), + Run: run, + } + + burnBootloaderCommand.Flags().StringVarP(&fqbn, "fqbn", "b", "", "Fully Qualified Board Name, e.g.: arduino:avr:uno") + burnBootloaderCommand.Flags().StringVarP(&port, "port", "p", "", "Upload port, e.g.: COM10 or /dev/ttyACM0") + burnBootloaderCommand.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.") + burnBootloaderCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "Turns on verbose mode.") + burnBootloaderCommand.Flags().StringVarP(&programmer, "programmer", "P", "", "Use the specified programmer to upload or 'list' to list supported programmers.") + + return burnBootloaderCommand +} + +func run(command *cobra.Command, args []string) { + instance, err := instance.CreateInstance() + if err != nil { + feedback.Errorf("Error during Upload: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + + if programmer == "list" { + resp, err := upload.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadReq{ + Instance: instance, + Fqbn: fqbn, + }) + if err != nil { + feedback.Errorf("Error listing programmers: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + feedback.PrintResult(&programmersList{ + Programmers: resp.GetProgrammers(), + }) + os.Exit(0) + } + + if _, err := upload.BurnBootloader(context.Background(), &rpc.BurnBootloaderReq{ + Instance: instance, + Fqbn: fqbn, + Port: port, + Verbose: verbose, + Verify: verify, + Programmer: programmer, + }, os.Stdout, os.Stderr); err != nil { + feedback.Errorf("Error during Upload: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + os.Exit(0) +} + +// initSketchPath returns the current working directory +func initSketchPath(sketchPath *paths.Path) *paths.Path { + if sketchPath != nil { + return sketchPath + } + + wd, err := paths.Getwd() + if err != nil { + feedback.Errorf("Couldn't get current working directory: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + logrus.Infof("Reading sketch from dir: %s", wd) + return wd +} + +type programmersList struct { + Programmers []*rpc.Programmer +} + +func (p *programmersList) Data() interface{} { + return p.Programmers +} + +func (p *programmersList) String() string { + t := table.New() + t.SetHeader("ID", "Programmer Name", "Platform") + for _, prog := range p.Programmers { + t.AddRow(prog.GetId(), prog.GetName(), prog.GetPlatform()) + } + return t.Render() +} diff --git a/cli/cli.go b/cli/cli.go index 44504de44ed..deee144da45 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -22,8 +22,10 @@ import ( "strings" "github.com/arduino/arduino-cli/cli/board" + "github.com/arduino/arduino-cli/cli/burnbootloader" "github.com/arduino/arduino-cli/cli/cache" "github.com/arduino/arduino-cli/cli/compile" + "github.com/arduino/arduino-cli/cli/completion" "github.com/arduino/arduino-cli/cli/config" "github.com/arduino/arduino-cli/cli/core" "github.com/arduino/arduino-cli/cli/daemon" @@ -77,6 +79,7 @@ func createCliCommandTree(cmd *cobra.Command) { cmd.AddCommand(board.NewCommand()) cmd.AddCommand(cache.NewCommand()) cmd.AddCommand(compile.NewCommand()) + cmd.AddCommand(completion.NewCommand()) cmd.AddCommand(config.NewCommand()) cmd.AddCommand(core.NewCommand()) cmd.AddCommand(daemon.NewCommand()) @@ -85,6 +88,7 @@ func createCliCommandTree(cmd *cobra.Command) { cmd.AddCommand(sketch.NewCommand()) cmd.AddCommand(upload.NewCommand()) cmd.AddCommand(debug.NewCommand()) + cmd.AddCommand(burnbootloader.NewCommand()) cmd.AddCommand(version.NewCommand()) cmd.PersistentFlags().BoolVarP(&verbose, "verbose", "v", false, "Print the logs on the standard output.") diff --git a/cli/compile/compile.go b/cli/compile/compile.go index 7aeeb8c46f4..351563e20f5 100644 --- a/cli/compile/compile.go +++ b/cli/compile/compile.go @@ -50,6 +50,7 @@ var ( dryRun bool // Use this flag to now write the output file libraries []string // List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths. optimizeForDebug bool // Optimize compile output for debug, not for release + programmer string // Use the specified programmer to upload ) // NewCommand created a new `compile` command @@ -84,6 +85,7 @@ func NewCommand() *cobra.Command { command.Flags().StringSliceVar(&libraries, "libraries", []string{}, "List of custom libraries paths separated by commas. Or can be used multiple times for multiple libraries paths.") command.Flags().BoolVar(&optimizeForDebug, "optimize-for-debug", false, "Optional, optimize compile output for debug, not for release.") + command.Flags().StringVarP(&programmer, "programmer", "P", "", "Optional, use the specified programmer to upload.") return command } @@ -135,6 +137,7 @@ func run(cmd *cobra.Command, args []string) { Verbose: verbose, Verify: verify, ImportDir: exportDir, + Programmer: programmer, }, os.Stdout, os.Stderr) if err != nil { diff --git a/cli/completion/completion.go b/cli/completion/completion.go new file mode 100644 index 00000000000..ffe5472728e --- /dev/null +++ b/cli/completion/completion.go @@ -0,0 +1,76 @@ +// This file is part of arduino-cli. +// +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package completion + +import ( + "bytes" + "os" + "strings" + + "github.com/arduino/arduino-cli/cli/errorcodes" + "github.com/arduino/arduino-cli/cli/feedback" + "github.com/spf13/cobra" +) + +var ( + completionNoDesc bool //Disable completion description for shells that support it +) + +// NewCommand created a new `version` command +func NewCommand() *cobra.Command { + command := &cobra.Command{ + Use: "completion [bash|zsh|fish] [--no-descriptions]", + ValidArgs: []string{"bash", "zsh", "fish"}, + Args: cobra.ExactArgs(1), + Short: "Generates completion scripts", + Long: "Generates completion scripts for various shells", + Example: " " + os.Args[0] + " completion bash > completion.sh\n" + + " " + "source completion.sh", + Run: run, + } + command.Flags().BoolVar(&completionNoDesc, "no-descriptions", false, "Disable completion description for shells that support it") + + return command +} + +func run(cmd *cobra.Command, args []string) { + if completionNoDesc && (args[0] == "bash" || args[0] == "zsh") { + feedback.Errorf("Error: command description is not supported by %v", args[0]) + os.Exit(errorcodes.ErrGeneric) + } + switch args[0] { + case "bash": + cmd.Root().GenBashCompletion(os.Stdout) + break + case "zsh": + buf := new(bytes.Buffer) + cmd.Root().GenZshCompletion(buf) + // Next 3 lines are Hack, we'll wait new version of cobra with ZshV2Completion https://github.com/spf13/cobra/pull/1070 + //insert escaping before [ and ] + s := strings.ReplaceAll(buf.String(), "[", "\\[") + s = strings.ReplaceAll(s, "]", "\\]") + s = strings.ReplaceAll(s, "\\[1\\]", "[1]") // revert the case + os.Stdout.WriteString(s) + break + case "fish": + buf := new(bytes.Buffer) + cmd.Root().GenFishCompletion(buf, !completionNoDesc) + // Next 2 lines are Hack, fixed here https://github.com/spf13/cobra/pull/1122 + s := strings.ReplaceAll(buf.String(), "arduino-cli_comp", "arduino_cli_comp") //required because fish does not support env variables with "-" in the name + os.Stdout.WriteString(s) + break + } +} diff --git a/cli/core/install.go b/cli/core/install.go index 011ad7679bd..6bbcb958d32 100644 --- a/cli/core/install.go +++ b/cli/core/install.go @@ -61,13 +61,13 @@ func runInstallCommand(cmd *cobra.Command, args []string) { } for _, platformRef := range platformsRefs { - plattformInstallReq := &rpc.PlatformInstallReq{ + platformInstallReq := &rpc.PlatformInstallReq{ Instance: inst, PlatformPackage: platformRef.PackageName, Architecture: platformRef.Architecture, Version: platformRef.Version, } - _, err := core.PlatformInstall(context.Background(), plattformInstallReq, output.ProgressBar(), output.TaskProgress()) + _, err := core.PlatformInstall(context.Background(), platformInstallReq, output.ProgressBar(), output.TaskProgress()) if err != nil { feedback.Errorf("Error during install: %v", err) os.Exit(errorcodes.ErrGeneric) diff --git a/cli/core/search.go b/cli/core/search.go index 807bc7f216c..7175e3d66bb 100644 --- a/cli/core/search.go +++ b/cli/core/search.go @@ -60,7 +60,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) { resp, err := core.PlatformSearch(inst.GetId(), arguments, allVersions) if err != nil { - feedback.Errorf("Error saerching for platforms: %v", err) + feedback.Errorf("Error searching for platforms: %v", err) os.Exit(errorcodes.ErrGeneric) } diff --git a/cli/lib/search.go b/cli/lib/search.go index c57fb8d0ba0..e0538183f39 100644 --- a/cli/lib/search.go +++ b/cli/lib/search.go @@ -57,7 +57,7 @@ func runSearchCommand(cmd *cobra.Command, args []string) { Query: (strings.Join(args, " ")), }) if err != nil { - feedback.Errorf("Error saerching for Library: %v", err) + feedback.Errorf("Error searching for Library: %v", err) os.Exit(errorcodes.ErrGeneric) } diff --git a/cli/upload/upload.go b/cli/upload/upload.go index 0a09668cd49..5afd6510926 100644 --- a/cli/upload/upload.go +++ b/cli/upload/upload.go @@ -24,17 +24,20 @@ import ( "github.com/arduino/arduino-cli/cli/instance" "github.com/arduino/arduino-cli/commands/upload" rpc "github.com/arduino/arduino-cli/rpc/commands" + "github.com/arduino/arduino-cli/table" "github.com/arduino/go-paths-helper" "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) var ( - fqbn string - port string - verbose bool - verify bool - importDir string + fqbn string + port string + verbose bool + verify bool + importDir string + programmer string + burnBootloader bool ) // NewCommand created a new `upload` command @@ -53,6 +56,7 @@ func NewCommand() *cobra.Command { uploadCommand.Flags().StringVarP(&importDir, "input-dir", "", "", "Direcory containing binaries to upload.") uploadCommand.Flags().BoolVarP(&verify, "verify", "t", false, "Verify uploaded binary after the upload.") uploadCommand.Flags().BoolVarP(&verbose, "verbose", "v", false, "Optional, turns on verbose mode.") + uploadCommand.Flags().StringVarP(&programmer, "programmer", "P", "", "Optional, use the specified programmer to upload or 'list' to list supported programmers.") return uploadCommand } @@ -64,12 +68,44 @@ func run(command *cobra.Command, args []string) { os.Exit(errorcodes.ErrGeneric) } + if programmer == "list" { + resp, err := upload.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadReq{ + Instance: instance, + Fqbn: fqbn, + }) + if err != nil { + feedback.Errorf("Error listing programmers: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + feedback.PrintResult(&programmersList{ + Programmers: resp.GetProgrammers(), + }) + os.Exit(0) + } + var path *paths.Path if len(args) > 0 { path = paths.New(args[0]) } sketchPath := initSketchPath(path) + if burnBootloader { + if _, err := upload.Upload(context.Background(), &rpc.UploadReq{ + Instance: instance, + Fqbn: fqbn, + SketchPath: sketchPath.String(), + Port: port, + Verbose: verbose, + Verify: verify, + ImportDir: importDir, + Programmer: programmer, + }, os.Stdout, os.Stderr); err != nil { + feedback.Errorf("Error during Upload: %v", err) + os.Exit(errorcodes.ErrGeneric) + } + os.Exit(0) + } + if _, err := upload.Upload(context.Background(), &rpc.UploadReq{ Instance: instance, Fqbn: fqbn, @@ -78,6 +114,7 @@ func run(command *cobra.Command, args []string) { Verbose: verbose, Verify: verify, ImportDir: importDir, + Programmer: programmer, }, os.Stdout, os.Stderr); err != nil { feedback.Errorf("Error during Upload: %v", err) os.Exit(errorcodes.ErrGeneric) @@ -98,3 +135,20 @@ func initSketchPath(sketchPath *paths.Path) *paths.Path { logrus.Infof("Reading sketch from dir: %s", wd) return wd } + +type programmersList struct { + Programmers []*rpc.Programmer +} + +func (p *programmersList) Data() interface{} { + return p.Programmers +} + +func (p *programmersList) String() string { + t := table.New() + t.SetHeader("ID", "Programmer Name", "Platform") + for _, prog := range p.Programmers { + t.AddRow(prog.GetId(), prog.GetName(), prog.GetPlatform()) + } + return t.Render() +} diff --git a/commands/daemon/daemon.go b/commands/daemon/daemon.go index 2dd088beff9..5ade70e06e5 100644 --- a/commands/daemon/daemon.go +++ b/commands/daemon/daemon.go @@ -216,6 +216,24 @@ func (s *ArduinoCoreServerImpl) Upload(req *rpc.UploadReq, stream rpc.ArduinoCor return stream.Send(resp) } +// BurnBootloader FIXMEDOC +func (s *ArduinoCoreServerImpl) BurnBootloader(req *rpc.BurnBootloaderReq, stream rpc.ArduinoCore_BurnBootloaderServer) error { + resp, err := upload.BurnBootloader( + stream.Context(), req, + utils.FeedStreamTo(func(data []byte) { stream.Send(&rpc.BurnBootloaderResp{OutStream: data}) }), + utils.FeedStreamTo(func(data []byte) { stream.Send(&rpc.BurnBootloaderResp{ErrStream: data}) }), + ) + if err != nil { + return err + } + return stream.Send(resp) +} + +// ListProgrammersAvailableForUpload FIXMEDOC +func (s *ArduinoCoreServerImpl) ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadReq) (*rpc.ListProgrammersAvailableForUploadResp, error) { + return upload.ListProgrammersAvailableForUpload(ctx, req) +} + // LibraryDownload FIXMEDOC func (s *ArduinoCoreServerImpl) LibraryDownload(req *rpc.LibraryDownloadReq, stream rpc.ArduinoCore_LibraryDownloadServer) error { resp, err := lib.LibraryDownload( diff --git a/commands/upload/burnbootloader.go b/commands/upload/burnbootloader.go new file mode 100644 index 00000000000..212c1f50ff7 --- /dev/null +++ b/commands/upload/burnbootloader.go @@ -0,0 +1,54 @@ +// This file is part of arduino-cli. +// +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package upload + +import ( + "context" + "io" + + "github.com/arduino/arduino-cli/commands" + rpc "github.com/arduino/arduino-cli/rpc/commands" + "github.com/sirupsen/logrus" +) + +// BurnBootloader FIXMEDOC +func BurnBootloader(ctx context.Context, req *rpc.BurnBootloaderReq, outStream io.Writer, errStream io.Writer) (*rpc.BurnBootloaderResp, error) { + logrus. + WithField("fqbn", req.GetFqbn()). + WithField("port", req.GetPort()). + WithField("programmer", req.GetProgrammer()). + Trace("BurnBootloader started", req.GetFqbn()) + + pm := commands.GetPackageManager(req.GetInstance().GetId()) + + err := runProgramAction( + pm, + nil, // sketch + "", // importDir + req.GetFqbn(), + req.GetPort(), + req.GetProgrammer(), + req.GetVerbose(), + req.GetVerify(), + true, // burnBootloader + outStream, + errStream, + ) + if err != nil { + return nil, err + } + return &rpc.BurnBootloaderResp{}, nil +} diff --git a/commands/upload/programmers_list.go b/commands/upload/programmers_list.go new file mode 100644 index 00000000000..9cb74c535b2 --- /dev/null +++ b/commands/upload/programmers_list.go @@ -0,0 +1,66 @@ +// This file is part of arduino-cli. +// +// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +// +// This software is released under the GNU General Public License version 3, +// which covers the main part of arduino-cli. +// The terms of this license can be found at: +// https://www.gnu.org/licenses/gpl-3.0.en.html +// +// You can be released from the requirements of the above licenses by purchasing +// a commercial license. Buying such a license is mandatory if you want to +// modify or otherwise use the software for commercial activities involving the +// Arduino software without disclosing the source code of your own applications. +// To purchase a commercial license, send an email to license@arduino.cc. + +package upload + +import ( + "context" + "fmt" + + "github.com/arduino/arduino-cli/arduino/cores" + "github.com/arduino/arduino-cli/commands" + rpc "github.com/arduino/arduino-cli/rpc/commands" +) + +// ListProgrammersAvailableForUpload FIXMEDOC +func ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadReq) (*rpc.ListProgrammersAvailableForUploadResp, error) { + pm := commands.GetPackageManager(req.GetInstance().GetId()) + + fqbnIn := req.GetFqbn() + if fqbnIn == "" { + return nil, fmt.Errorf("no Fully Qualified Board Name provided") + } + fqbn, err := cores.ParseFQBN(fqbnIn) + if err != nil { + return nil, fmt.Errorf("incorrect FQBN: %s", err) + } + + // Find target platforms + _, platform, _, _, refPlatform, err := pm.ResolveFQBN(fqbn) + if err != nil { + return nil, fmt.Errorf("incorrect FQBN: %s", err) + } + + result := []*rpc.Programmer{} + createRPCProgrammer := func(id string, programmer *cores.Programmer) *rpc.Programmer { + return &rpc.Programmer{ + Id: id, + Platform: programmer.PlatformRelease.String(), + Name: programmer.Name, + } + } + if refPlatform != platform { + for id, programmer := range refPlatform.Programmers { + result = append(result, createRPCProgrammer(id, programmer)) + } + } + for id, programmer := range platform.Programmers { + result = append(result, createRPCProgrammer(id, programmer)) + } + + return &rpc.ListProgrammersAvailableForUploadResp{ + Programmers: result, + }, nil +} diff --git a/commands/upload/upload.go b/commands/upload/upload.go index b2af6eae18f..99fe3643280 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -24,6 +24,7 @@ import ( "time" "github.com/arduino/arduino-cli/arduino/cores" + "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/arduino/sketches" "github.com/arduino/arduino-cli/cli/feedback" "github.com/arduino/arduino-cli/commands" @@ -50,75 +51,144 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr return nil, fmt.Errorf("opening sketch: %s", err) } + pm := commands.GetPackageManager(req.GetInstance().GetId()) + + err = runProgramAction( + pm, + sketch, + req.GetImportDir(), + req.GetFqbn(), + req.GetPort(), + req.GetProgrammer(), + req.GetVerbose(), + req.GetVerify(), + false, // burnBootloader + outStream, + errStream, + ) + if err != nil { + return nil, err + } + return &rpc.UploadResp{}, nil +} + +func runProgramAction(pm *packagemanager.PackageManager, + sketch *sketches.Sketch, importDir string, fqbnIn string, port string, + programmerID string, + verbose, verify, burnBootloader bool, + outStream io.Writer, errStream io.Writer) error { + + if burnBootloader && programmerID == "" { + return fmt.Errorf("no programmer specified for burning bootloader") + } + // FIXME: make a specification on how a port is specified via command line - port := req.GetPort() if port == "" && sketch != nil && sketch.Metadata != nil { deviceURI, err := url.Parse(sketch.Metadata.CPU.Port) if err != nil { - return nil, fmt.Errorf("invalid Device URL format: %s", err) + return fmt.Errorf("invalid Device URL format: %s", err) } if deviceURI.Scheme == "serial" { port = deviceURI.Host + deviceURI.Path } } - if port == "" { - return nil, fmt.Errorf("no upload port provided") - } + logrus.WithField("port", port).Tracef("Upload port") - fqbnIn := req.GetFqbn() if fqbnIn == "" && sketch != nil && sketch.Metadata != nil { fqbnIn = sketch.Metadata.CPU.Fqbn } if fqbnIn == "" { - return nil, fmt.Errorf("no Fully Qualified Board Name provided") + return fmt.Errorf("no Fully Qualified Board Name provided") } fqbn, err := cores.ParseFQBN(fqbnIn) if err != nil { - return nil, fmt.Errorf("incorrect FQBN: %s", err) + return fmt.Errorf("incorrect FQBN: %s", err) } - - pm := commands.GetPackageManager(req.GetInstance().GetId()) + logrus.WithField("fqbn", fqbn).Tracef("Detected FQBN") // Find target board and board properties - _, _, board, boardProperties, _, err := pm.ResolveFQBN(fqbn) + _, boardPlatform, board, boardProperties, buildPlatform, err := pm.ResolveFQBN(fqbn) if err != nil { - return nil, fmt.Errorf("incorrect FQBN: %s", err) + return fmt.Errorf("incorrect FQBN: %s", err) } - - // Load programmer tool - uploadToolPattern, have := boardProperties.GetOk("upload.tool") - if !have || uploadToolPattern == "" { - return nil, fmt.Errorf("cannot get programmer tool: undefined 'upload.tool' property") + logrus. + WithField("boardPlatform", boardPlatform). + WithField("board", board). + WithField("buildPlatform", buildPlatform). + Tracef("Upload data") + + // Load upload tool definitions + var uploadToolName string + var uploadToolPlatform *cores.PlatformRelease + var programmer *cores.Programmer + + if burnBootloader { + uploadToolName = boardProperties.Get("bootloader.tool") + uploadToolPlatform = boardPlatform + if uploadToolName == "" { + return fmt.Errorf("cannot get programmer tool: undefined 'bootloader.tool' in boards.txt") + } + logrus. + WithField("uploadToolName", uploadToolName). + WithField("uploadToolPlatform", uploadToolPlatform). + Trace("Upload tool from 'bootloader.tool' property") } - var referencedPlatformRelease *cores.PlatformRelease - if split := strings.Split(uploadToolPattern, ":"); len(split) > 2 { - return nil, fmt.Errorf("invalid 'upload.tool' property: %s", uploadToolPattern) - } else if len(split) == 2 { - referencedPackageName := split[0] - uploadToolPattern = split[1] - architecture := board.PlatformRelease.Platform.Architecture - - if referencedPackage := pm.Packages[referencedPackageName]; referencedPackage == nil { - return nil, fmt.Errorf("required platform %s:%s not installed", referencedPackageName, architecture) - } else if referencedPlatform := referencedPackage.Platforms[architecture]; referencedPlatform == nil { - return nil, fmt.Errorf("required platform %s:%s not installed", referencedPackageName, architecture) - } else { - referencedPlatformRelease = pm.GetInstalledPlatformRelease(referencedPlatform) + if programmerID != "" { + programmer = boardPlatform.Programmers[programmerID] + if programmer == nil { + // Try to find the programmer in the referenced build platform + programmer = buildPlatform.Programmers[programmerID] } + if programmer == nil { + return fmt.Errorf("programmer '%s' not available", programmerID) + } + uploadToolName = programmer.Properties.Get("program.tool") + uploadToolPlatform = programmer.PlatformRelease + if uploadToolName == "" { + return fmt.Errorf("cannot get programmer tool: undefined 'program.tool' property") + } + logrus. + WithField("uploadToolName", uploadToolName). + WithField("uploadToolPlatform", uploadToolPlatform). + Trace("Upload tool from --programmer parameter") + } else { + uploadToolName = boardProperties.Get("upload.tool") + uploadToolPlatform = boardPlatform + if uploadToolName == "" { + return fmt.Errorf("cannot get upload tool: undefined 'upload.tool' property") + } + if split := strings.Split(uploadToolName, ":"); len(split) > 2 { + return fmt.Errorf("invalid 'upload.tool' property: %s", uploadToolName) + } else if len(split) == 2 { + uploadToolName = split[1] + uploadToolPlatform = pm.GetInstalledPlatformRelease( + pm.FindPlatform(&packagemanager.PlatformReference{ + Package: split[0], + PlatformArchitecture: boardPlatform.Platform.Architecture, + }), + ) + } + logrus. + WithField("uploadToolName", uploadToolName). + WithField("uploadToolPlatform", uploadToolPlatform). + Trace("Upload tool") } // Build configuration for upload uploadProperties := properties.NewMap() - if referencedPlatformRelease != nil { - uploadProperties.Merge(referencedPlatformRelease.Properties) + if uploadToolPlatform != nil { + uploadProperties.Merge(uploadToolPlatform.Properties) } - uploadProperties.Merge(board.PlatformRelease.Properties) - uploadProperties.Merge(board.PlatformRelease.RuntimeProperties()) + uploadProperties.Merge(boardPlatform.Properties) + uploadProperties.Merge(boardPlatform.RuntimeProperties()) uploadProperties.Merge(boardProperties) - uploadToolProperties := uploadProperties.SubTree("tools." + uploadToolPattern) + uploadToolProperties := uploadProperties.SubTree("tools." + uploadToolName) uploadProperties.Merge(uploadToolProperties) + if programmer != nil { + uploadProperties.Merge(programmer.Properties) + } if requiredTools, err := pm.FindToolsRequiredForBoard(board); err == nil { for _, requiredTool := range requiredTools { @@ -128,112 +198,179 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr } // Set properties for verbose upload - if req.GetVerbose() { + if verbose { if v, ok := uploadProperties.GetOk("upload.params.verbose"); ok { uploadProperties.Set("upload.verbose", v) } + if v, ok := uploadProperties.GetOk("program.params.verbose"); ok { + uploadProperties.Set("program.verbose", v) + } + if v, ok := uploadProperties.GetOk("erase.params.verbose"); ok { + uploadProperties.Set("erase.verbose", v) + } + if v, ok := uploadProperties.GetOk("bootloader.params.verbose"); ok { + uploadProperties.Set("bootloader.verbose", v) + } } else { if v, ok := uploadProperties.GetOk("upload.params.quiet"); ok { uploadProperties.Set("upload.verbose", v) } + if v, ok := uploadProperties.GetOk("program.params.quiet"); ok { + uploadProperties.Set("program.verbose", v) + } + if v, ok := uploadProperties.GetOk("erase.params.quiet"); ok { + uploadProperties.Set("erase.verbose", v) + } + if v, ok := uploadProperties.GetOk("bootloader.params.quiet"); ok { + uploadProperties.Set("bootloader.verbose", v) + } } // Set properties for verify - if req.GetVerify() { + if verify { uploadProperties.Set("upload.verify", uploadProperties.Get("upload.params.verify")) + uploadProperties.Set("program.verify", uploadProperties.Get("program.params.verify")) } else { uploadProperties.Set("upload.verify", uploadProperties.Get("upload.params.noverify")) + uploadProperties.Set("program.verify", uploadProperties.Get("program.params.noverify")) } var importPath *paths.Path - if importDir := req.GetImportDir(); importDir != "" { - importPath = paths.New(importDir) - } else { - // TODO: Create a function to obtain importPath from sketch - importPath = sketch.FullPath - // Add FQBN (without configs part) to export path - fqbnSuffix := strings.Replace(fqbn.StringWithoutConfig(), ":", ".", -1) - importPath = importPath.Join("build").Join(fqbnSuffix) - } + if !burnBootloader { + if sketch == nil { + return fmt.Errorf(("no sketch specified")) + } - if !importPath.Exist() { - return nil, fmt.Errorf("compiled sketch not found in %s", importPath) - } - if !importPath.IsDir() { - return nil, fmt.Errorf("expected compiled sketch in directory %s, but is a file instead", importPath) - } - uploadProperties.SetPath("build.path", importPath) - uploadProperties.Set("build.project_name", sketch.Name+".ino") + if importDir != "" { + importPath = paths.New(importDir) + } else { + // TODO: Create a function to obtain importPath from sketch + importPath = sketch.FullPath + // Add FQBN (without configs part) to export path + fqbnSuffix := strings.Replace(fqbn.StringWithoutConfig(), ":", ".", -1) + importPath = importPath.Join("build").Join(fqbnSuffix) + } - // Perform reset via 1200bps touch if requested - if uploadProperties.GetBoolean("upload.use_1200bps_touch") { - ports, err := serial.GetPortsList() - if err != nil { - return nil, fmt.Errorf("cannot get serial port list: %s", err) + if !importPath.Exist() { + return fmt.Errorf("compiled sketch not found in %s", importPath) } - for _, p := range ports { - if p == port { - if req.GetVerbose() { - outStream.Write([]byte(fmt.Sprintf("Performing 1200-bps touch reset on serial port %s", p))) - outStream.Write([]byte(fmt.Sprintln())) - } - if err := touchSerialPortAt1200bps(p); err != nil { - return nil, fmt.Errorf("cannot perform reset: %s", err) + if !importPath.IsDir() { + return fmt.Errorf("expected compiled sketch in directory %s, but is a file instead", importPath) + } + uploadProperties.SetPath("build.path", importPath) + uploadProperties.Set("build.project_name", sketch.Name+".ino") + } + + // If not using programmer perform some action required + // to set the board in bootloader mode + actualPort := port + if programmer == nil && !burnBootloader { + // Perform reset via 1200bps touch if requested + if uploadProperties.GetBoolean("upload.use_1200bps_touch") { + if port == "" { + return fmt.Errorf("no upload port provided") + } + + ports, err := serial.GetPortsList() + if err != nil { + return fmt.Errorf("cannot get serial port list: %s", err) + } + for _, p := range ports { + if p == port { + if verbose { + outStream.Write([]byte(fmt.Sprintf("Performing 1200-bps touch reset on serial port %s", p))) + outStream.Write([]byte(fmt.Sprintln())) + } + if err := touchSerialPortAt1200bps(p); err != nil { + return fmt.Errorf("cannot perform reset: %s", err) + } + break } - break } + + // Scanning for available ports seems to open the port or + // otherwise assert DTR, which would cancel the WDT reset if + // it happened within 250 ms. So we wait until the reset should + // have already occurred before we start scanning. + time.Sleep(500 * time.Millisecond) } - // Scanning for available ports seems to open the port or - // otherwise assert DTR, which would cancel the WDT reset if - // it happened within 250 ms. So we wait until the reset should - // have already occurred before we start scanning. - time.Sleep(500 * time.Millisecond) - } + // Wait for upload port if requested + if uploadProperties.GetBoolean("upload.wait_for_upload_port") { + if verbose { + outStream.Write([]byte(fmt.Sprintln("Waiting for upload port..."))) + } + if p, err := waitForNewSerialPort(); err != nil { + return fmt.Errorf("cannot detect serial ports: %s", err) + } else if p == "" { + feedback.Print("No new serial port detected.") + } else { + actualPort = p + } - // Wait for upload port if requested - actualPort := port // default - if uploadProperties.GetBoolean("upload.wait_for_upload_port") { - if req.GetVerbose() { - outStream.Write([]byte(fmt.Sprintln("Waiting for upload port..."))) + // on OS X, if the port is opened too quickly after it is detected, + // a "Resource busy" error occurs, add a delay to workaround. + // This apply to other platforms as well. + time.Sleep(500 * time.Millisecond) } - if p, err := waitForNewSerialPort(); err != nil { - return nil, fmt.Errorf("cannot detect serial ports: %s", err) - } else if p == "" { - feedback.Print("No new serial port detected.") + } + + if port != "" { + // Set serial port property + uploadProperties.Set("serial.port", actualPort) + if strings.HasPrefix(actualPort, "/dev/") { + uploadProperties.Set("serial.port.file", actualPort[5:]) } else { - actualPort = p + uploadProperties.Set("serial.port.file", actualPort) } - - // on OS X, if the port is opened too quickly after it is detected, - // a "Resource busy" error occurs, add a delay to workaround. - // This apply to other platforms as well. - time.Sleep(500 * time.Millisecond) } - // Set serial port property - uploadProperties.Set("serial.port", actualPort) - if strings.HasPrefix(actualPort, "/dev/") { - uploadProperties.Set("serial.port.file", actualPort[5:]) + // Build recipe for upload + if burnBootloader { + if err := runTool("erase.pattern", uploadProperties, outStream, errStream, verbose); err != nil { + return fmt.Errorf("chip erase error: %s", err) + } + if err := runTool("bootloader.pattern", uploadProperties, outStream, errStream, verbose); err != nil { + return fmt.Errorf("burn bootloader error: %s", err) + } + } else if programmer != nil { + if err := runTool("program.pattern", uploadProperties, outStream, errStream, verbose); err != nil { + return fmt.Errorf("programming error: %s", err) + } } else { - uploadProperties.Set("serial.port.file", actualPort) + if err := runTool("upload.pattern", uploadProperties, outStream, errStream, verbose); err != nil { + return fmt.Errorf("uploading error: %s", err) + } } - // Build recipe for upload - recipe := uploadProperties.Get("upload.pattern") - cmdLine := uploadProperties.ExpandPropsInString(recipe) + logrus.Tracef("Upload successful") + return nil +} + +func runTool(recipeID string, props *properties.Map, outStream, errStream io.Writer, verbose bool) error { + recipe, ok := props.GetOk(recipeID) + if !ok { + return fmt.Errorf("recipe not found '%s'", recipeID) + } + if strings.TrimSpace(recipe) == "" { + return nil // Nothing to run + } + if props.IsProertyMissingInExpandPropsInString("serial.port", recipe) { + return fmt.Errorf("no upload port provided") + } + cmdLine := props.ExpandPropsInString(recipe) cmdArgs, err := properties.SplitQuotedString(cmdLine, `"'`, false) if err != nil { - return nil, fmt.Errorf("invalid recipe '%s': %s", recipe, err) + return fmt.Errorf("invalid recipe '%s': %s", recipe, err) } // Run Tool - if req.GetVerbose() { + if verbose { outStream.Write([]byte(fmt.Sprintln(cmdLine))) } cmd, err := executils.Command(cmdArgs) if err != nil { - return nil, fmt.Errorf("cannot execute upload tool: %s", err) + return fmt.Errorf("cannot execute upload tool: %s", err) } executils.AttachStdoutListener(cmd, executils.PrintToStdout) @@ -242,16 +379,14 @@ func Upload(ctx context.Context, req *rpc.UploadReq, outStream io.Writer, errStr cmd.Stderr = errStream if err := cmd.Start(); err != nil { - return nil, fmt.Errorf("cannot execute upload tool: %s", err) + return fmt.Errorf("cannot execute upload tool: %s", err) } if err := cmd.Wait(); err != nil { - return nil, fmt.Errorf("uploading error: %s", err) + return fmt.Errorf("uploading error: %s", err) } - logrus.Tracef("Upload %s on %s successful", sketch.Name, fqbnIn) - - return &rpc.UploadResp{}, nil + return nil } func touchSerialPortAt1200bps(port string) error { diff --git a/configuration/configuration.go b/configuration/configuration.go index 66c089bd162..02924d3de81 100644 --- a/configuration/configuration.go +++ b/configuration/configuration.go @@ -22,6 +22,7 @@ import ( "strings" "github.com/arduino/arduino-cli/cli/feedback" + paths "github.com/arduino/go-paths-helper" "github.com/arduino/go-win32-utils" "github.com/sirupsen/logrus" jww "github.com/spf13/jwalterweatherman" @@ -151,7 +152,8 @@ func IsBundledInDesktopIDE() bool { return false } - ideDir := filepath.Dir(executablePath) + ideDir := paths.New(executablePath).Parent() + logrus.WithField("dir", ideDir).Trace("Candidate IDE directory") // To determine if the CLI is bundled with an IDE, We check an arbitrary // number of folders that are part of the IDE install tree @@ -161,20 +163,21 @@ func IsBundledInDesktopIDE() bool { } for _, test := range tests { - if _, err := os.Stat(filepath.Join(ideDir, test)); err != nil { + if !ideDir.Join(test).Exist() { // the test folder doesn't exist or is not accessible return false } } - // the CLI is bundled in the Arduino IDE + logrus.Info("The CLI is bundled in the Arduino IDE") // Persist IDE-related config settings viper.Set("IDE.Bundled", true) viper.Set("IDE.Directory", ideDir) // Check whether this is a portable install - if _, err := os.Stat(filepath.Join(ideDir, "portable")); err != nil { + if ideDir.Join("portable").Exist() { + logrus.Info("The IDE installation is 'portable'") viper.Set("IDE.Portable", true) } diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index fbac0fd703e..b744fd3bdff 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -9,6 +9,27 @@ repository. To propose improvements or fix a bug, feel free to submit a PR. Before we can accept your contributions you have to sign the [Contributor License Agreement][0] +## Pull Requests + +In order to ease code reviews and have your contributions merged faster, here is +a list of items you can check before submitting a PR: + +* Create small PRs that are narrowly focused on addressing a single concern. +* PR titles indirectly become part of the CHANGELOG so it's crucial to provide a + good record of **what** change is being made in the title; **why** it was made + will go in the PR description, along with a link to a GitHub issue if it + exists. +* Write tests for the code you wrote. +* Open your PR against the `master` branch. +* Maintain **clean commit history** and use **meaningful commit messages**. + PRs with messy commit history are difficult to review and require a lot of + work to be merged. +* Your PR must pass all CI tests before we will merge it. If you're seeing an + error and don't think + it's your fault, it may not be! The reviewer will help you if there are test + failures that seem + not related to the change you are making. + ## Prerequisites To build the Arduino CLI from sources you need the following tools to be @@ -141,54 +162,139 @@ task test-integration ## Working on docs -Documentation consists of several Markdown files stored under the `docs` folder -at the root of the repo. Some of those files are automatically generated in the -CI pipeline that builds the documentation website so you won't find them in the -git repository and you need to generate them locally. +Documentation is provided to final users in form of static HTML content generated +from a tool called [MkDocs][9] and hosted on [GitHub Pages][7]. + +### Local development -If you're working on docs and your changes are not trivial, you might want to -preview the documentation website locally, before opening a Pull Request. To run -the docs toolchain locally you need to have: +Most of the documentation consists of static content written over several +Markdown files under the `docs` folder at the root of this git repository but +some other content is dynamically generated from the CI pipelines - this is the +case with the command line reference and the gRPC interface, for example. + +If you want to check out how the documentation would look after some local +changes, you might need to reproduce what happens in the CI, generating the full +documentation website from your personal computer. To run the docs toolchain +locally, you need to have a few dependencies and tools installed: * [Go][1] version 1.12 or later * [Taskfile][2] to help you run the most common tasks from the command line -* A working [Python][3] environment, version 3.5 or later +* A working [Python][3] environment, see [this paragraph](#integration-tests) + if you need to setup one -Before running the toolchain, perform the following operations: +Before running the toolchain, perform the following operations from the root of +the git repository (if you have a Python virtual environment, activate it before +proceeding): * go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc +* pip install -r requirements_docs.txt When working on docs, you can launch a command that will take care of generating the docs, build the static website and start a local server you can -access with your browser to see a preview of your changes - to launch this -command do: +later access with a web browser to see a preview of your changes. From the root +of the git repository run: ```shell task docs:serve ``` -If you don't see any error, hit http://127.0.0.1:8000 with your browser. +If you don't see any error, hit http://127.0.0.1:8000 with your browser to +navigate the generated docs. -## Pull Requests +### Docs publishing -In order to ease code reviews and have your contributions merged faster, here is -a list of items you can check before submitting a PR: +The present git repository has a special branch called `gh-pages` that contains +the generated HTML code for the docs website; every time a change is pushed to +this special branch, GitHub automatically triggers a [deployment][8] to pull the +change and publish a new version of the website. Do not open Pull Requests to +push changes to the `gh-pages` branch, that will be done exclusively from the +CI. -* Create small PRs that are narrowly focused on addressing a single concern. -* PR titles indirectly become part of the CHANGELOG so it's crucial to provide a - good record of **what** change is being made in the title; **why** it was made - will go in the PR description, along with a link to a GitHub issue if it - exists. -* Write tests for the code you wrote. -* Open your PR against the `master` branch. -* Maintain **clean commit history** and use **meaningful commit messages**. - PRs with messy commit history are difficult to review and require a lot of - work to be merged. -* Your PR must pass all CI tests before we will merge it. If you're seeing an - error and don't think - it's your fault, it may not be! The reviewer will help you if there are test - failures that seem - not related to the change you are making. +### Docs versioning + +In order to provide support for multiple Arduino CLI releases, Documentation is +versioned so that visitors can select which version of the documentation website +should be displayed. Unfortunately this feature isn't provided by GitHub pages +or MkDocs, so we had to implement it on top of the generation process. + +Before delving into the details of the generation process, here follow some +requirements that were established to provide versioned documentation: + +* A special version of the documentation called `dev` is provided to reflect the + status of the Arduino CLI on the `master` branch - this includes unreleased + features and bugfixes. +* Docs are versioned after the minor version of an Arduino CLI release. For + example, Arduino CLI `0.99.1` and `0.99.2` will be both covered by + documentation version `0.99`. +* The landing page of the documentation website will automatically redirect + visitors to the most recently released version of the Arduino CLI. + +To implement the requirements above, the execution of MkDocs is wrapped using a +CLI tool called [Mike][10] that does a few things for us: + +* It runs MkDocs targeting subfolders named after the Arduino CLI version, e.g. + documentation for version `0.10.1` can be found under the folder `0.10`. +* It injects an HTML control into the documentation website that lets visitors + choose which version of the docs to browse from a dropdown list. +* It provides a redirect to a version we decide when visitors hit the landing + page of the documentation website. +* It pushes generated contents to the `gh-pages` branch. + +> **Note:** unless you're working on the generation process itself, you should +> never run Mike from a local environment, either directly or through the Task +> `docs:publish`. This might result in unwanted changes to the public website. + +### Docs automation + +In order to avoid unwanted changes to the public website hosting the Arduino +CLI documentation, only Mike is allowed to push changes to the `gh-pages` branch, +and this only happens from within the CI, in a workflow named [docs][11]. + +The CI is responsible for guessing which version of the Arduino CLI we're +building docs for, so that generated contents will be stored in the appropriate +section of the documentation website. Because this guessing might be fairly +complex, the logic is implemented in a Python script called [`build.py`][12]. +The script will determine the version of the Arduino CLI that was modified in +the current commit (either `dev` or an official, numbered release) and whether +the redirect to the latest version that happens on the landing page should be +updated or not. + +## Internationalization (i18n) + +In order to support i18n in the cli, any messages that are intended to be translated +should be wrapped in a call to `i18n.Tr`. This call allows us to build a catalog of +translatable strings, replacing the reference string at runtime with the localized value. + +Adding or modifying these messages requires an i18n update, as this process creates the +reference catalog that are shared with translators. For that reason, the `task check` +command will fail if the catalog was not updated to sync with changes to the source code. + +To update the catalog, execute the following command and commit the changes. + +```shell +task i18n:update +``` + +To verify that the catalog is up-to-date, you may execute the command: + +```shell +task i18n:check +``` + +Example usage: + +```golang +package main + +import ( + "fmt" + "github.com/arduino/arduino-cli/i18n" +) + +func main() { + fmt.Println(i18n.Tr("Hello World!")) +} +``` ## Additional settings @@ -206,4 +312,10 @@ title with the string **[skip changelog]** [3]: https://www.python.org/downloads/ [4]: https://docs.python.org/3/tutorial/venv.html [5]: https://github.com/ofek/hatch -[6]: https://github.com/protocolbuffers/protobuf/releases \ No newline at end of file +[6]: https://github.com/protocolbuffers/protobuf/releases +[7]: https://pages.github.com/ +[8]: https://github.com/arduino/arduino-cli/deployments?environment=github-pages#activity-log +[9]: https://www.mkdocs.org/ +[10]: https://github.com/jimporter/mike +[11]: https://github.com/arduino/arduino-cli/blob/master/.github/workflows/docs.yaml +[12]: https://github.com/arduino/arduino-cli/blob/master/docs/build.py diff --git a/docs/command-line-completion.md b/docs/command-line-completion.md new file mode 100644 index 00000000000..35455e7c90e --- /dev/null +++ b/docs/command-line-completion.md @@ -0,0 +1,45 @@ +`arduino-cli` supports command-line completion (also known as *tab completion*) for basic commands. +Currently only `bash`, `zsh`, `fish` shells are supported + +### Before you start +In order to generate the file required to make the completion work you have to [install](installation.md) Arduino CLI first. + +### Generate the completion file +To generate the completion file you can use `arduino-cli completion [bash|zsh|fish] [--no-descriptions]`. +By default this command will print on the standard output (the shell window) the content of the completion file. To save to an actual file use the `>` redirect symbol. + +### Bash +Use `arduino-cli completion bash > arduino-cli.sh` to generate the completion file. +At this point you can move that file in `/etc/bash_completion.d/` (root access is required) with `sudo mv arduino-cli.sh /etc/bash_completion.d/`. + +A not recommended alternative is to source the completion file in `.bashrc`. + +Remember to open a new shell to test the functionality + +### Zsh +Use `arduino-cli completion zsh > _arduino-cli` to generate the completion file. +At this point you can place the file in a directory listed in your `fpath` if you have already created a directory to store your completion. + +Or if you want you can create a directory, add it to your `fpath` and copy the file in it: + +1. `mkdir ~/completion_zsh` +2. add `fpath=($HOME/completion_zsh $fpath)` at the beginning of your `.zshrc` file +3. `mv _arduino-cli ~/completion_zsh/` + +Remember to open a new shell to test the functionality + +*N.B.* +The Zsh completion is working with [Oh-My-Zsh](https://ohmyz.sh/) but not with [Prezto](https://github.com/sorin-ionescu/prezto) (the zsh completion system is working in a different way than classic zsh). But hopefully it will be fixed in the future + +### Fish +Use `arduino-cli completion fish > arduino-cli.fish` to generate the completion file. +At this point you can place the file in `~/.config/fish/completions` as stated in the [official documentation](http://fishshell.com/docs/current/index.html#where-to-put-completions). +Remember to create the directory if it's not already there `mkdir -p ~/.config/fish/completions/` and then place the completion file in there with `mv arduino-cli.fish ~/.config/fish/completions/` + +Remember to open a new shell to test the functionality + +#### Disabling command and flag descriptions +By default fish completion has command and flag description enabled by default. If you want to disable this behaviour you can simply pass the `--no-descriptions` flag when calling `completion` command and the generated file will not have descriptions + +*N.B.* +This flag is not compatible with bash or zsh diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 00000000000..020395ff433 --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,160 @@ +## Configuration keys + +* `board_manager` + * `additional_urls` - the URLs to any additional Board Manager package index + files needed for your boards platforms. +* `daemon` - options related to running Arduino CLI as a [gRPC] server. + * `port` - TCP port used for gRPC client connections. +* `directories` - directories used by Arduino CLI. + * `data` - directory used to store Board/Library Manager index files and + Board Manager platform installations. + * `downloads` - directory used to stage downloaded archives during + Board/Library Manager installations. + * `user` - the equivalent of the Arduino IDE's + ["sketchbook" directory][sketchbook directory]. Library Manager + installations are made to the `libraries` subdirectory of the user + directory. +* `logging` - configuration options for Arduino CLI's logs. + * `file` - path to the file where logs will be written. + * `format` - output format for the logs. Allowed values are `text` or + `json`. + * `level` - messages with this level and above will be logged. Valid levels + are: `trace`, `debug`, `info`, `warn`, `error`, `fatal`, `panic`. +* `telemetry` - settings related to the collection of data used for continued +improvement of Arduino CLI. + * `addr` - TCP port used for telemetry communication. + * `enabled` - controls the use of telemetry. + +## Configuration methods + +Arduino CLI may be configured in three ways: + +1. Command line flags +1. Environment variables +1. Configuration file + +If a configuration option is configured by multiple methods, the value set by +the method highest on the above list overwrites the ones below it. + +If a configuration option is not set, Arduino CLI uses a default value. + +[`arduino-cli config dump`][arduino-cli config dump] displays the current +configuration values. + +### Command line flags + +Arduino CLI's command line flags are documented in the command line help and the +[Arduino CLI command reference]. + +#### Example + +Setting an additional Board Manager URL using the +[`--additional-urls`][arduino-cli global flags] command line flag: + +```shell +$ arduino-cli core update-index --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json +``` + +### Environment variables + +All configuration options can be set via environment variables. The variable +names start with `ARDUINO`, followed by the configuration key names, with each +component separated by `_`. For example, the `ARDUINO_DIRECTORIES_USER` +environment variable sets the `directories.user` configuration option. + +On Linux or macOS, you can use the [`export` command][export command] to set +environment variables. On Windows cmd, you can use the +[`set` command][set command]. + +#### Example + +Setting an additional Board Manager URL using the +`ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS` environment variable: + +```sh +$ export ARDUINO_BOARD_MANAGER_ADDITIONAL_URLS=https://downloads.arduino.cc/packages/package_staging_index.json +``` + +### Configuration file + +[`arduino-cli config init`][arduino-cli config init] creates or updates a +configuration file with the current configuration settings. + +This allows saving the options set by command line flags or environment +variables. For example: + +```sh +arduino-cli config init --additional-urls https://downloads.arduino.cc/packages/package_staging_index.json +``` + +#### File name + +The configuration file must be named `arduino-cli`, with the appropriate file +extension for the file's format. + +#### Supported formats + +`arduino-cli config init` creates a YAML file, however a variety of common +formats are supported: + +* [JSON] +* [TOML] +* [YAML] +* [Java properties file] +* [HCL] +* envfile +* [INI] + +#### Locations + +Configuration files in the following locations are recognized by Arduino CLI: + +1. Location specified by the [`--config-file`][Arduino CLI command reference] +command line flag +1. Current working directory +1. Any parent directory of the current working directory (more immediate parents +having higher precedence) +1. Arduino CLI data directory (as configured by `directories.data`) + +If multiple configuration files are present, the one highest on the above list +is used. Configuration files are not combined. + +The location of the active configuration file can be determined by running the +command: + +```sh +arduino-cli config dump --verbose +``` + +#### Example + +Setting an additional Board Manager URL using a YAML format configuration file: + +```yaml +board_manager: + additional_urls: + - https://downloads.arduino.cc/packages/package_staging_index.json +``` + +Doing the same using a TOML format file: + +```toml +[board_manager] +additional_urls = [ "https://downloads.arduino.cc/packages/package_staging_index.json" ] +``` + + +[gRPC]: https://grpc.io +[sketchbook directory]: sketch-specification.md#sketchbook +[arduino-cli config dump]: ../commands/arduino-cli_config_dump +[Arduino CLI command reference]: ../commands/arduino-cli +[arduino-cli global flags]: ../commands/arduino-cli_config/#options-inherited-from-parent-commands +[export command]: https://ss64.com/bash/export.html +[set command]: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/set_1 +[arduino-cli config init]: ../commands/arduino-cli_config_init +[JSON]: https://www.json.org +[TOML]: https://github.com/toml-lang/toml +[YAML]: https://en.wikipedia.org/wiki/YAML +[Java properties file]: https://en.wikipedia.org/wiki/.properties +[HCL]: https://github.com/hashicorp/hcl +[INI]: https://en.wikipedia.org/wiki/INI_file diff --git a/docs/getting-started.md b/docs/getting-started.md index 81e2a8a9011..ad2153a417a 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -53,7 +53,8 @@ Config file written: /home/luca/.arduino15/arduino-cli.yaml ``` If you inspect the contents of `arduino-cli.yaml`, you'll find the available -options with their respective default values. +options with their respective default values. For more information, see the +[configuration documentation]. ## Create a new sketch @@ -343,6 +344,7 @@ telemetry: addr: :9090 ``` +[configuration documentation]: configuration.md [client_example]: https://github.com/arduino/arduino-cli/blob/master/client_example [gRPC reference]: ../rpc/commands [Prometheus]: https://prometheus.io/ diff --git a/docs/img/CLI_Go_library_interface_screenshot.png b/docs/img/CLI_Go_library_interface_screenshot.png new file mode 100644 index 00000000000..6fc6787a888 Binary files /dev/null and b/docs/img/CLI_Go_library_interface_screenshot.png differ diff --git a/docs/img/CLI_JSON_output_screenshot.png b/docs/img/CLI_JSON_output_screenshot.png new file mode 100644 index 00000000000..b1e3952b78b Binary files /dev/null and b/docs/img/CLI_JSON_output_screenshot.png differ diff --git a/docs/img/CLI_configuration_methods_screenshot.png b/docs/img/CLI_configuration_methods_screenshot.png new file mode 100644 index 00000000000..6836d27aecc Binary files /dev/null and b/docs/img/CLI_configuration_methods_screenshot.png differ diff --git a/docs/img/CLI_contextual_help_screenshot.png b/docs/img/CLI_contextual_help_screenshot.png new file mode 100644 index 00000000000..b7a87fb25de Binary files /dev/null and b/docs/img/CLI_contextual_help_screenshot.png differ diff --git a/docs/img/CLI_gRPC_interface_screenshot.png b/docs/img/CLI_gRPC_interface_screenshot.png new file mode 100644 index 00000000000..91250f0c13f Binary files /dev/null and b/docs/img/CLI_gRPC_interface_screenshot.png differ diff --git a/docs/integration-options.md b/docs/integration-options.md new file mode 100644 index 00000000000..1b6cf2ef570 --- /dev/null +++ b/docs/integration-options.md @@ -0,0 +1,140 @@ +# The three pillars of the Arduino CLI + +The Arduino CLI is an open source Command Line Application written in [Golang] +that can be used from a terminal to compile, verify and upload sketches to +Arduino boards and that’s capable of managing all the software and tools needed +in the process. But don’t get fooled by its name: Arduino CLI can do much more +than the average console application, as shown by the [Arduino Pro IDE] and +[Arduino Create], which rely on it for similar purposes but each one in a +completely different way from the other. In this article we introduce the three +pillars of the Arduino CLI, explaining how we designed the software so that it +can be effectively leveraged under different scenarios. + +## The first pillar: command line interface + +### Console applications for humans + +As you might expect, the first way to use the Arduino CLI is from a terminal and +by a human, and user experience plays a key role here. The UX is under a +continuous improvement process as we want the tool to be powerful without being +too complicated. We heavily rely on sub-commands to provide a rich set of +different operations logically grouped together, so that users can easily +explore the interface while getting very specific contextual help. + +![contextual help screenshot][] + +### Console applications for robots + +Humans are not the only type of customers we want to support and the Arduino CLI +was also designed to be used programmatically - think about automation pipelines +or a [CI][continuous integration]/[CD][continuous deployment] system. +There are some niceties to observe when you write software that’s supposed to be +easy to run when unattended and one in particular is the ability to run without +a configuration file. This is possible because every configuration option you +find in the arduino-cli.yaml configuration file can be provided either through a +command line flag or by setting an environment variable. To give an example, the +following commands are all equivalent and will proceed fetching the unstable +package index that can be used to work with experimental versions of cores: + +![configuration methods screenshot][] + +One note about the example above: passing a value through a command line flag +always takes precedence over reading an environment variable, which in turn +always takes precedence over reading the same value from the configuration file +(if you have one). For more information, see the [configuration documentation]. + +Consistent with the previous paragraph, when it comes to providing output the +Arduino CLI aims to be user friendly but also slightly verbose, something that +doesn’t play well with robots. This is why we added an option to provide output +that’s easy to parse, for example the following figure shows what getting the +software version in [JSON] format looks like. + +![JSON output screenshot][] + +Even if not related to software design, one last feature that’s worth mentioning +is the availability of a one-line [installation script] that can be used to make +the latest version of the Arduino CLI available on most systems with an HTTP +client like curl or wget and a shell like bash. + +For more information on Arduino CLI's command line interface, see the +[command reference]. + +## The second pillar: gRPC interface + +[gRPC] is a high performance [RPC] framework that can efficiently connect client +and server applications. The Arduino CLI can act as a gRPC server (we call it +[daemon mode]), exposing a set of procedures that implement the very same set of +features of the command line interface and waiting for clients to connect and +use them. To give an idea, the following is some [Golang] code capable of +retrieving the version number of a remote running Arduino CLI server instance: + +![gRPC interface screenshot][] + +gRPC is language agnostic: even if the example is written in Golang, the +programming language used for the client can be Python, JavaScript or any of the +many [supported ones][gRPC supported languages], leading to a variety of +possible scenarios. The new [Arduino Pro IDE] is a good example of how to +leverage the daemon mode of the Arduino CLI with a clean separation of concerns: +the Pro IDE knows nothing about how to download a core, compile a sketch or talk +to an Arduino board and it demands all these features of an Arduino CLI instance. +Conversely, the Arduino CLI doesn’t even know that the client that’s connected +is the Pro IDE, and neither does it care. + +For more information on Arduino CLI's gRPC interface, see the +[gRPC interface reference]. + +## The third pillar: embedding + +Arduino CLI is written in [Golang] and the code is organized in a way that makes +it easy to use it as a library by including the modules you need in another +Golang application at compile time. Both the first and second pillars rely on a +common Golang API, a set of functions that abstract all the functionalities +offered by the Arduino CLI, so that when we provide a fix or a new feature, they +are automatically available to both the command line and gRPC interfaces. +The source modules implementing this API can be imported in other Golang +programs to embed a full fledged Arduino CLI. For example, this is how some +backend services powering [Arduino Create] can compile sketches and manage +libraries. Just to give you a taste of what it means to embed the Arduino CLI, +here is how to search for a core using the API: + +![Go library interface screenshot][] + +Embedding the Arduino CLI is limited to Golang applications and requires a deep +knowledge of its internals; for the average use case the gRPC interface might be +a better alternative, nevertheless this remains a valid option that we use and +provide support for. + +## Conclusions + +You can start playing with the Arduino CLI right away. The code is open source +and [the repo][Arduino CLI repository] contains +[example code showing how to implement a gRPC client][gRPC client example]. If +you’re curious about how we designed the low level API, have a look at the +[commands package] and don’t hesitate to leave feedback on the [issue tracker] +if you’ve got a use case that doesn’t fit one of the three pillars. + + +[Golang]: https://golang.org/ +[Arduino Pro IDE]: https://www.arduino.cc/pro/arduino-pro-ide +[Arduino Create]: https://create.arduino.cc +[continuous integration]: https://en.wikipedia.org/wiki/Continuous_integration +[continuous deployment]: https://en.wikipedia.org/wiki/Continuous_deployment +[configuration documentation]: configuration.md +[JSON]: https://www.json.org +[installation script]: installation.md#use-the-install-script +[command reference]: ../commands/arduino-cli +[gRPC]: https://grpc.io/ +[RPC]: https://en.wikipedia.org/wiki/Remote_procedure_call +[daemon mode]: ../commands/arduino-cli_daemon +[gRPC interface reference]: ../rpc/commands +[gRPC supported languages]: https://grpc.io/docs/languages/ +[Arduino CLI repository]: https://github.com/arduino/arduino-cli +[gRPC client example]: https://github.com/arduino/arduino-cli/blob/master/client_example +[commands package]: https://github.com/arduino/arduino-cli/tree/master/commands +[issue tracker]: https://github.com/arduino/arduino-cli/issues + +[contextual help screenshot]: img/CLI_contextual_help_screenshot.png +[configuration methods screenshot]: img/CLI_configuration_methods_screenshot.png +[JSON output screenshot]: img/CLI_JSON_output_screenshot.png +[gRPC interface screenshot]: img/CLI_gRPC_interface_screenshot.png +[Go library interface screenshot]: img/CLI_Go_library_interface_screenshot.png diff --git a/docs/sketch-build-process.md b/docs/sketch-build-process.md index 908fa84b78f..8f8cf09fe03 100644 --- a/docs/sketch-build-process.md +++ b/docs/sketch-build-process.md @@ -73,10 +73,11 @@ The folder name contains the include | `AnAwesomeServoForWhatever` The "location priority" is determined as follows (in order of highest to lowest priority): -1. The library is in the sketchbook (`{sketchbook path}/libraries`) +1. The library is in the `libraries` subfolder of the IDE's sketchbook or Arduino CLI's user directory 1. The library is bundled with the board platform/core ([`{runtime.platform.path}/libraries`](platform-specification.md#global-predefined-properties)) 1. The library is bundled with the [referenced](platform-specification.md#referencing-another-core-variant-or-tool) board platform/core 1. The library is bundled with the Arduino IDE ([`{runtime.ide.path}/libraries`](platform-specification.md#global-predefined-properties)) + - This location is only used by Arduino CLI when it's located in the Arduino IDE installation folder ## Compilation diff --git a/docsgen/go.mod b/docsgen/go.mod index 6ef7b4955a5..331cf3cb951 100644 --- a/docsgen/go.mod +++ b/docsgen/go.mod @@ -6,5 +6,5 @@ replace github.com/arduino/arduino-cli => ../ require ( github.com/arduino/arduino-cli v0.0.0 - github.com/spf13/cobra v0.0.6 + github.com/spf13/cobra v1.0.0 ) diff --git a/go.mod b/go.mod index fa398bf170e..aaef35eada6 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( bou.ke/monkey v1.0.1 github.com/GeertJohan/go.rice v1.0.0 github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c - github.com/arduino/go-paths-helper v1.0.1 - github.com/arduino/go-properties-orderedmap v1.0.0 + github.com/arduino/go-paths-helper v1.2.0 + github.com/arduino/go-properties-orderedmap v1.2.0 github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b github.com/cmaglie/pb v1.0.27 @@ -25,6 +25,7 @@ require ( github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect github.com/juju/testing v0.0.0-20190429233213-dfc56b8c09fc // indirect github.com/leonelquinteros/gotext v1.4.0 + github.com/marcinbor85/gohex v0.0.0-20200531163658-baab2527a9a2 github.com/mattn/go-colorable v0.1.2 github.com/mattn/go-runewidth v0.0.2 // indirect github.com/miekg/dns v1.0.5 // indirect @@ -35,7 +36,7 @@ require ( github.com/schollz/closestmatch v2.1.0+incompatible github.com/segmentio/stats/v4 v4.5.3 github.com/sirupsen/logrus v1.4.2 - github.com/spf13/cobra v0.0.5 + github.com/spf13/cobra v1.0.0 github.com/spf13/jwalterweatherman v1.0.0 github.com/spf13/viper v1.6.2 github.com/stretchr/testify v1.4.0 diff --git a/go.sum b/go.sum index 52b9bdc331c..099067dc63c 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,10 @@ github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c h1:agh2JT9 github.com/arduino/board-discovery v0.0.0-20180823133458-1ba29327fb0c/go.mod h1:HK7SpkEax/3P+0w78iRQx1sz1vCDYYw9RXwHjQTB5i8= github.com/arduino/go-paths-helper v1.0.1 h1:utYXLM2RfFlc9qp/MJTIYp3t6ux/xM6mWjeEb/WLK4Q= github.com/arduino/go-paths-helper v1.0.1/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= -github.com/arduino/go-properties-orderedmap v1.0.0 h1:caaM25TQZKkytoKQUsgqtOVbrM5i8Gb427JmW0KL05s= -github.com/arduino/go-properties-orderedmap v1.0.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= +github.com/arduino/go-paths-helper v1.2.0 h1:qDW93PR5IZUN/jzO4rCtexiwF8P4OIcOmcSgAYLZfY4= +github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= +github.com/arduino/go-properties-orderedmap v1.2.0 h1:H7sub5hjAtFLZYd/NVWBOr6Jw7U1CnamYvNSM3dDdyE= +github.com/arduino/go-properties-orderedmap v1.2.0/go.mod h1:DKjD2VXY/NZmlingh4lSFMEYCVubfeArCsGPGDwb2yk= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b h1:9hDi4F2st6dbLC3y4i02zFT5quS4X6iioWifGlVwfy4= github.com/arduino/go-timeutils v0.0.0-20171220113728-d1dd9e313b1b/go.mod h1:uwGy5PpN4lqW97FiLnbcx+xx8jly5YuPMJWfVwwjJiQ= github.com/arduino/go-win32-utils v0.0.0-20180330194947-ed041402e83b h1:3PjgYG5gVPA7cipp7vIR2lF96KkEJIFBJ+ANnuv6J20= @@ -42,6 +44,8 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= +github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/goselect v0.1.1 h1:tiSSgKE1eJtxs1h/VgGQWuXUP0YS4CDIFMp6vaI1ls0= github.com/creack/goselect v0.1.1/go.mod h1:a/NhLweNvqIYMuxcMOuWY516Cimucms3DglDzQP3hKY= github.com/daaku/go.zipexe v1.0.0 h1:VSOgZtH418pH9L16hC/JrgSNJbbAL26pj7lmD1+CGdY= @@ -76,7 +80,6 @@ github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4er github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= @@ -97,7 +100,6 @@ github.com/imjasonmiller/godice v0.1.2 h1:T1/sW/HoDzFeuwzOOuQjmeMELz9CzZ53I2CnD+ github.com/imjasonmiller/godice v0.1.2/go.mod h1:8cTkdnVI+NglU2d6sv+ilYcNaJ5VSTBwvMbFULJd/QQ= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jessevdk/go-flags v1.4.0 h1:4IU2WS7AumrZ/40jfhf4QVDMsQwqA7VEHozFRrGARJA= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= @@ -121,10 +123,11 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/leonelquinteros/gotext v1.4.0 h1:2NHPCto5IoMXbrT0bldPrxj0qM5asOCwtb1aUQZ1tys= github.com/leonelquinteros/gotext v1.4.0/go.mod h1:yZGXREmoGTtBvZHNcc+Yfug49G/2spuF/i/Qlsvz1Us= -github.com/magiconair/properties v1.8.0 h1:LLgXmsheXeRoUOBOjtwPQCWIYqM/LU1ayDtDePerRcY= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= +github.com/marcinbor85/gohex v0.0.0-20200531163658-baab2527a9a2 h1:n7R8fUwWZUB2XtyzBNsYNNm9/XgOBj6pvLi7GLMCHtM= +github.com/marcinbor85/gohex v0.0.0-20200531163658-baab2527a9a2/go.mod h1:Pb6XcsXyropB9LNHhnqaknG/vEwYztLkQzVCHv8sQ3M= github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -137,12 +140,10 @@ github.com/mdlayher/netlink v0.0.0-20190313131330-258ea9dff42c/go.mod h1:eQB3mZE github.com/mdlayher/taskstats v0.0.0-20190313225729-7cbba52ee072/go.mod h1:sGdS7A6CAETR53zkdjGkgoFlh1vSm7MtX+i8XfEsTMA= github.com/miekg/dns v1.0.5 h1:MQBGf2JEJDu0rg9WOpQZzeO+zW8UKwgkvP3R1dUU1Yw= github.com/miekg/dns v1.0.5/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229 h1:E2B8qYyeSgv5MXpmzZXRNp8IAQ4vjxIjhpAf5hv/tAg= github.com/nkovacs/streamquote v0.0.0-20170412213628-49af9bddb229/go.mod h1:0aYXnNPJ8l7uZxf45rWW1a/uME32OF0rhiYGNQ2oF2E= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/oleksandr/bonjour v0.0.0-20160508152359-5dcf00d8b228 h1:Cvfd2dOlXIPTeEkOT/h8PyK4phBngOM4at9/jlgy7d4= @@ -171,6 +172,8 @@ github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5/go.mod h1:GEXHk5H github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= +github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/schollz/closestmatch v2.1.0+incompatible h1:Uel2GXEpJqOWBrlyI+oY9LTiyyjYS17cCYRqP13/SHk= github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g= github.com/segmentio/fasthash v0.0.0-20180216231524-a72b379d632e h1:uO75wNGioszjmIzcY/tvdDYKRLVvzggtAmmJkn9j4GQ= @@ -179,6 +182,8 @@ github.com/segmentio/objconv v1.0.1 h1:QjfLzwriJj40JibCV3MGSEiAoXixbp4ybhwfTB8RX github.com/segmentio/objconv v1.0.1/go.mod h1:auayaH5k3137Cl4SoXTgrzQcuQDmvuVtZgS0fb1Ahys= github.com/segmentio/stats/v4 v4.5.3 h1:Y/DSUWZ4c8ICgqJ9rQohzKvGqGWbLPWad5zmxVoKN+Y= github.com/segmentio/stats/v4 v4.5.3/go.mod h1:LsaahUJR7iiSs8mnkvQvdQ/RLHAS5adGLxuntg0ydGo= +github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2 h1:SPIRibHv4MatM3XXNO2BJeFLZwZ2LvZgfQ5+UNI2im4= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -194,19 +199,19 @@ github.com/spf13/cast v1.3.0 h1:oget//CVOEoFewqQxwr0Ej5yjygnqGkvggSE/gB35Q8= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.5 h1:f0B+LkLX6DtmRH1isoNA9VTtNUK9K8xYd28JNNfOv/s= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= github.com/spf13/jwalterweatherman v1.0.0 h1:XHEdyB+EcvlqZamSM4ZOMGlc93t6AcsBEu9Gc1vn7yk= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.3.2 h1:VUFqw5KcqRf7i70GOzW7N+Q7+gxVBkSSqiXB12+JQ4M= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/spf13/viper v1.6.2 h1:7aKfF+e8/k68gda3LOjo5RxiUqddoFxVq4BKBPrxk5E= github.com/spf13/viper v1.6.2/go.mod h1:t3iDnF5Jlj76alVNuyFBk5oUMCvsrkbvZK0WQdfDi5k= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -215,9 +220,7 @@ github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69 github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= @@ -242,14 +245,12 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 h1:XQyxROzUlZH+WIQwySDgnISgOivlhjIEwaQaJEJrrN0= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190313220215-9f648a60d977/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= @@ -268,13 +269,10 @@ golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190422165155-953cdadca894 h1:Cz4ceDQGXuKRnVBDTS23GTn/pU5OE2C0WrNTOYK1Uuc= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9 h1:ZBzSG/7F4eNKz2L3GE9o300RX0Az1Bw5HF7PDraD+qU= golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -284,14 +282,11 @@ golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190328211700-ab21143f2384 h1:TFlARGu6Czu1z7q93HTxcP1P+/ZFC/IKythI5RzrnRg= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 h1:5Beo0mZN8dRzgrMMkDp0jc8YXQKx9DiJ2k1dkvGsn5A= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90 h1:7THRSvPuzF1bql5kyFzX0JM0vpGhwuhskgJrJsbZ80Y= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -301,7 +296,6 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.27.0 h1:rRYRFMVgRv6E0D70Skyfsr28tDXIuuPZyWGMPdMcnXg= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= @@ -313,7 +307,6 @@ gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3M gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/i18n/README.md b/i18n/README.md index 417fc3cbdd8..43d07d4f5ac 100644 --- a/i18n/README.md +++ b/i18n/README.md @@ -42,12 +42,3 @@ task i18n:push ```sh task i18n:pull ``` - -## Adding a new language - -To add a new supported language add the locale string to the project's Taskfile.yml (comma separated list) - -e.g -``` -I18N_LANGS: "pt_BR,es,jp" -``` \ No newline at end of file diff --git a/i18n/cmd/commands/transifex/pull_transifex.go b/i18n/cmd/commands/transifex/pull_transifex.go index e94755789cd..ad7212188ed 100644 --- a/i18n/cmd/commands/transifex/pull_transifex.go +++ b/i18n/cmd/commands/transifex/pull_transifex.go @@ -16,6 +16,7 @@ package transifex import ( + "encoding/json" "fmt" "io/ioutil" "net/http" @@ -26,20 +27,62 @@ import ( ) var pullTransifexCommand = &cobra.Command{ - Use: "pull -l pt_BR [catalog folder]", + Use: "pull [catalog folder]", Short: "pulls the translation files from transifex", - Args: cobra.ExactArgs(1), Run: pullCatalog, } -var languages = []string{} +func getLanguages() []string { + req, err := http.NewRequest( + "GET", + fmt.Sprintf( + "https://www.transifex.com/api/2/project/%s/resource/%s/stats/", + project, resource, + ), nil) + + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + req.SetBasicAuth("api", apiKey) + + resp, err := http.DefaultClient.Do(req) + + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + defer resp.Body.Close() + + b, err := ioutil.ReadAll(resp.Body) + if err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } + + var jsonResp map[string]interface{} + if err := json.Unmarshal(b, &jsonResp); err != nil { + fmt.Println(err.Error()) + os.Exit(1) + } -func init() { - pullTransifexCommand.Flags().StringSliceVarP(&languages, "languages", "l", nil, "languages") - pullTransifexCommand.MarkFlagRequired("languages") + var langs []string + for key := range jsonResp { + if key == "en" { + continue + } + langs = append(langs, key) + } + + return langs } func pullCatalog(cmd *cobra.Command, args []string) { + languages := getLanguages() + fmt.Println("translations found:", languages) + folder := args[0] for _, lang := range languages { diff --git a/i18n/data/it_IT.po b/i18n/data/it_IT.po new file mode 100644 index 00000000000..ef9a8f0d027 --- /dev/null +++ b/i18n/data/it_IT.po @@ -0,0 +1,42 @@ +# +# Translators: +# Cristian Maglie , 2020 +# +msgid "" +msgstr "" +"Last-Translator: Cristian Maglie , 2020\n" +"Language-Team: Italian (Italy) (https://www.transifex.com/arduino-1/teams/108174/it_IT/)\n" +"Language: it_IT\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: cli/usage.go:31 +msgid "Additional help topics:" +msgstr "Informazioni aggiuntive:" + +#: cli/usage.go:26 +msgid "Aliases:" +msgstr "Alias:" + +#: cli/usage.go:28 +msgid "Available Commands:" +msgstr "Comandi disponibili:" + +#: cli/usage.go:27 +msgid "Examples:" +msgstr "Esempi:" + +#: cli/usage.go:29 +msgid "Flags:" +msgstr "" + +#: cli/usage.go:30 +msgid "Global Flags:" +msgstr "" + +#: cli/usage.go:25 +msgid "Usage:" +msgstr "" + +#: cli/usage.go:32 +msgid "Use %s for more information about a command." +msgstr "" diff --git a/i18n/data/pt_BR.po b/i18n/data/pt_BR.po index 90a16da7c57..936d37d869c 100644 --- a/i18n/data/pt_BR.po +++ b/i18n/data/pt_BR.po @@ -1,5 +1,13 @@ +# +# Translators: +# Henrique Diniz , 2020 +# msgid "" msgstr "" +"Last-Translator: Henrique Diniz , 2020\n" +"Language-Team: Portuguese (Brazil) (https://www.transifex.com/arduino-1/teams/108174/pt_BR/)\n" +"Language: pt_BR\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" #: cli/usage.go:31 msgid "Additional help topics:" @@ -31,5 +39,4 @@ msgstr "" #: cli/usage.go:32 msgid "Use %s for more information about a command." -msgstr "" - +msgstr "Use %s para mais informações sobre um comando." diff --git a/i18n/rice-box.go b/i18n/rice-box.go index 910d9d250d1..db59594f1dc 100644 --- a/i18n/rice-box.go +++ b/i18n/rice-box.go @@ -11,31 +11,38 @@ func init() { // define files file2 := &embedded.EmbeddedFile{ Filename: ".gitkeep", - FileModTime: time.Unix(1589851571, 0), + FileModTime: time.Unix(1591581706, 0), Content: string(""), } file3 := &embedded.EmbeddedFile{ Filename: "en.po", - FileModTime: time.Unix(1590158852, 0), + FileModTime: time.Unix(1591581706, 0), Content: string("msgid \"\"\nmsgstr \"\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"Additional help topics:\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"Aliases:\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"Available Commands:\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"Examples:\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"Flags:\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"Global Flags:\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"Usage:\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"Use %s for more information about a command.\"\n\n"), } file4 := &embedded.EmbeddedFile{ + Filename: "it_IT.po", + FileModTime: time.Unix(1591581735, 0), + + Content: string("# \n# Translators:\n# Cristian Maglie , 2020\n# \nmsgid \"\"\nmsgstr \"\"\n\"Last-Translator: Cristian Maglie , 2020\\n\"\n\"Language-Team: Italian (Italy) (https://www.transifex.com/arduino-1/teams/108174/it_IT/)\\n\"\n\"Language: it_IT\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1);\\n\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"Informazioni aggiuntive:\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"Alias:\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"Comandi disponibili:\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"Esempi:\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"\"\n"), + } + file5 := &embedded.EmbeddedFile{ Filename: "pt_BR.po", - FileModTime: time.Unix(1590158853, 0), + FileModTime: time.Unix(1591581735, 0), - Content: string("msgid \"\"\nmsgstr \"\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"\"\n\n"), + Content: string("# \n# Translators:\n# Henrique Diniz , 2020\n# \nmsgid \"\"\nmsgstr \"\"\n\"Last-Translator: Henrique Diniz , 2020\\n\"\n\"Language-Team: Portuguese (Brazil) (https://www.transifex.com/arduino-1/teams/108174/pt_BR/)\\n\"\n\"Language: pt_BR\\n\"\n\"Plural-Forms: nplurals=2; plural=(n > 1);\\n\"\n\n#: cli/usage.go:31\nmsgid \"Additional help topics:\"\nmsgstr \"\"\n\n#: cli/usage.go:26\nmsgid \"Aliases:\"\nmsgstr \"\"\n\n#: cli/usage.go:28\nmsgid \"Available Commands:\"\nmsgstr \"\"\n\n#: cli/usage.go:27\nmsgid \"Examples:\"\nmsgstr \"\"\n\n#: cli/usage.go:29\nmsgid \"Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:30\nmsgid \"Global Flags:\"\nmsgstr \"\"\n\n#: cli/usage.go:25\nmsgid \"Usage:\"\nmsgstr \"\"\n\n#: cli/usage.go:32\nmsgid \"Use %s for more information about a command.\"\nmsgstr \"Use %s para mais informações sobre um comando.\"\n"), } // define dirs dir1 := &embedded.EmbeddedDir{ Filename: "", - DirModTime: time.Unix(1590158853, 0), + DirModTime: time.Unix(1591581735, 0), ChildFiles: []*embedded.EmbeddedFile{ file2, // ".gitkeep" file3, // "en.po" - file4, // "pt_BR.po" + file4, // "it_IT.po" + file5, // "pt_BR.po" }, } @@ -46,14 +53,15 @@ func init() { // register embeddedBox embedded.RegisterEmbeddedBox(`./data`, &embedded.EmbeddedBox{ Name: `./data`, - Time: time.Unix(1590158853, 0), + Time: time.Unix(1591581735, 0), Dirs: map[string]*embedded.EmbeddedDir{ "": dir1, }, Files: map[string]*embedded.EmbeddedFile{ ".gitkeep": file2, "en.po": file3, - "pt_BR.po": file4, + "it_IT.po": file4, + "pt_BR.po": file5, }, }) } diff --git a/legacy/builder/merge_sketch_with_bootloader.go b/legacy/builder/merge_sketch_with_bootloader.go index 742d8f57db6..87b4f954fd2 100644 --- a/legacy/builder/merge_sketch_with_bootloader.go +++ b/legacy/builder/merge_sketch_with_bootloader.go @@ -16,12 +16,15 @@ package builder import ( - "os" + "math" + "strconv" "strings" "github.com/arduino/arduino-cli/legacy/builder/constants" "github.com/arduino/arduino-cli/legacy/builder/types" + "github.com/arduino/arduino-cli/legacy/builder/utils" "github.com/arduino/go-paths-helper" + "github.com/marcinbor85/gohex" "github.com/pkg/errors" ) @@ -36,7 +39,6 @@ func (s *MergeSketchWithBootloader) Run(ctx *types.Context) error { buildPath := ctx.BuildPath sketch := ctx.Sketch sketchFileName := sketch.MainFile.Name.Base() - logger := ctx.GetLogger() sketchInBuildPath := buildPath.Join(sketchFileName + ".hex") sketchInSubfolder := buildPath.Join(constants.FOLDER_SKETCH, sketchFileName+".hex") @@ -60,74 +62,92 @@ func (s *MergeSketchWithBootloader) Run(ctx *types.Context) error { bootloaderPath := buildProperties.GetPath(constants.BUILD_PROPERTIES_RUNTIME_PLATFORM_PATH).Join(constants.FOLDER_BOOTLOADERS, bootloader) if bootloaderPath.NotExist() { - logger.Fprintln(os.Stdout, constants.LOG_LEVEL_WARN, constants.MSG_BOOTLOADER_FILE_MISSING, bootloaderPath) + utils.LogIfVerbose(constants.LOG_LEVEL_WARN, constants.MSG_BOOTLOADER_FILE_MISSING, bootloaderPath) return nil } mergedSketchPath := builtSketchPath.Parent().Join(sketchFileName + ".with_bootloader.hex") - return merge(builtSketchPath, bootloaderPath, mergedSketchPath) -} - -func hexLineOnlyContainsFF(line string) bool { - //:206FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB1 - if len(line) <= 11 { - return false + // Ignore merger errors for the first iteration + maximumBinSize := 16000000 + if uploadMaxSize, ok := ctx.BuildProperties.GetOk(constants.PROPERTY_UPLOAD_MAX_SIZE); ok { + maximumBinSize, _ = strconv.Atoi(uploadMaxSize) + maximumBinSize *= 2 } - byteArray := []byte(line) - for _, char := range byteArray[9:(len(byteArray) - 2)] { - if char != 'F' { - return false - } + err := merge(builtSketchPath, bootloaderPath, mergedSketchPath, maximumBinSize) + if err != nil { + utils.LogIfVerbose(constants.LOG_LEVEL_INFO, err.Error()) } - return true -} - -func extractActualBootloader(bootloader []string) []string { - var realBootloader []string + return nil +} - // skip until we find a line full of FFFFFF (except address and checksum) - for i, row := range bootloader { - if hexLineOnlyContainsFF(row) { - realBootloader = bootloader[i:len(bootloader)] - break - } +func merge(builtSketchPath, bootloaderPath, mergedSketchPath *paths.Path, maximumBinSize int) error { + if bootloaderPath.Ext() == ".bin" { + bootloaderPath = paths.New(strings.TrimSuffix(bootloaderPath.String(), ".bin") + ".hex") } - // drop all "empty" lines - for i, row := range realBootloader { - if !hexLineOnlyContainsFF(row) { - realBootloader = realBootloader[i:len(realBootloader)] - break + memBoot := gohex.NewMemory() + if bootFile, err := bootloaderPath.Open(); err == nil { + defer bootFile.Close() + if err := memBoot.ParseIntelHex(bootFile); err != nil { + return errors.New(bootFile.Name() + " " + err.Error()) } + } else { + return err } - if len(realBootloader) == 0 { - // we didn't find any line full of FFFF, thus it's a standalone bootloader - realBootloader = bootloader + memSketch := gohex.NewMemory() + if buildFile, err := builtSketchPath.Open(); err == nil { + defer buildFile.Close() + if err := memSketch.ParseIntelHex(buildFile); err != nil { + return errors.New(buildFile.Name() + " " + err.Error()) + } + } else { + return err } - return realBootloader -} + memMerged := gohex.NewMemory() + initialAddress := uint32(math.MaxUint32) + lastAddress := uint32(0) -func merge(builtSketchPath, bootloaderPath, mergedSketchPath *paths.Path) error { - sketch, err := builtSketchPath.ReadFileAsLines() - if err != nil { - return errors.WithStack(err) + for _, segment := range memBoot.GetDataSegments() { + if err := memMerged.AddBinary(segment.Address, segment.Data); err != nil { + continue + } + if segment.Address < initialAddress { + initialAddress = segment.Address + } + if segment.Address+uint32(len(segment.Data)) > lastAddress { + lastAddress = segment.Address + uint32(len(segment.Data)) + } } - sketch = sketch[:len(sketch)-2] - - bootloader, err := bootloaderPath.ReadFileAsLines() - if err != nil { - return errors.WithStack(err) + for _, segment := range memSketch.GetDataSegments() { + if err := memMerged.AddBinary(segment.Address, segment.Data); err != nil { + continue + } + if segment.Address < initialAddress { + initialAddress = segment.Address + } + if segment.Address+uint32(len(segment.Data)) > lastAddress { + lastAddress = segment.Address + uint32(len(segment.Data)) + } } - realBootloader := extractActualBootloader(bootloader) - - for _, row := range realBootloader { - sketch = append(sketch, row) + if mergeFile, err := mergedSketchPath.Create(); err == nil { + defer mergeFile.Close() + memMerged.DumpIntelHex(mergeFile, 16) + } else { + return err } - return mergedSketchPath.WriteFile([]byte(strings.Join(sketch, "\n"))) + // Write out a .bin if the addresses doesn't go too far away from origin + // (and consequently produce a very large bin) + size := lastAddress - initialAddress + if size > uint32(maximumBinSize) { + return nil + } + mergedSketchPathBin := paths.New(strings.TrimSuffix(mergedSketchPath.String(), ".hex") + ".bin") + data := memMerged.ToBinary(initialAddress, size, 0xFF) + return mergedSketchPathBin.WriteFile(data) } diff --git a/legacy/builder/phases/linker.go b/legacy/builder/phases/linker.go index 76884bf4602..32bcaf8bafb 100644 --- a/legacy/builder/phases/linker.go +++ b/legacy/builder/phases/linker.go @@ -57,13 +57,11 @@ func (s *Linker) Run(ctx *types.Context) error { } func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths.Path, coreArchiveFilePath *paths.Path, buildProperties *properties.Map) error { - optRelax := addRelaxTrickIfATMEGA2560(buildProperties) - quotedObjectFiles := utils.Map(objectFiles.AsStrings(), wrapWithDoubleQuotes) objectFileList := strings.Join(quotedObjectFiles, constants.SPACE) properties := buildProperties.Clone() - properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)+optRelax) + properties.Set(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_C_ELF_FLAGS)) properties.Set(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS, properties.Get(constants.BUILD_PROPERTIES_COMPILER_WARNING_FLAGS+"."+ctx.WarningsLevel)) properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE, coreDotARelPath.String()) properties.Set(constants.BUILD_PROPERTIES_ARCHIVE_FILE_PATH, coreArchiveFilePath.String()) @@ -76,10 +74,3 @@ func link(ctx *types.Context, objectFiles paths.PathList, coreDotARelPath *paths func wrapWithDoubleQuotes(value string) string { return "\"" + value + "\"" } - -func addRelaxTrickIfATMEGA2560(buildProperties *properties.Map) string { - if buildProperties.Get(constants.BUILD_PROPERTIES_BUILD_MCU) == "atmega2560" { - return ",--relax" - } - return constants.EMPTY_STRING -} diff --git a/legacy/builder/test/hardware_loader_test.go b/legacy/builder/test/hardware_loader_test.go index a6767ec5aa8..f73676378e9 100644 --- a/legacy/builder/test/hardware_loader_test.go +++ b/legacy/builder/test/hardware_loader_test.go @@ -62,7 +62,7 @@ func TestLoadHardware(t *testing.T) { require.Equal(t, "-v", avrPlatform.Releases[""].Properties.Get("tools.avrdude.bootloader.params.verbose")) require.Equal(t, "/my/personal/avrdude", avrPlatform.Releases[""].Properties.Get("tools.avrdude.cmd.path")) - require.Equal(t, "AVRISP mkII", avrPlatform.Releases[""].Programmers["avrispmkii"].Get("name")) + require.Equal(t, "AVRISP mkII", avrPlatform.Releases[""].Programmers["avrispmkii"].Name) //require.Equal(t, "{runtime.tools.ctags.path}", packages.Properties.Get("tools.ctags.path"]) //require.Equal(t, "\"{cmd.path}\" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives \"{source_file}\"", packages.Properties.Get("tools.ctags.pattern"]) @@ -114,7 +114,7 @@ func TestLoadHardwareMixingUserHardwareFolder(t *testing.T) { require.Equal(t, "-v", avrPlatform.Properties.Get("tools.avrdude.bootloader.params.verbose")) require.Equal(t, "/my/personal/avrdude", avrPlatform.Properties.Get("tools.avrdude.cmd.path")) - require.Equal(t, "AVRISP mkII", avrPlatform.Programmers["avrispmkii"].Get("name")) + require.Equal(t, "AVRISP mkII", avrPlatform.Programmers["avrispmkii"].Name) require.Equal(t, "-w -x c++ -M -MG -MP", avrPlatform.Properties.Get("preproc.includes.flags")) require.Equal(t, "-w -x c++ -E -CC", avrPlatform.Properties.Get("preproc.macros.flags")) @@ -177,8 +177,8 @@ func TestLoadHardwareWithBoardManagerFolderStructure(t *testing.T) { require.Equal(t, 3, len(samdPlatform.Programmers)) - require.Equal(t, "Atmel EDBG", samdPlatform.Programmers["edbg"].Get("name")) - require.Equal(t, "openocd", samdPlatform.Programmers["edbg"].Get("program.tool")) + require.Equal(t, "Atmel EDBG", samdPlatform.Programmers["edbg"].Name) + require.Equal(t, "openocd", samdPlatform.Programmers["edbg"].Properties.Get("program.tool")) avrRedBearPlatform := packages["RedBearLab"].Platforms["avr"].Releases["1.0.0"] require.Equal(t, 3, len(avrRedBearPlatform.Boards)) diff --git a/legacy/builder/test/merge_sketch_with_bootloader_test.go b/legacy/builder/test/merge_sketch_with_bootloader_test.go index 556d4d2c4d5..68441b5c1c6 100644 --- a/legacy/builder/test/merge_sketch_with_bootloader_test.go +++ b/legacy/builder/test/merge_sketch_with_bootloader_test.go @@ -16,6 +16,7 @@ package test import ( + "fmt" "path/filepath" "strings" "testing" @@ -46,8 +47,36 @@ func TestMergeSketchWithBootloader(t *testing.T) { err := buildPath.Join("sketch").MkdirAll() NoError(t, err) - fakeSketchHex := "row 1\n" + - "row 2\n" + fakeSketchHex := `:100000000C9434000C9446000C9446000C9446006A +:100010000C9446000C9446000C9446000C94460048 +:100020000C9446000C9446000C9446000C94460038 +:100030000C9446000C9446000C9446000C94460028 +:100040000C9448000C9446000C9446000C94460016 +:100050000C9446000C9446000C9446000C94460008 +:100060000C9446000C94460011241FBECFEFD8E03C +:10007000DEBFCDBF21E0A0E0B1E001C01D92A930FC +:10008000B207E1F70E9492000C94DC000C9400008F +:100090001F920F920FB60F9211242F933F938F93BD +:1000A0009F93AF93BF938091050190910601A0911A +:1000B0000701B09108013091040123E0230F2D378F +:1000C00020F40196A11DB11D05C026E8230F02965C +:1000D000A11DB11D20930401809305019093060199 +:1000E000A0930701B0930801809100019091010154 +:1000F000A0910201B09103010196A11DB11D809351 +:10010000000190930101A0930201B0930301BF91FC +:10011000AF919F918F913F912F910F900FBE0F90B4 +:100120001F901895789484B5826084BD84B58160F1 +:1001300084BD85B5826085BD85B5816085BD8091B2 +:100140006E00816080936E0010928100809181002A +:100150008260809381008091810081608093810022 +:10016000809180008160809380008091B1008460E4 +:100170008093B1008091B00081608093B000809145 +:100180007A00846080937A0080917A008260809304 +:100190007A0080917A00816080937A0080917A0061 +:1001A000806880937A001092C100C0E0D0E0209770 +:0C01B000F1F30E940000FBCFF894FFCF99 +:00000001FF +` err = buildPath.Join("sketch", "sketch.ino.hex").WriteFile([]byte(fakeSketchHex)) NoError(t, err) @@ -65,8 +94,8 @@ func TestMergeSketchWithBootloader(t *testing.T) { NoError(t, err) mergedSketchHex := string(bytes) - require.True(t, strings.HasPrefix(mergedSketchHex, "row 1\n:107E0000112484B714BE81FFF0D085E080938100F7\n")) - require.True(t, strings.HasSuffix(mergedSketchHex, ":0400000300007E007B\n:00000001FF\n")) + require.Contains(t, mergedSketchHex, ":100000000C9434000C9446000C9446000C9446006A\n") + require.True(t, strings.HasSuffix(mergedSketchHex, ":00000001FF\n")) } func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) { @@ -88,8 +117,36 @@ func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) { err := buildPath.Join("sketch").MkdirAll() NoError(t, err) - fakeSketchHex := "row 1\n" + - "row 2\n" + fakeSketchHex := `:100000000C9434000C9446000C9446000C9446006A +:100010000C9446000C9446000C9446000C94460048 +:100020000C9446000C9446000C9446000C94460038 +:100030000C9446000C9446000C9446000C94460028 +:100040000C9448000C9446000C9446000C94460016 +:100050000C9446000C9446000C9446000C94460008 +:100060000C9446000C94460011241FBECFEFD8E03C +:10007000DEBFCDBF21E0A0E0B1E001C01D92A930FC +:10008000B207E1F70E9492000C94DC000C9400008F +:100090001F920F920FB60F9211242F933F938F93BD +:1000A0009F93AF93BF938091050190910601A0911A +:1000B0000701B09108013091040123E0230F2D378F +:1000C00020F40196A11DB11D05C026E8230F02965C +:1000D000A11DB11D20930401809305019093060199 +:1000E000A0930701B0930801809100019091010154 +:1000F000A0910201B09103010196A11DB11D809351 +:10010000000190930101A0930201B0930301BF91FC +:10011000AF919F918F913F912F910F900FBE0F90B4 +:100120001F901895789484B5826084BD84B58160F1 +:1001300084BD85B5826085BD85B5816085BD8091B2 +:100140006E00816080936E0010928100809181002A +:100150008260809381008091810081608093810022 +:10016000809180008160809380008091B1008460E4 +:100170008093B1008091B00081608093B000809145 +:100180007A00846080937A0080917A008260809304 +:100190007A0080917A00816080937A0080917A0061 +:1001A000806880937A001092C100C0E0D0E0209770 +:0C01B000F1F30E940000FBCFF894FFCF99 +:00000001FF +` err = buildPath.Join("sketch.ino.hex").WriteFile([]byte(fakeSketchHex)) NoError(t, err) @@ -107,8 +164,9 @@ func TestMergeSketchWithBootloaderSketchInBuildPath(t *testing.T) { NoError(t, err) mergedSketchHex := string(bytes) - require.True(t, strings.HasPrefix(mergedSketchHex, "row 1\n:107E0000112484B714BE81FFF0D085E080938100F7\n")) - require.True(t, strings.HasSuffix(mergedSketchHex, ":0400000300007E007B\n:00000001FF\n")) + fmt.Println(string(mergedSketchHex)) + require.Contains(t, mergedSketchHex, ":100000000C9434000C9446000C9446000C9446006A\n") + require.True(t, strings.HasSuffix(mergedSketchHex, ":00000001FF\n")) } func TestMergeSketchWithBootloaderWhenNoBootloaderAvailable(t *testing.T) { @@ -168,8 +226,36 @@ func TestMergeSketchWithBootloaderPathIsParameterized(t *testing.T) { err := buildPath.Join("sketch").MkdirAll() NoError(t, err) - fakeSketchHex := "row 1\n" + - "row 2\n" + fakeSketchHex := `:100000000C9434000C9446000C9446000C9446006A +:100010000C9446000C9446000C9446000C94460048 +:100020000C9446000C9446000C9446000C94460038 +:100030000C9446000C9446000C9446000C94460028 +:100040000C9448000C9446000C9446000C94460016 +:100050000C9446000C9446000C9446000C94460008 +:100060000C9446000C94460011241FBECFEFD8E03C +:10007000DEBFCDBF21E0A0E0B1E001C01D92A930FC +:10008000B207E1F70E9492000C94DC000C9400008F +:100090001F920F920FB60F9211242F933F938F93BD +:1000A0009F93AF93BF938091050190910601A0911A +:1000B0000701B09108013091040123E0230F2D378F +:1000C00020F40196A11DB11D05C026E8230F02965C +:1000D000A11DB11D20930401809305019093060199 +:1000E000A0930701B0930801809100019091010154 +:1000F000A0910201B09103010196A11DB11D809351 +:10010000000190930101A0930201B0930301BF91FC +:10011000AF919F918F913F912F910F900FBE0F90B4 +:100120001F901895789484B5826084BD84B58160F1 +:1001300084BD85B5826085BD85B5816085BD8091B2 +:100140006E00816080936E0010928100809181002A +:100150008260809381008091810081608093810022 +:10016000809180008160809380008091B1008460E4 +:100170008093B1008091B00081608093B000809145 +:100180007A00846080937A0080917A008260809304 +:100190007A0080917A00816080937A0080917A0061 +:1001A000806880937A001092C100C0E0D0E0209770 +:0C01B000F1F30E940000FBCFF894FFCF99 +:00000001FF +` err = buildPath.Join("sketch", "sketch.ino.hex").WriteFile([]byte(fakeSketchHex)) NoError(t, err) @@ -187,6 +273,6 @@ func TestMergeSketchWithBootloaderPathIsParameterized(t *testing.T) { NoError(t, err) mergedSketchHex := string(bytes) - require.True(t, strings.HasPrefix(mergedSketchHex, "row 1\n:020000023000CC")) - require.True(t, strings.HasSuffix(mergedSketchHex, ":040000033000E000E9\n:00000001FF\n")) + require.Contains(t, mergedSketchHex, ":100000000C9434000C9446000C9446000C9446006A\n") + require.True(t, strings.HasSuffix(mergedSketchHex, ":00000001FF\n")) } diff --git a/legacy/builder/utils/utils.go b/legacy/builder/utils/utils.go index 077dc02a667..97f4e184655 100644 --- a/legacy/builder/utils/utils.go +++ b/legacy/builder/utils/utils.go @@ -434,12 +434,12 @@ func QuoteCppPath(path *paths.Path) string { // is a string contained in double quotes, with any backslashes or // quotes escaped with a backslash. If a valid string was present at the // start of the given line, returns the unquoted string contents, the -// remaineder of the line (everything after the closing "), and true. +// remainder of the line (everything after the closing "), and true. // Otherwise, returns the empty string, the entire line and false. func ParseCppString(line string) (string, string, bool) { // For details about how these strings are output by gcc, see: // https://github.com/gcc-mirror/gcc/blob/a588355ab948cf551bc9d2b89f18e5ae5140f52c/libcpp/macro.c#L491-L511 - // Note that the documentaiton suggests all non-printable + // Note that the documentation suggests all non-printable // characters are also escaped, but the implementation does not // actually do this. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51259 if len(line) < 1 || line[0] != '"' { diff --git a/mkdocs.yml b/mkdocs.yml index af169843596..95dbf3f1118 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -56,6 +56,7 @@ nav: - Documentation Home: index.md - installation.md - getting-started.md + - command-line-completion.md - CONTRIBUTING.md - FAQ.md - Command reference: @@ -68,6 +69,7 @@ nav: - cache: commands/arduino-cli_cache.md - cache clean: commands/arduino-cli_cache_clean.md - compile: commands/arduino-cli_compile.md + - completion: commands/arduino-cli_completion.md - config: commands/arduino-cli_config.md - config dump: commands/arduino-cli_config_dump.md - config init: commands/arduino-cli_config_init.md @@ -99,6 +101,8 @@ nav: - monitor: rpc/monitor.md - settings: rpc/settings.md - debug: rpc/debug.md + - configuration.md + - Integration options: integration-options.md - sketch-build-process.md - sketch-specification.md - library-specification.md diff --git a/rpc/commands/commands.pb.go b/rpc/commands/commands.pb.go index d5009ec209b..01b4ad6d82c 100644 --- a/rpc/commands/commands.pb.go +++ b/rpc/commands/commands.pb.go @@ -554,67 +554,71 @@ func init() { func init() { proto.RegisterFile("commands/commands.proto", fileDescriptor_3690061a1131852d) } var fileDescriptor_3690061a1131852d = []byte{ - // 948 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x97, 0xdd, 0x52, 0x1b, 0x37, - 0x14, 0xc7, 0xb3, 0x24, 0x05, 0x7c, 0x0c, 0x24, 0x51, 0x9c, 0xe0, 0xf1, 0x95, 0xb3, 0x69, 0x8a, - 0x81, 0x62, 0x28, 0xed, 0xb4, 0x17, 0x9d, 0x5e, 0x90, 0xd0, 0x0b, 0xd2, 0x74, 0xc8, 0x2c, 0x85, - 0xe9, 0xe4, 0xc6, 0x95, 0x77, 0x15, 0xd0, 0xb0, 0xac, 0x14, 0x69, 0xa1, 0xf5, 0x55, 0x9f, 0xa0, - 0x2f, 0xd4, 0x17, 0xe9, 0xeb, 0x74, 0xa4, 0x95, 0xe4, 0x35, 0x78, 0x3f, 0x1c, 0xc8, 0x15, 0xec, - 0x39, 0xbf, 0xf3, 0x3f, 0xab, 0xf3, 0x21, 0xdb, 0xb0, 0x1a, 0xb2, 0x8b, 0x0b, 0x9c, 0x44, 0x72, - 0xdb, 0xfe, 0xd3, 0xe7, 0x82, 0xa5, 0x0c, 0xad, 0x86, 0x61, 0x1f, 0x8b, 0xe8, 0x92, 0x26, 0xac, - 0x1f, 0xc6, 0xb4, 0x6f, 0xdd, 0x9d, 0xa7, 0x13, 0x11, 0x2c, 0xc9, 0xf8, 0x4e, 0xcb, 0x99, 0x87, - 0x0c, 0x8b, 0xc8, 0x58, 0x9f, 0xe5, 0x61, 0x4e, 0x63, 0x62, 0xec, 0x4f, 0x72, 0x76, 0x61, 0x8d, - 0x63, 0xe5, 0x4b, 0x1e, 0x33, 0x6c, 0x35, 0x90, 0x33, 0xc7, 0x74, 0x98, 0xd9, 0xfc, 0x1f, 0x61, - 0xe1, 0x20, 0xa1, 0x69, 0x40, 0x3e, 0xa2, 0x1d, 0x68, 0xc5, 0x74, 0x28, 0xb0, 0x18, 0x0d, 0x2e, - 0x70, 0x82, 0x4f, 0x89, 0x18, 0xb0, 0x24, 0x1e, 0xb5, 0xe7, 0xba, 0x5e, 0x6f, 0x31, 0x40, 0xc6, - 0xf7, 0x6b, 0xe6, 0x3a, 0x4c, 0xe2, 0x91, 0xff, 0xdf, 0x1c, 0x2c, 0x66, 0xd1, 0x92, 0xa3, 0x9f, - 0x60, 0x91, 0x26, 0x32, 0xc5, 0x49, 0x48, 0xda, 0x5e, 0xd7, 0xeb, 0x35, 0x77, 0x9f, 0xf7, 0x0b, - 0x8e, 0xde, 0x3f, 0x30, 0x60, 0xe0, 0x42, 0xd0, 0x77, 0xf0, 0x8c, 0xc7, 0x38, 0xfd, 0xc0, 0xc4, - 0x85, 0x1c, 0xd0, 0x24, 0x22, 0x7f, 0x0d, 0x88, 0x10, 0x4c, 0xc8, 0xf6, 0x5c, 0xf7, 0x7e, 0xaf, - 0x11, 0xb4, 0x9c, 0xf7, 0x40, 0x39, 0x7f, 0xd6, 0x3e, 0xb4, 0x0b, 0x4f, 0xb3, 0xf7, 0xa2, 0x64, - 0x22, 0xaa, 0x7d, 0xbf, 0xeb, 0xf5, 0x1a, 0xc1, 0x13, 0xe7, 0x1c, 0x07, 0xa1, 0x13, 0x78, 0x1c, - 0xb1, 0x3f, 0x13, 0x55, 0x98, 0x01, 0x17, 0xec, 0x54, 0x10, 0x29, 0xdb, 0x0f, 0xf4, 0x1b, 0xaf, - 0x17, 0xbe, 0xf1, 0xbe, 0x89, 0x78, 0x67, 0x02, 0x82, 0x47, 0xd1, 0x35, 0x0b, 0x7a, 0x03, 0xcb, - 0x29, 0x96, 0xe7, 0x63, 0xcd, 0x2f, 0xb4, 0xe6, 0xcb, 0x42, 0xcd, 0xdf, 0xb0, 0x3c, 0x77, 0x7a, - 0x4b, 0x69, 0xee, 0xc9, 0xff, 0x05, 0x60, 0x9f, 0xc8, 0x54, 0xb0, 0x91, 0xea, 0xcc, 0xed, 0x4a, - 0xeb, 0x2f, 0x43, 0xd3, 0x89, 0x49, 0xee, 0xbf, 0x81, 0x46, 0x40, 0x64, 0x88, 0x93, 0x3b, 0x90, - 0xbe, 0x02, 0xb0, 0x5a, 0x92, 0x97, 0xf4, 0xd0, 0xfb, 0x94, 0x1e, 0xce, 0x15, 0xf6, 0xd0, 0x3f, - 0x84, 0x95, 0x63, 0x1e, 0xe1, 0x94, 0x68, 0xdb, 0x1d, 0x1c, 0x84, 0xc2, 0xc3, 0x09, 0x41, 0xc9, - 0xa7, 0xcf, 0x89, 0x77, 0xeb, 0x39, 0xf1, 0x7f, 0x87, 0xd5, 0x2c, 0xd5, 0xdb, 0x89, 0x83, 0xdd, - 0xc1, 0x21, 0x04, 0xb4, 0xa7, 0x2b, 0x7f, 0xc6, 0xd3, 0x2c, 0x01, 0x9c, 0x10, 0x21, 0x29, 0x53, - 0xe3, 0xe4, 0xaf, 0x41, 0xd3, 0x3d, 0x49, 0x8e, 0xda, 0xb0, 0x70, 0x95, 0x3d, 0xea, 0x54, 0x8d, - 0xc0, 0x3e, 0xee, 0xfe, 0xdb, 0x82, 0xe6, 0x5e, 0x96, 0xf2, 0x35, 0x13, 0x04, 0x1d, 0xc2, 0x03, - 0x75, 0x93, 0xa0, 0x6e, 0xc9, 0x79, 0xf5, 0x35, 0xd5, 0x79, 0x5e, 0x41, 0x48, 0xee, 0xdf, 0xdb, - 0xf1, 0xd0, 0x09, 0x2c, 0x98, 0xa1, 0x47, 0x2f, 0x8a, 0xcf, 0xe7, 0x76, 0xac, 0xf3, 0x65, 0x35, - 0xa4, 0x94, 0xd1, 0x11, 0xcc, 0x67, 0x13, 0x8f, 0xfc, 0xc2, 0x08, 0xb7, 0x5e, 0x9d, 0x17, 0x95, - 0x8c, 0x16, 0x8d, 0xa0, 0x99, 0x9b, 0x3e, 0xb4, 0x56, 0x18, 0x35, 0x39, 0xf4, 0x9d, 0x5e, 0x3d, - 0xd0, 0x94, 0xe4, 0x6f, 0x68, 0x4d, 0x1b, 0x0f, 0xb4, 0x53, 0xa1, 0x72, 0x63, 0x4e, 0x3b, 0xdf, - 0xcc, 0x18, 0x31, 0xee, 0x89, 0x99, 0x8e, 0x92, 0x9e, 0x8c, 0xa7, 0xa9, 0xa4, 0x27, 0xb9, 0x21, - 0xf3, 0xef, 0xa1, 0x10, 0x96, 0x5e, 0xa9, 0xcf, 0xca, 0x7d, 0x92, 0x62, 0x1a, 0x4b, 0x54, 0x5c, - 0x96, 0x3c, 0xa6, 0x32, 0xac, 0xd7, 0x24, 0x25, 0x47, 0x43, 0x68, 0x6a, 0xdb, 0x5e, 0x9a, 0xe2, - 0xf0, 0xac, 0xa4, 0x47, 0x39, 0xaa, 0xbc, 0x47, 0x13, 0xa0, 0xe4, 0x3b, 0x1e, 0x7a, 0x0f, 0x0d, - 0x6d, 0x7c, 0x4b, 0x65, 0x8a, 0x5e, 0x96, 0x07, 0x2a, 0x46, 0xe9, 0x7f, 0x55, 0x07, 0x93, 0xdc, - 0x15, 0x49, 0x19, 0xf6, 0xe2, 0xb8, 0xaa, 0x48, 0x06, 0xab, 0x51, 0x24, 0x47, 0xea, 0x5b, 0x66, - 0xe1, 0x75, 0xf6, 0xfd, 0xa4, 0xa4, 0xc3, 0x86, 0x28, 0xef, 0xb0, 0x83, 0x74, 0x61, 0x12, 0x78, - 0xf8, 0xce, 0x7c, 0x76, 0xe8, 0x7b, 0x2f, 0x8e, 0xd1, 0x66, 0x61, 0xe8, 0x35, 0x52, 0xe5, 0xf9, - 0xba, 0x3e, 0xac, 0xf3, 0x7d, 0x84, 0x47, 0xd6, 0x61, 0xef, 0x40, 0x54, 0xad, 0x61, 0x51, 0x95, - 0x71, 0x6b, 0x06, 0x5a, 0xa7, 0x4c, 0xe1, 0xb1, 0xf5, 0x1c, 0x27, 0xd4, 0x1c, 0xb2, 0x5a, 0xc5, - 0xb1, 0x2a, 0x69, 0x7f, 0x16, 0xfc, 0x7a, 0x61, 0x8f, 0xf9, 0xa9, 0xc0, 0x11, 0xa9, 0x51, 0x58, - 0x43, 0xd6, 0x2b, 0xac, 0x83, 0x75, 0xbe, 0x23, 0x98, 0x3f, 0xd6, 0xdf, 0x49, 0x4b, 0xae, 0xcf, - 0x0c, 0x28, 0xbf, 0x3e, 0x2d, 0xa3, 0x45, 0x29, 0xac, 0xd8, 0x6c, 0x47, 0x04, 0x8b, 0xf0, 0x0c, - 0x6d, 0x54, 0xbe, 0x56, 0x06, 0xaa, 0x24, 0x9b, 0xb5, 0xd9, 0x6c, 0x8b, 0xac, 0x55, 0x2f, 0x69, - 0xaf, 0x32, 0xd8, 0xee, 0xe9, 0x7a, 0x4d, 0x52, 0x72, 0xd5, 0x94, 0xec, 0x06, 0x1d, 0xb9, 0xe1, - 0x2b, 0x7e, 0xc9, 0x6b, 0x64, 0x79, 0x53, 0x6e, 0xc0, 0xba, 0x7e, 0xe7, 0xb0, 0x62, 0x1c, 0x76, - 0xb9, 0x36, 0xaa, 0x14, 0x72, 0xbb, 0xb5, 0x59, 0x9b, 0xb5, 0xab, 0x65, 0xec, 0xe3, 0x31, 0xaf, - 0x7c, 0xe1, 0x89, 0x29, 0xdf, 0x9a, 0x81, 0xb6, 0xab, 0x65, 0x3d, 0xd9, 0x30, 0xee, 0x95, 0xae, - 0xd6, 0x0d, 0xb6, 0x7c, 0xb5, 0xa6, 0xe0, 0x3a, 0xeb, 0x3f, 0x1e, 0x74, 0x8c, 0x2f, 0x20, 0x92, - 0xc5, 0x57, 0x64, 0x9f, 0x70, 0x92, 0x44, 0x24, 0x09, 0x29, 0x91, 0xe8, 0xfb, 0x2a, 0xc1, 0x29, - 0x41, 0xea, 0x45, 0x7e, 0xf8, 0xa4, 0x38, 0xc9, 0xd1, 0x07, 0x58, 0x36, 0x84, 0x59, 0x92, 0xf5, - 0x2a, 0xa5, 0xf1, 0x8e, 0x6c, 0xd4, 0x45, 0x25, 0x47, 0x7f, 0x40, 0xd3, 0x18, 0xf5, 0x86, 0xac, - 0x55, 0x85, 0xda, 0x05, 0xe9, 0xd5, 0x03, 0x25, 0x7f, 0xb5, 0xf5, 0x7e, 0xf3, 0x94, 0xa6, 0x67, - 0x97, 0x43, 0x85, 0x6c, 0x9b, 0x10, 0xfb, 0x77, 0x2b, 0x8c, 0xe9, 0xb6, 0xe0, 0xa1, 0xfb, 0x1d, - 0x3e, 0x9c, 0xd7, 0x3f, 0x75, 0xbf, 0xfd, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xd5, 0xf5, 0x48, 0xa1, - 0xa3, 0x0f, 0x00, 0x00, + // 1012 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x98, 0xdd, 0x52, 0xdb, 0x46, + 0x14, 0x80, 0x23, 0x92, 0x02, 0x3e, 0x06, 0x92, 0x6c, 0x08, 0x78, 0x7c, 0x65, 0x94, 0xa6, 0x18, + 0x5c, 0x0c, 0xa5, 0x9d, 0xf6, 0xa2, 0x93, 0xce, 0x98, 0xd0, 0xce, 0x90, 0xa6, 0x43, 0x46, 0x14, + 0xa6, 0x93, 0x1b, 0x77, 0x2d, 0x6d, 0x60, 0x07, 0x59, 0xbb, 0xd9, 0x15, 0xb4, 0xbe, 0xea, 0x13, + 0xf4, 0x25, 0xfa, 0x3c, 0xbd, 0xef, 0xeb, 0x74, 0x76, 0xb5, 0x2b, 0x5b, 0x60, 0xfd, 0xf0, 0x93, + 0x2b, 0xd0, 0x39, 0xdf, 0x39, 0x67, 0xf7, 0xfc, 0x49, 0x00, 0xab, 0x3e, 0x1b, 0x0e, 0x71, 0x14, + 0xc8, 0x6d, 0xfb, 0x4b, 0x97, 0x0b, 0x16, 0x33, 0xb4, 0xea, 0xfb, 0x5d, 0x2c, 0x82, 0x0b, 0x1a, + 0xb1, 0xae, 0x1f, 0xd2, 0xae, 0x55, 0x37, 0x9f, 0x67, 0x2c, 0x58, 0x94, 0xf0, 0xcd, 0xe5, 0x54, + 0x3c, 0x60, 0x58, 0x04, 0x46, 0xba, 0x32, 0x09, 0x73, 0x1a, 0x12, 0x23, 0x7f, 0x36, 0x21, 0x17, + 0x56, 0x38, 0xf6, 0x7c, 0xc1, 0x43, 0x86, 0xad, 0x0f, 0x94, 0x8a, 0x43, 0x3a, 0x48, 0x64, 0xee, + 0xf7, 0x30, 0x77, 0x10, 0xd1, 0xd8, 0x23, 0x1f, 0xd1, 0x0e, 0x2c, 0x87, 0x74, 0x20, 0xb0, 0x18, + 0xf5, 0x87, 0x38, 0xc2, 0xa7, 0x44, 0xf4, 0x59, 0x14, 0x8e, 0x1a, 0x33, 0x2d, 0xa7, 0x3d, 0xef, + 0x21, 0xa3, 0xfb, 0x25, 0x51, 0x1d, 0x46, 0xe1, 0xc8, 0xfd, 0x6f, 0x06, 0xe6, 0x13, 0x6b, 0xc9, + 0xd1, 0x2b, 0x98, 0xa7, 0x91, 0x8c, 0x71, 0xe4, 0x93, 0x86, 0xd3, 0x72, 0xda, 0xf5, 0xdd, 0xb5, + 0x6e, 0xce, 0xd5, 0xbb, 0x07, 0x06, 0xf4, 0x52, 0x13, 0xf4, 0x0d, 0xac, 0xf0, 0x10, 0xc7, 0x1f, + 0x98, 0x18, 0xca, 0x3e, 0x8d, 0x02, 0xf2, 0x67, 0x9f, 0x08, 0xc1, 0x84, 0x6c, 0xcc, 0xb4, 0x1e, + 0xb6, 0x6b, 0xde, 0x72, 0xaa, 0x3d, 0x50, 0xca, 0x1f, 0xb5, 0x0e, 0xed, 0xc2, 0xf3, 0xe4, 0x5c, + 0x94, 0x64, 0xac, 0x1a, 0x0f, 0x5b, 0x4e, 0xbb, 0xe6, 0x3d, 0x4b, 0x95, 0x63, 0x23, 0x74, 0x02, + 0x4f, 0x03, 0xf6, 0x47, 0xa4, 0x12, 0xd3, 0xe7, 0x82, 0x9d, 0x0a, 0x22, 0x65, 0xe3, 0x91, 0x3e, + 0xf1, 0x46, 0xee, 0x89, 0xf7, 0x8d, 0xc5, 0x3b, 0x63, 0xe0, 0x3d, 0x09, 0xae, 0x48, 0xd0, 0x1b, + 0x58, 0x8c, 0xb1, 0x3c, 0x1f, 0xfb, 0xfc, 0x4c, 0xfb, 0x7c, 0x99, 0xeb, 0xf3, 0x57, 0x2c, 0xcf, + 0x53, 0x7f, 0x0b, 0xf1, 0xc4, 0x93, 0xfb, 0x33, 0xc0, 0x3e, 0x91, 0xb1, 0x60, 0x23, 0x55, 0x99, + 0xbb, 0xa5, 0xd6, 0x5d, 0x84, 0x7a, 0xea, 0x4c, 0x72, 0xf7, 0x0d, 0xd4, 0x3c, 0x22, 0x7d, 0x1c, + 0xdd, 0x83, 0xeb, 0x4b, 0x00, 0xeb, 0x4b, 0xf2, 0x82, 0x1a, 0x3a, 0xb7, 0xa9, 0xe1, 0x4c, 0x6e, + 0x0d, 0xdd, 0x43, 0x58, 0x3a, 0xe6, 0x01, 0x8e, 0x89, 0x96, 0xdd, 0xc3, 0x45, 0x28, 0x3c, 0xce, + 0x38, 0x94, 0x7c, 0x7a, 0x9f, 0x38, 0x77, 0xee, 0x13, 0xf7, 0x37, 0x58, 0x4d, 0x42, 0xbd, 0xcd, + 0x5c, 0xec, 0x1e, 0x2e, 0x21, 0xa0, 0x31, 0xdd, 0xf3, 0x27, 0xbc, 0xcd, 0x02, 0xc0, 0x09, 0x11, + 0x92, 0x32, 0xd5, 0x4e, 0xee, 0x3a, 0xd4, 0xd3, 0x27, 0xc9, 0x51, 0x03, 0xe6, 0x2e, 0x93, 0x47, + 0x1d, 0xaa, 0xe6, 0xd9, 0xc7, 0xdd, 0x7f, 0x57, 0xa0, 0xde, 0x4b, 0x42, 0xbe, 0x66, 0x82, 0xa0, + 0x43, 0x78, 0xa4, 0x36, 0x09, 0x6a, 0x15, 0xdc, 0x57, 0xaf, 0xa9, 0xe6, 0x5a, 0x09, 0x21, 0xb9, + 0xfb, 0x60, 0xc7, 0x41, 0x27, 0x30, 0x67, 0x9a, 0x1e, 0xbd, 0xc8, 0xbf, 0x5f, 0x3a, 0x63, 0xcd, + 0xcf, 0xcb, 0x21, 0xe5, 0x19, 0x1d, 0xc1, 0x6c, 0xd2, 0xf1, 0xc8, 0xcd, 0xb5, 0x48, 0xc7, 0xab, + 0xf9, 0xa2, 0x94, 0xd1, 0x4e, 0x03, 0xa8, 0x4f, 0x74, 0x1f, 0x5a, 0xcf, 0xb5, 0xca, 0x36, 0x7d, + 0xb3, 0x5d, 0x0d, 0x34, 0x29, 0xf9, 0x0b, 0x96, 0xa7, 0xb5, 0x07, 0xda, 0x29, 0xf1, 0x72, 0xad, + 0x4f, 0x9b, 0x5f, 0xdd, 0xd0, 0x62, 0x5c, 0x13, 0xd3, 0x1d, 0x05, 0x35, 0x19, 0x77, 0x53, 0x41, + 0x4d, 0x26, 0x9a, 0xcc, 0x7d, 0x80, 0x7c, 0x58, 0xd8, 0x53, 0xef, 0xca, 0x7d, 0x12, 0x63, 0x1a, + 0x4a, 0x94, 0x9f, 0x96, 0x49, 0x4c, 0x45, 0xd8, 0xa8, 0x48, 0x4a, 0x8e, 0x06, 0x50, 0xd7, 0xb2, + 0x5e, 0x1c, 0x63, 0xff, 0xac, 0xa0, 0x46, 0x13, 0x54, 0x71, 0x8d, 0x32, 0xa0, 0xe4, 0x3b, 0x0e, + 0x7a, 0x0f, 0x35, 0x2d, 0x7c, 0x4b, 0x65, 0x8c, 0x5e, 0x16, 0x1b, 0x2a, 0x46, 0xf9, 0xff, 0xa2, + 0x0a, 0x26, 0x79, 0x9a, 0x24, 0x25, 0xe8, 0x85, 0x61, 0x59, 0x92, 0x0c, 0x56, 0x21, 0x49, 0x29, + 0xa9, 0xb7, 0xcc, 0xdc, 0xeb, 0xe4, 0xfb, 0xa4, 0xa0, 0xc2, 0x86, 0x28, 0xae, 0x70, 0x0a, 0xe9, + 0xc4, 0x44, 0xf0, 0xf8, 0x9d, 0x79, 0x77, 0xe8, 0xbd, 0x17, 0x86, 0xa8, 0x93, 0x6b, 0x7a, 0x85, + 0x54, 0x71, 0xbe, 0xac, 0x0e, 0xeb, 0x78, 0x1f, 0xe1, 0x89, 0x55, 0xd8, 0x1d, 0x88, 0xca, 0x7d, + 0x58, 0x54, 0x45, 0xdc, 0xba, 0x01, 0xad, 0x43, 0xc6, 0xf0, 0xd4, 0x6a, 0x8e, 0x23, 0x6a, 0x2e, + 0x59, 0xee, 0x25, 0x65, 0x55, 0xd0, 0xee, 0x4d, 0xf0, 0xab, 0x89, 0x3d, 0xe6, 0xa7, 0x02, 0x07, + 0xa4, 0x42, 0x62, 0x0d, 0x59, 0x2d, 0xb1, 0x29, 0xac, 0xe3, 0x1d, 0xc1, 0xec, 0xb1, 0xfe, 0x26, + 0x2d, 0x58, 0x9f, 0x09, 0x50, 0xbc, 0x3e, 0x2d, 0xa3, 0x9d, 0xfe, 0xe3, 0xc0, 0x9a, 0xea, 0x42, + 0xfd, 0x52, 0xc2, 0xc3, 0x21, 0x11, 0xb2, 0x77, 0x89, 0x69, 0x88, 0x07, 0x21, 0xf9, 0x89, 0x09, + 0x13, 0xf0, 0x55, 0xae, 0xb3, 0x52, 0x5b, 0x75, 0x96, 0x1f, 0xee, 0x62, 0x2e, 0x39, 0x3a, 0x87, + 0xa5, 0xbd, 0x0b, 0x11, 0xed, 0x31, 0x16, 0x2b, 0x19, 0x11, 0x68, 0x33, 0x7f, 0xae, 0x32, 0xa0, + 0x8a, 0xde, 0xa9, 0xcc, 0xea, 0x8c, 0x50, 0x58, 0xb2, 0xf9, 0x3f, 0x22, 0x58, 0xf8, 0x67, 0x05, + 0xc1, 0xb2, 0x60, 0x71, 0xb0, 0xab, 0x6c, 0xb2, 0x57, 0xac, 0x54, 0xaf, 0xad, 0x76, 0xa9, 0xb1, + 0xdd, 0x5c, 0x1b, 0x15, 0x49, 0xc9, 0x55, 0x9b, 0x26, 0xef, 0x94, 0x51, 0x3a, 0x8e, 0x9d, 0x82, + 0x7a, 0x64, 0xc8, 0xe2, 0x36, 0xbd, 0x06, 0xeb, 0xfc, 0x9d, 0xc3, 0x92, 0x51, 0xd8, 0x75, 0xb3, + 0x59, 0xe6, 0x61, 0x62, 0xdb, 0x74, 0x2a, 0xb3, 0x76, 0xd9, 0x18, 0xf9, 0x78, 0xf0, 0x4b, 0x0f, + 0x9c, 0x99, 0xfb, 0xad, 0x1b, 0xd0, 0x76, 0xd9, 0x58, 0x4d, 0x32, 0x9e, 0xbd, 0xc2, 0x65, 0x73, + 0x8d, 0x2d, 0x5e, 0x36, 0x53, 0x70, 0x1d, 0xf5, 0x6f, 0x07, 0x9a, 0x46, 0xe7, 0x11, 0xc9, 0xc2, + 0x4b, 0xb2, 0x4f, 0x38, 0x89, 0x02, 0x12, 0xf9, 0x94, 0x48, 0xf4, 0x6d, 0x99, 0xc3, 0x29, 0x46, + 0xea, 0x20, 0xdf, 0xdd, 0xca, 0x4e, 0x72, 0xf4, 0x01, 0x16, 0x0d, 0x61, 0x86, 0x64, 0xa3, 0xcc, + 0xd3, 0x78, 0x46, 0x36, 0xab, 0xa2, 0x92, 0xa3, 0xdf, 0xa1, 0x6e, 0x84, 0x7a, 0x42, 0xd6, 0xcb, + 0x4c, 0xed, 0x80, 0xb4, 0xab, 0x81, 0x92, 0xef, 0x6d, 0xbd, 0xef, 0x9c, 0xd2, 0xf8, 0xec, 0x62, + 0xa0, 0x90, 0x6d, 0x63, 0x62, 0x7f, 0x6e, 0xf9, 0x21, 0xdd, 0x16, 0xdc, 0x4f, 0xff, 0x33, 0x31, + 0x98, 0xd5, 0x7f, 0xfc, 0x7f, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbe, 0x72, 0x97, 0x90, + 0xb5, 0x10, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -664,16 +668,28 @@ type ArduinoCoreClient interface { PlatformUpgrade(ctx context.Context, in *PlatformUpgradeReq, opts ...grpc.CallOption) (ArduinoCore_PlatformUpgradeClient, error) // Upload a compiled sketch to an Arduino board. Upload(ctx context.Context, in *UploadReq, opts ...grpc.CallOption) (ArduinoCore_UploadClient, error) + ListProgrammersAvailableForUpload(ctx context.Context, in *ListProgrammersAvailableForUploadReq, opts ...grpc.CallOption) (*ListProgrammersAvailableForUploadResp, error) + // Burn bootloader to a board. + BurnBootloader(ctx context.Context, in *BurnBootloaderReq, opts ...grpc.CallOption) (ArduinoCore_BurnBootloaderClient, error) // Search for a platform in the platforms indexes. PlatformSearch(ctx context.Context, in *PlatformSearchReq, opts ...grpc.CallOption) (*PlatformSearchResp, error) // List all installed platforms. PlatformList(ctx context.Context, in *PlatformListReq, opts ...grpc.CallOption) (*PlatformListResp, error) + // Download the archive file of an Arduino library in the libraries index to + // the staging directory. LibraryDownload(ctx context.Context, in *LibraryDownloadReq, opts ...grpc.CallOption) (ArduinoCore_LibraryDownloadClient, error) + // Download and install an Arduino library from the libraries index. LibraryInstall(ctx context.Context, in *LibraryInstallReq, opts ...grpc.CallOption) (ArduinoCore_LibraryInstallClient, error) + // Uninstall an Arduino library. LibraryUninstall(ctx context.Context, in *LibraryUninstallReq, opts ...grpc.CallOption) (ArduinoCore_LibraryUninstallClient, error) + // Upgrade all installed Arduino libraries to the newest version available. LibraryUpgradeAll(ctx context.Context, in *LibraryUpgradeAllReq, opts ...grpc.CallOption) (ArduinoCore_LibraryUpgradeAllClient, error) + // List the recursive dependencies of a library, as defined by the `depends` + // field of the library.properties files. LibraryResolveDependencies(ctx context.Context, in *LibraryResolveDependenciesReq, opts ...grpc.CallOption) (*LibraryResolveDependenciesResp, error) + // Search the Arduino libraries index for libraries. LibrarySearch(ctx context.Context, in *LibrarySearchReq, opts ...grpc.CallOption) (*LibrarySearchResp, error) + // List the installed libraries. LibraryList(ctx context.Context, in *LibraryListReq, opts ...grpc.CallOption) (*LibraryListResp, error) } @@ -1059,6 +1075,47 @@ func (x *arduinoCoreUploadClient) Recv() (*UploadResp, error) { return m, nil } +func (c *arduinoCoreClient) ListProgrammersAvailableForUpload(ctx context.Context, in *ListProgrammersAvailableForUploadReq, opts ...grpc.CallOption) (*ListProgrammersAvailableForUploadResp, error) { + out := new(ListProgrammersAvailableForUploadResp) + err := c.cc.Invoke(ctx, "/cc.arduino.cli.commands.ArduinoCore/ListProgrammersAvailableForUpload", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *arduinoCoreClient) BurnBootloader(ctx context.Context, in *BurnBootloaderReq, opts ...grpc.CallOption) (ArduinoCore_BurnBootloaderClient, error) { + stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[10], "/cc.arduino.cli.commands.ArduinoCore/BurnBootloader", opts...) + if err != nil { + return nil, err + } + x := &arduinoCoreBurnBootloaderClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type ArduinoCore_BurnBootloaderClient interface { + Recv() (*BurnBootloaderResp, error) + grpc.ClientStream +} + +type arduinoCoreBurnBootloaderClient struct { + grpc.ClientStream +} + +func (x *arduinoCoreBurnBootloaderClient) Recv() (*BurnBootloaderResp, error) { + m := new(BurnBootloaderResp) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + func (c *arduinoCoreClient) PlatformSearch(ctx context.Context, in *PlatformSearchReq, opts ...grpc.CallOption) (*PlatformSearchResp, error) { out := new(PlatformSearchResp) err := c.cc.Invoke(ctx, "/cc.arduino.cli.commands.ArduinoCore/PlatformSearch", in, out, opts...) @@ -1078,7 +1135,7 @@ func (c *arduinoCoreClient) PlatformList(ctx context.Context, in *PlatformListRe } func (c *arduinoCoreClient) LibraryDownload(ctx context.Context, in *LibraryDownloadReq, opts ...grpc.CallOption) (ArduinoCore_LibraryDownloadClient, error) { - stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[10], "/cc.arduino.cli.commands.ArduinoCore/LibraryDownload", opts...) + stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[11], "/cc.arduino.cli.commands.ArduinoCore/LibraryDownload", opts...) if err != nil { return nil, err } @@ -1110,7 +1167,7 @@ func (x *arduinoCoreLibraryDownloadClient) Recv() (*LibraryDownloadResp, error) } func (c *arduinoCoreClient) LibraryInstall(ctx context.Context, in *LibraryInstallReq, opts ...grpc.CallOption) (ArduinoCore_LibraryInstallClient, error) { - stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[11], "/cc.arduino.cli.commands.ArduinoCore/LibraryInstall", opts...) + stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[12], "/cc.arduino.cli.commands.ArduinoCore/LibraryInstall", opts...) if err != nil { return nil, err } @@ -1142,7 +1199,7 @@ func (x *arduinoCoreLibraryInstallClient) Recv() (*LibraryInstallResp, error) { } func (c *arduinoCoreClient) LibraryUninstall(ctx context.Context, in *LibraryUninstallReq, opts ...grpc.CallOption) (ArduinoCore_LibraryUninstallClient, error) { - stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[12], "/cc.arduino.cli.commands.ArduinoCore/LibraryUninstall", opts...) + stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[13], "/cc.arduino.cli.commands.ArduinoCore/LibraryUninstall", opts...) if err != nil { return nil, err } @@ -1174,7 +1231,7 @@ func (x *arduinoCoreLibraryUninstallClient) Recv() (*LibraryUninstallResp, error } func (c *arduinoCoreClient) LibraryUpgradeAll(ctx context.Context, in *LibraryUpgradeAllReq, opts ...grpc.CallOption) (ArduinoCore_LibraryUpgradeAllClient, error) { - stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[13], "/cc.arduino.cli.commands.ArduinoCore/LibraryUpgradeAll", opts...) + stream, err := c.cc.NewStream(ctx, &_ArduinoCore_serviceDesc.Streams[14], "/cc.arduino.cli.commands.ArduinoCore/LibraryUpgradeAll", opts...) if err != nil { return nil, err } @@ -1269,16 +1326,28 @@ type ArduinoCoreServer interface { PlatformUpgrade(*PlatformUpgradeReq, ArduinoCore_PlatformUpgradeServer) error // Upload a compiled sketch to an Arduino board. Upload(*UploadReq, ArduinoCore_UploadServer) error + ListProgrammersAvailableForUpload(context.Context, *ListProgrammersAvailableForUploadReq) (*ListProgrammersAvailableForUploadResp, error) + // Burn bootloader to a board. + BurnBootloader(*BurnBootloaderReq, ArduinoCore_BurnBootloaderServer) error // Search for a platform in the platforms indexes. PlatformSearch(context.Context, *PlatformSearchReq) (*PlatformSearchResp, error) // List all installed platforms. PlatformList(context.Context, *PlatformListReq) (*PlatformListResp, error) + // Download the archive file of an Arduino library in the libraries index to + // the staging directory. LibraryDownload(*LibraryDownloadReq, ArduinoCore_LibraryDownloadServer) error + // Download and install an Arduino library from the libraries index. LibraryInstall(*LibraryInstallReq, ArduinoCore_LibraryInstallServer) error + // Uninstall an Arduino library. LibraryUninstall(*LibraryUninstallReq, ArduinoCore_LibraryUninstallServer) error + // Upgrade all installed Arduino libraries to the newest version available. LibraryUpgradeAll(*LibraryUpgradeAllReq, ArduinoCore_LibraryUpgradeAllServer) error + // List the recursive dependencies of a library, as defined by the `depends` + // field of the library.properties files. LibraryResolveDependencies(context.Context, *LibraryResolveDependenciesReq) (*LibraryResolveDependenciesResp, error) + // Search the Arduino libraries index for libraries. LibrarySearch(context.Context, *LibrarySearchReq) (*LibrarySearchResp, error) + // List the installed libraries. LibraryList(context.Context, *LibraryListReq) (*LibraryListResp, error) } @@ -1334,6 +1403,12 @@ func (*UnimplementedArduinoCoreServer) PlatformUpgrade(req *PlatformUpgradeReq, func (*UnimplementedArduinoCoreServer) Upload(req *UploadReq, srv ArduinoCore_UploadServer) error { return status.Errorf(codes.Unimplemented, "method Upload not implemented") } +func (*UnimplementedArduinoCoreServer) ListProgrammersAvailableForUpload(ctx context.Context, req *ListProgrammersAvailableForUploadReq) (*ListProgrammersAvailableForUploadResp, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListProgrammersAvailableForUpload not implemented") +} +func (*UnimplementedArduinoCoreServer) BurnBootloader(req *BurnBootloaderReq, srv ArduinoCore_BurnBootloaderServer) error { + return status.Errorf(codes.Unimplemented, "method BurnBootloader not implemented") +} func (*UnimplementedArduinoCoreServer) PlatformSearch(ctx context.Context, req *PlatformSearchReq) (*PlatformSearchResp, error) { return nil, status.Errorf(codes.Unimplemented, "method PlatformSearch not implemented") } @@ -1684,6 +1759,45 @@ func (x *arduinoCoreUploadServer) Send(m *UploadResp) error { return x.ServerStream.SendMsg(m) } +func _ArduinoCore_ListProgrammersAvailableForUpload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListProgrammersAvailableForUploadReq) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ArduinoCoreServer).ListProgrammersAvailableForUpload(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/cc.arduino.cli.commands.ArduinoCore/ListProgrammersAvailableForUpload", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ArduinoCoreServer).ListProgrammersAvailableForUpload(ctx, req.(*ListProgrammersAvailableForUploadReq)) + } + return interceptor(ctx, in, info, handler) +} + +func _ArduinoCore_BurnBootloader_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(BurnBootloaderReq) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(ArduinoCoreServer).BurnBootloader(m, &arduinoCoreBurnBootloaderServer{stream}) +} + +type ArduinoCore_BurnBootloaderServer interface { + Send(*BurnBootloaderResp) error + grpc.ServerStream +} + +type arduinoCoreBurnBootloaderServer struct { + grpc.ServerStream +} + +func (x *arduinoCoreBurnBootloaderServer) Send(m *BurnBootloaderResp) error { + return x.ServerStream.SendMsg(m) +} + func _ArduinoCore_PlatformSearch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PlatformSearchReq) if err := dec(in); err != nil { @@ -1886,6 +2000,10 @@ var _ArduinoCore_serviceDesc = grpc.ServiceDesc{ MethodName: "BoardListAll", Handler: _ArduinoCore_BoardListAll_Handler, }, + { + MethodName: "ListProgrammersAvailableForUpload", + Handler: _ArduinoCore_ListProgrammersAvailableForUpload_Handler, + }, { MethodName: "PlatformSearch", Handler: _ArduinoCore_PlatformSearch_Handler, @@ -1958,6 +2076,11 @@ var _ArduinoCore_serviceDesc = grpc.ServiceDesc{ Handler: _ArduinoCore_Upload_Handler, ServerStreams: true, }, + { + StreamName: "BurnBootloader", + Handler: _ArduinoCore_BurnBootloader_Handler, + ServerStreams: true, + }, { StreamName: "LibraryDownload", Handler: _ArduinoCore_LibraryDownload_Handler, diff --git a/rpc/commands/commands.proto b/rpc/commands/commands.proto index 82f78d57d0d..661b4fc901c 100644 --- a/rpc/commands/commands.proto +++ b/rpc/commands/commands.proto @@ -85,24 +85,38 @@ service ArduinoCore { // Upload a compiled sketch to an Arduino board. rpc Upload(UploadReq) returns (stream UploadResp); + rpc ListProgrammersAvailableForUpload(ListProgrammersAvailableForUploadReq) returns (ListProgrammersAvailableForUploadResp); + + // Burn bootloader to a board. + rpc BurnBootloader(BurnBootloaderReq) returns (stream BurnBootloaderResp); + // Search for a platform in the platforms indexes. rpc PlatformSearch(PlatformSearchReq) returns (PlatformSearchResp); // List all installed platforms. rpc PlatformList(PlatformListReq) returns (PlatformListResp); + // Download the archive file of an Arduino library in the libraries index to + // the staging directory. rpc LibraryDownload(LibraryDownloadReq) returns (stream LibraryDownloadResp); + // Download and install an Arduino library from the libraries index. rpc LibraryInstall(LibraryInstallReq) returns (stream LibraryInstallResp); + // Uninstall an Arduino library. rpc LibraryUninstall(LibraryUninstallReq) returns (stream LibraryUninstallResp); + // Upgrade all installed Arduino libraries to the newest version available. rpc LibraryUpgradeAll(LibraryUpgradeAllReq) returns (stream LibraryUpgradeAllResp); + // List the recursive dependencies of a library, as defined by the `depends` + // field of the library.properties files. rpc LibraryResolveDependencies(LibraryResolveDependenciesReq) returns (LibraryResolveDependenciesResp); + // Search the Arduino libraries index for libraries. rpc LibrarySearch(LibrarySearchReq) returns (LibrarySearchResp); + // List the installed libraries. rpc LibraryList(LibraryListReq) returns (LibraryListResp); } diff --git a/rpc/commands/compile.pb.go b/rpc/commands/compile.pb.go index e00cd60c078..6fd68105474 100644 --- a/rpc/commands/compile.pb.go +++ b/rpc/commands/compile.pb.go @@ -39,6 +39,7 @@ type CompileReq struct { OptimizeForDebug bool `protobuf:"varint,16,opt,name=optimizeForDebug,proto3" json:"optimizeForDebug,omitempty"` DryRun bool `protobuf:"varint,17,opt,name=dryRun,proto3" json:"dryRun,omitempty"` ExportDir string `protobuf:"bytes,18,opt,name=export_dir,json=exportDir,proto3" json:"export_dir,omitempty"` + Programmer string `protobuf:"bytes,19,opt,name=programmer,proto3" json:"programmer,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -196,6 +197,13 @@ func (m *CompileReq) GetExportDir() string { return "" } +func (m *CompileReq) GetProgrammer() string { + if m != nil { + return m.Programmer + } + return "" +} + type CompileResp struct { OutStream []byte `protobuf:"bytes,1,opt,name=out_stream,json=outStream,proto3" json:"out_stream,omitempty"` ErrStream []byte `protobuf:"bytes,2,opt,name=err_stream,json=errStream,proto3" json:"err_stream,omitempty"` @@ -251,34 +259,35 @@ func init() { func init() { proto.RegisterFile("commands/compile.proto", fileDescriptor_86bc582849c76c3d) } var fileDescriptor_86bc582849c76c3d = []byte{ - // 453 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x6f, 0xd3, 0x40, - 0x10, 0x85, 0xe5, 0x34, 0x49, 0xe3, 0x49, 0x69, 0xcb, 0x0a, 0xca, 0xaa, 0x02, 0x64, 0x72, 0x40, - 0x16, 0xa8, 0x8e, 0x04, 0x67, 0x2e, 0x6d, 0x55, 0x09, 0x71, 0x89, 0xcc, 0x8d, 0x4b, 0x65, 0xaf, - 0x97, 0x78, 0xc0, 0xf6, 0x3a, 0xb3, 0xeb, 0x06, 0xf8, 0x9d, 0xfc, 0x20, 0xe4, 0x71, 0x9c, 0x44, - 0x41, 0x3d, 0xc5, 0xf3, 0xcd, 0xdb, 0xb7, 0x2f, 0xab, 0x07, 0x17, 0xca, 0x94, 0x65, 0x52, 0x65, - 0x76, 0xae, 0x4c, 0x59, 0x63, 0xa1, 0xa3, 0x9a, 0x8c, 0x33, 0xe2, 0x85, 0x52, 0x51, 0x42, 0x59, - 0x83, 0x95, 0x89, 0x54, 0x81, 0x51, 0x2f, 0xbb, 0x7c, 0xbe, 0x7f, 0xa0, 0x34, 0x55, 0xa7, 0x9f, - 0xfd, 0x1d, 0x02, 0xdc, 0x74, 0x0e, 0xb1, 0x5e, 0x89, 0x4f, 0x30, 0xc1, 0xca, 0xba, 0xa4, 0x52, - 0x5a, 0x7a, 0x81, 0x17, 0x4e, 0x3f, 0xbc, 0x89, 0x1e, 0x71, 0x8c, 0x3e, 0x6f, 0x84, 0xf1, 0xf6, - 0x88, 0x10, 0x30, 0xfc, 0xbe, 0x4a, 0x2b, 0x39, 0x08, 0xbc, 0xd0, 0x8f, 0xf9, 0x5b, 0xbc, 0x06, - 0xb0, 0x3f, 0xb5, 0x53, 0xf9, 0x22, 0x71, 0xb9, 0x3c, 0xe2, 0xcd, 0x1e, 0x11, 0x6f, 0xe1, 0xd4, - 0xe6, 0x66, 0xbd, 0x20, 0x53, 0x6b, 0x72, 0xa8, 0xad, 0x1c, 0x06, 0x5e, 0x38, 0x89, 0x0f, 0x68, - 0xeb, 0x53, 0x93, 0xae, 0xc9, 0x28, 0x6d, 0xad, 0x1c, 0xb1, 0x66, 0x8f, 0xb4, 0x3e, 0x69, 0x83, - 0x45, 0x76, 0x93, 0xa8, 0x5c, 0xf3, 0x5d, 0x63, 0xbe, 0xeb, 0x80, 0x8a, 0x97, 0xe0, 0x33, 0x61, - 0xc9, 0x31, 0x4b, 0x76, 0x40, 0x84, 0x70, 0xd6, 0x0d, 0xbb, 0x38, 0x93, 0xe0, 0x28, 0xf4, 0xe3, - 0x43, 0x2c, 0x2e, 0x61, 0xb2, 0x4e, 0xa8, 0xc2, 0x6a, 0x69, 0xa5, 0xcf, 0x36, 0xdb, 0x59, 0x48, - 0x38, 0x7e, 0xd0, 0x94, 0x1a, 0xab, 0x25, 0x70, 0xd0, 0x7e, 0x14, 0xcf, 0x60, 0xb4, 0x6a, 0x50, - 0x3b, 0x39, 0x65, 0xde, 0x0d, 0xe2, 0x02, 0xc6, 0x0f, 0x98, 0x2d, 0x30, 0x93, 0x27, 0xec, 0xb4, - 0x99, 0xc4, 0x0c, 0x40, 0xff, 0xaa, 0x0d, 0xb9, 0x3b, 0x2c, 0xb4, 0x7c, 0xd2, 0xee, 0xae, 0x07, - 0xd2, 0x8b, 0xf7, 0x68, 0xfb, 0xe6, 0x3f, 0x4c, 0x6a, 0xe5, 0x69, 0xe0, 0x85, 0xa3, 0x98, 0xbf, - 0xdb, 0xff, 0x58, 0x60, 0x4a, 0x09, 0xb5, 0xf9, 0xcf, 0x38, 0xff, 0x0e, 0x88, 0x77, 0x70, 0x6e, - 0x6a, 0x87, 0x25, 0xfe, 0xd1, 0x77, 0x86, 0x6e, 0x75, 0xda, 0x2c, 0xe5, 0x39, 0xc7, 0xf9, 0x8f, - 0xb7, 0xc9, 0x32, 0xfa, 0x1d, 0x37, 0x95, 0x7c, 0xca, 0x8a, 0xcd, 0x24, 0x5e, 0xf5, 0xc9, 0xee, - 0x33, 0x24, 0x29, 0xba, 0x67, 0xec, 0xc8, 0x2d, 0xd2, 0xec, 0x0b, 0x4c, 0xb7, 0xad, 0xb2, 0x75, - 0xab, 0x36, 0x8d, 0xbb, 0xb7, 0x8e, 0x74, 0x52, 0x72, 0xb1, 0x4e, 0x62, 0xdf, 0x34, 0xee, 0x2b, - 0x03, 0x36, 0x23, 0xea, 0xd7, 0x83, 0x6e, 0xad, 0x89, 0xba, 0xf5, 0xf5, 0xd5, 0xb7, 0xf7, 0x4b, - 0x74, 0x79, 0x93, 0xb6, 0xdd, 0x9b, 0x6f, 0xba, 0xd8, 0xff, 0x5e, 0xa9, 0x02, 0xe7, 0x54, 0xab, - 0x79, 0xdf, 0xcb, 0x74, 0xcc, 0xcd, 0xfe, 0xf8, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x40, 0x39, 0x20, - 0x0a, 0x23, 0x03, 0x00, 0x00, + // 467 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xc1, 0x6f, 0xd3, 0x30, + 0x14, 0xc6, 0x95, 0xad, 0xed, 0xda, 0xd7, 0xb1, 0x0d, 0x03, 0xc3, 0x9a, 0x00, 0x85, 0x1e, 0x50, + 0x04, 0x5a, 0x2a, 0xc1, 0x99, 0xcb, 0x36, 0x4d, 0x42, 0x5c, 0xaa, 0x70, 0xe3, 0x32, 0x25, 0xce, + 0xa3, 0x31, 0x24, 0x71, 0xfa, 0xec, 0x6c, 0xc0, 0xdf, 0xcd, 0x1f, 0x80, 0xf2, 0xdc, 0xb4, 0x55, + 0x11, 0xa7, 0xf8, 0xfd, 0xde, 0xe7, 0xcf, 0x5f, 0xec, 0x07, 0xe7, 0xca, 0x54, 0x55, 0x5a, 0xe7, + 0x76, 0xae, 0x4c, 0xd5, 0xe8, 0x12, 0xe3, 0x86, 0x8c, 0x33, 0xe2, 0xb9, 0x52, 0x71, 0x4a, 0x79, + 0xab, 0x6b, 0x13, 0xab, 0x52, 0xc7, 0xbd, 0xec, 0xe2, 0xd9, 0xee, 0x86, 0xca, 0xd4, 0x5e, 0x3f, + 0xfb, 0x33, 0x00, 0xb8, 0xf6, 0x0e, 0x09, 0xae, 0xc4, 0x47, 0x18, 0xeb, 0xda, 0xba, 0xb4, 0x56, + 0x28, 0x83, 0x30, 0x88, 0xa6, 0xef, 0x5f, 0xc7, 0xff, 0x71, 0x8c, 0x3f, 0xad, 0x85, 0xc9, 0x66, + 0x8b, 0x10, 0x30, 0xf8, 0xb6, 0xca, 0x6a, 0x79, 0x10, 0x06, 0xd1, 0x24, 0xe1, 0xb5, 0x78, 0x05, + 0x60, 0x7f, 0xa0, 0x53, 0xc5, 0x22, 0x75, 0x85, 0x3c, 0xe4, 0xce, 0x0e, 0x11, 0x6f, 0xe0, 0xc4, + 0x16, 0xe6, 0x61, 0x41, 0xa6, 0x41, 0x72, 0x1a, 0xad, 0x1c, 0x84, 0x41, 0x34, 0x4e, 0xf6, 0x68, + 0xe7, 0xd3, 0x10, 0x36, 0x64, 0x14, 0x5a, 0x2b, 0x87, 0xac, 0xd9, 0x21, 0x9d, 0x4f, 0xd6, 0xea, + 0x32, 0xbf, 0x4e, 0x55, 0x81, 0x7c, 0xd6, 0x88, 0xcf, 0xda, 0xa3, 0xe2, 0x05, 0x4c, 0x98, 0xb0, + 0xe4, 0x88, 0x25, 0x5b, 0x20, 0x22, 0x38, 0xf5, 0xc5, 0x36, 0xce, 0x38, 0x3c, 0x8c, 0x26, 0xc9, + 0x3e, 0x16, 0x17, 0x30, 0x7e, 0x48, 0xa9, 0xd6, 0xf5, 0xd2, 0xca, 0x09, 0xdb, 0x6c, 0x6a, 0x21, + 0xe1, 0xe8, 0x1e, 0x29, 0x33, 0x16, 0x25, 0x70, 0xd0, 0xbe, 0x14, 0x4f, 0x61, 0xb8, 0x6a, 0x35, + 0x3a, 0x39, 0x65, 0xee, 0x0b, 0x71, 0x0e, 0xa3, 0x7b, 0x9d, 0x2f, 0x74, 0x2e, 0x8f, 0xd9, 0x69, + 0x5d, 0x89, 0x19, 0x00, 0xfe, 0x6c, 0x0c, 0xb9, 0x5b, 0x5d, 0xa2, 0x7c, 0xd4, 0xf5, 0xae, 0x0e, + 0x64, 0x90, 0xec, 0xd0, 0xee, 0xce, 0xbf, 0x9b, 0xcc, 0xca, 0x93, 0x30, 0x88, 0x86, 0x09, 0xaf, + 0xbb, 0x7f, 0x2c, 0x75, 0x46, 0x29, 0x75, 0xf9, 0x4f, 0x39, 0xff, 0x16, 0x88, 0xb7, 0x70, 0x66, + 0x1a, 0xa7, 0x2b, 0xfd, 0x1b, 0x6f, 0x0d, 0xdd, 0x60, 0xd6, 0x2e, 0xe5, 0x19, 0xc7, 0xf9, 0x87, + 0x77, 0xc9, 0x72, 0xfa, 0x95, 0xb4, 0xb5, 0x7c, 0xcc, 0x8a, 0x75, 0x25, 0x5e, 0xf6, 0xc9, 0xee, + 0x72, 0x4d, 0x52, 0xf8, 0x6b, 0xf4, 0xe4, 0x46, 0x93, 0x7f, 0x2c, 0xb3, 0xa4, 0xb4, 0xaa, 0x90, + 0xe4, 0x13, 0xff, 0xe8, 0x5b, 0x32, 0xfb, 0x0c, 0xd3, 0xcd, 0xd4, 0xd9, 0xa6, 0x73, 0x33, 0xad, + 0xbb, 0xb3, 0x8e, 0x30, 0xad, 0x78, 0xf0, 0x8e, 0x93, 0x89, 0x69, 0xdd, 0x17, 0x06, 0x7c, 0x18, + 0x51, 0xdf, 0x3e, 0xf0, 0x6d, 0x24, 0xf2, 0xed, 0xab, 0xcb, 0xaf, 0xef, 0x96, 0xda, 0x15, 0x6d, + 0xd6, 0xcd, 0xe6, 0x7c, 0x3d, 0xab, 0xfd, 0xf7, 0x52, 0x95, 0x7a, 0x4e, 0x8d, 0x9a, 0xf7, 0x73, + 0x9b, 0x8d, 0x78, 0xf2, 0x3f, 0xfc, 0x0d, 0x00, 0x00, 0xff, 0xff, 0x91, 0xad, 0xf5, 0x19, 0x43, + 0x03, 0x00, 0x00, } diff --git a/rpc/commands/compile.proto b/rpc/commands/compile.proto index 050c1d8bb9a..51f833701ca 100644 --- a/rpc/commands/compile.proto +++ b/rpc/commands/compile.proto @@ -40,6 +40,7 @@ message CompileReq { bool optimizeForDebug = 16; // Optimize compile output for debug, not for release. bool dryRun = 17; // When set to `true` the compiled binary will not be copied to the export directory. string export_dir = 18; // Optional: save the build artifacts in this directory, the directory must exist. + string programmer = 19; // External programmer for upload } message CompileResp { diff --git a/rpc/commands/lib.pb.go b/rpc/commands/lib.pb.go index 93eb441985b..48db6daf724 100644 --- a/rpc/commands/lib.pb.go +++ b/rpc/commands/lib.pb.go @@ -23,7 +23,9 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package type LibrarySearchStatus int32 const ( - LibrarySearchStatus_failed LibrarySearchStatus = 0 + // No search results were found. + LibrarySearchStatus_failed LibrarySearchStatus = 0 + // Search results were found. LibrarySearchStatus_success LibrarySearchStatus = 1 ) @@ -48,7 +50,9 @@ func (LibrarySearchStatus) EnumDescriptor() ([]byte, []int) { type LibraryLayout int32 const ( - LibraryLayout_flat_layout LibraryLayout = 0 + // Library is in the 1.0 Arduino library format. + LibraryLayout_flat_layout LibraryLayout = 0 + // Library is in the 1.5 Arduino library format. LibraryLayout_recursive_layout LibraryLayout = 1 ) @@ -73,9 +77,15 @@ func (LibraryLayout) EnumDescriptor() ([]byte, []int) { type LibraryLocation int32 const ( - LibraryLocation_ide_builtin LibraryLocation = 0 - LibraryLocation_user LibraryLocation = 1 - LibraryLocation_platform_builtin LibraryLocation = 2 + // In the `libraries` subdirectory of the Arduino IDE installation. + LibraryLocation_ide_builtin LibraryLocation = 0 + // In the `libraries` subdirectory of the user directory (sketchbook). + LibraryLocation_user LibraryLocation = 1 + // In the `libraries` subdirectory of a platform. + LibraryLocation_platform_builtin LibraryLocation = 2 + // When `LibraryLocation` is used in a context where a board is specified, + // this indicates the library is in the `libraries` subdirectory of a + // platform referenced by the board's platform. LibraryLocation_referenced_platform_builtin LibraryLocation = 3 ) @@ -102,12 +112,15 @@ func (LibraryLocation) EnumDescriptor() ([]byte, []int) { } type LibraryDownloadReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Name of the library. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The version of the library to download. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryDownloadReq) Reset() { *m = LibraryDownloadReq{} } @@ -157,6 +170,7 @@ func (m *LibraryDownloadReq) GetVersion() string { } type LibraryDownloadResp struct { + // Progress of the library download. Progress *DownloadProgress `protobuf:"bytes,1,opt,name=progress,proto3" json:"progress,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -196,12 +210,15 @@ func (m *LibraryDownloadResp) GetProgress() *DownloadProgress { } type LibraryInstallReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Name of the library. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The version of the library to install. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryInstallReq) Reset() { *m = LibraryInstallReq{} } @@ -251,11 +268,13 @@ func (m *LibraryInstallReq) GetVersion() string { } type LibraryInstallResp struct { - Progress *DownloadProgress `protobuf:"bytes,1,opt,name=progress,proto3" json:"progress,omitempty"` - TaskProgress *TaskProgress `protobuf:"bytes,2,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Progress of the library download. + Progress *DownloadProgress `protobuf:"bytes,1,opt,name=progress,proto3" json:"progress,omitempty"` + // Description of the current stage of the installation. + TaskProgress *TaskProgress `protobuf:"bytes,2,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryInstallResp) Reset() { *m = LibraryInstallResp{} } @@ -298,12 +317,15 @@ func (m *LibraryInstallResp) GetTaskProgress() *TaskProgress { } type LibraryUninstallReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Name of the library. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The version of the library to uninstall. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryUninstallReq) Reset() { *m = LibraryUninstallReq{} } @@ -353,6 +375,7 @@ func (m *LibraryUninstallReq) GetVersion() string { } type LibraryUninstallResp struct { + // Description of the current stage of the uninstallation. TaskProgress *TaskProgress `protobuf:"bytes,1,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -392,6 +415,7 @@ func (m *LibraryUninstallResp) GetTaskProgress() *TaskProgress { } type LibraryUpgradeAllReq struct { + // Arduino Core Service instance from the `Init` response. Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -431,11 +455,13 @@ func (m *LibraryUpgradeAllReq) GetInstance() *Instance { } type LibraryUpgradeAllResp struct { - Progress *DownloadProgress `protobuf:"bytes,1,opt,name=progress,proto3" json:"progress,omitempty"` - TaskProgress *TaskProgress `protobuf:"bytes,2,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Progress of the downloads of files needed for the upgrades. + Progress *DownloadProgress `protobuf:"bytes,1,opt,name=progress,proto3" json:"progress,omitempty"` + // Description of the current stage of the upgrade. + TaskProgress *TaskProgress `protobuf:"bytes,2,opt,name=task_progress,json=taskProgress,proto3" json:"task_progress,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryUpgradeAllResp) Reset() { *m = LibraryUpgradeAllResp{} } @@ -478,12 +504,16 @@ func (m *LibraryUpgradeAllResp) GetTaskProgress() *TaskProgress { } type LibraryResolveDependenciesReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Name of the library. + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // The version of the library to check dependencies of. If no version is + // specified, dependencies of the newest version will be listed. + Version string `protobuf:"bytes,3,opt,name=version,proto3" json:"version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryResolveDependenciesReq) Reset() { *m = LibraryResolveDependenciesReq{} } @@ -533,6 +563,7 @@ func (m *LibraryResolveDependenciesReq) GetVersion() string { } type LibraryResolveDependenciesResp struct { + // Dependencies of the library. Dependencies []*LibraryDependencyStatus `protobuf:"bytes,1,rep,name=dependencies,proto3" json:"dependencies,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -572,8 +603,11 @@ func (m *LibraryResolveDependenciesResp) GetDependencies() []*LibraryDependencyS } type LibraryDependencyStatus struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - VersionRequired string `protobuf:"bytes,2,opt,name=versionRequired,proto3" json:"versionRequired,omitempty"` + // The name of the library dependency. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The required version of the library dependency. + VersionRequired string `protobuf:"bytes,2,opt,name=versionRequired,proto3" json:"versionRequired,omitempty"` + // Version of the library dependency currently installed. VersionInstalled string `protobuf:"bytes,3,opt,name=versionInstalled,proto3" json:"versionInstalled,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -627,11 +661,13 @@ func (m *LibraryDependencyStatus) GetVersionInstalled() string { } type LibrarySearchReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // The search query. + Query string `protobuf:"bytes,2,opt,name=query,proto3" json:"query,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibrarySearchReq) Reset() { *m = LibrarySearchReq{} } @@ -674,7 +710,9 @@ func (m *LibrarySearchReq) GetQuery() string { } type LibrarySearchResp struct { - Libraries []*SearchedLibrary `protobuf:"bytes,1,rep,name=libraries,proto3" json:"libraries,omitempty"` + // The results of the search. + Libraries []*SearchedLibrary `protobuf:"bytes,1,rep,name=libraries,proto3" json:"libraries,omitempty"` + // Whether the search yielded results. Status LibrarySearchStatus `protobuf:"varint,2,opt,name=status,proto3,enum=cc.arduino.cli.commands.LibrarySearchStatus" json:"status,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -721,12 +759,16 @@ func (m *LibrarySearchResp) GetStatus() LibrarySearchStatus { } type SearchedLibrary struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Releases map[string]*LibraryRelease `protobuf:"bytes,2,rep,name=releases,proto3" json:"releases,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Latest *LibraryRelease `protobuf:"bytes,3,opt,name=latest,proto3" json:"latest,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Library name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // The index data for the available versions of the library. The key of the + // map is the library version. + Releases map[string]*LibraryRelease `protobuf:"bytes,2,rep,name=releases,proto3" json:"releases,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The index data for the latest version of the library. + Latest *LibraryRelease `protobuf:"bytes,3,opt,name=latest,proto3" json:"latest,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *SearchedLibrary) Reset() { *m = SearchedLibrary{} } @@ -776,18 +818,34 @@ func (m *SearchedLibrary) GetLatest() *LibraryRelease { } type LibraryRelease struct { - Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` - Maintainer string `protobuf:"bytes,3,opt,name=maintainer,proto3" json:"maintainer,omitempty"` - Sentence string `protobuf:"bytes,4,opt,name=sentence,proto3" json:"sentence,omitempty"` - Paragraph string `protobuf:"bytes,5,opt,name=paragraph,proto3" json:"paragraph,omitempty"` - Website string `protobuf:"bytes,6,opt,name=website,proto3" json:"website,omitempty"` - Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` - Architectures []string `protobuf:"bytes,8,rep,name=architectures,proto3" json:"architectures,omitempty"` - Types []string `protobuf:"bytes,9,rep,name=types,proto3" json:"types,omitempty"` - Resources *DownloadResource `protobuf:"bytes,10,opt,name=resources,proto3" json:"resources,omitempty"` - License string `protobuf:"bytes,11,opt,name=license,proto3" json:"license,omitempty"` - ProvidesIncludes []string `protobuf:"bytes,12,rep,name=provides_includes,json=providesIncludes,proto3" json:"provides_includes,omitempty"` + // Value of the `author` field in library.properties. + Author string `protobuf:"bytes,1,opt,name=author,proto3" json:"author,omitempty"` + // Value of the `version` field in library.properties. + Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` + // Value of the `maintainer` field in library.properties. + Maintainer string `protobuf:"bytes,3,opt,name=maintainer,proto3" json:"maintainer,omitempty"` + // Value of the `sentence` field in library.properties. + Sentence string `protobuf:"bytes,4,opt,name=sentence,proto3" json:"sentence,omitempty"` + // Value of the `paragraph` field in library.properties. + Paragraph string `protobuf:"bytes,5,opt,name=paragraph,proto3" json:"paragraph,omitempty"` + // Value of the `url` field in library.properties. + Website string `protobuf:"bytes,6,opt,name=website,proto3" json:"website,omitempty"` + // Value of the `category` field in library.properties. + Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` + // Value of the `architectures` field in library.properties. + Architectures []string `protobuf:"bytes,8,rep,name=architectures,proto3" json:"architectures,omitempty"` + // The type categories of the library, as defined in the libraries index. + // Possible values: `Arduino`, `Partner`, `Recommended`, `Contributed`, + // `Retired`. + Types []string `protobuf:"bytes,9,rep,name=types,proto3" json:"types,omitempty"` + // Information about the library archive file. + Resources *DownloadResource `protobuf:"bytes,10,opt,name=resources,proto3" json:"resources,omitempty"` + // Value of the `license` field in library.properties. + License string `protobuf:"bytes,11,opt,name=license,proto3" json:"license,omitempty"` + // Value of the `includes` field in library.properties. + ProvidesIncludes []string `protobuf:"bytes,12,rep,name=provides_includes,json=providesIncludes,proto3" json:"provides_includes,omitempty"` + // The names of the library's dependencies, as defined by the 'depends' + // field of library.properties. Dependencies []*LibraryDependency `protobuf:"bytes,13,rep,name=dependencies,proto3" json:"dependencies,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -911,7 +969,9 @@ func (m *LibraryRelease) GetDependencies() []*LibraryDependency { } type LibraryDependency struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Library name of the dependency. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Version constraint of the dependency. VersionConstraint string `protobuf:"bytes,2,opt,name=version_constraint,json=versionConstraint,proto3" json:"version_constraint,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -958,10 +1018,16 @@ func (m *LibraryDependency) GetVersionConstraint() string { } type DownloadResource struct { - Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` - Archivefilename string `protobuf:"bytes,2,opt,name=archivefilename,proto3" json:"archivefilename,omitempty"` - Checksum string `protobuf:"bytes,3,opt,name=checksum,proto3" json:"checksum,omitempty"` - Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + // Download URL of the library archive. + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"` + // Filename of the library archive. + Archivefilename string `protobuf:"bytes,2,opt,name=archivefilename,proto3" json:"archivefilename,omitempty"` + // Checksum of the library archive. + Checksum string `protobuf:"bytes,3,opt,name=checksum,proto3" json:"checksum,omitempty"` + // File size of the library archive. + Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"` + // The directory under the staging subdirectory of the data directory the + // library archive file will be downloaded to. Cachepath string `protobuf:"bytes,5,opt,name=cachepath,proto3" json:"cachepath,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1029,12 +1095,17 @@ func (m *DownloadResource) GetCachepath() string { } type LibraryListReq struct { - Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` - All bool `protobuf:"varint,2,opt,name=all,proto3" json:"all,omitempty"` - Updatable bool `protobuf:"varint,3,opt,name=updatable,proto3" json:"updatable,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Whether to include built-in libraries (from platforms and the Arduino + // IDE) in the listing. + All bool `protobuf:"varint,2,opt,name=all,proto3" json:"all,omitempty"` + // Whether to list only libraries for which there is a newer version than + // the installed version available in the libraries index. + Updatable bool `protobuf:"varint,3,opt,name=updatable,proto3" json:"updatable,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *LibraryListReq) Reset() { *m = LibraryListReq{} } @@ -1084,6 +1155,7 @@ func (m *LibraryListReq) GetUpdatable() bool { } type LibraryListResp struct { + // List of installed libraries. InstalledLibrary []*InstalledLibrary `protobuf:"bytes,1,rep,name=installed_library,json=installedLibrary,proto3" json:"installed_library,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1123,7 +1195,11 @@ func (m *LibraryListResp) GetInstalledLibrary() []*InstalledLibrary { } type InstalledLibrary struct { - Library *Library `protobuf:"bytes,1,opt,name=library,proto3" json:"library,omitempty"` + // Information about the library. + Library *Library `protobuf:"bytes,1,opt,name=library,proto3" json:"library,omitempty"` + // When the `updatable` field of the `LibraryList` request is set to `true`, + // this will contain information on the latest version of the library in the + // libraries index. Release *LibraryRelease `protobuf:"bytes,2,opt,name=release,proto3" json:"release,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -1170,32 +1246,59 @@ func (m *InstalledLibrary) GetRelease() *LibraryRelease { } type Library struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` - Maintainer string `protobuf:"bytes,3,opt,name=maintainer,proto3" json:"maintainer,omitempty"` - Sentence string `protobuf:"bytes,4,opt,name=sentence,proto3" json:"sentence,omitempty"` - Paragraph string `protobuf:"bytes,5,opt,name=paragraph,proto3" json:"paragraph,omitempty"` - Website string `protobuf:"bytes,6,opt,name=website,proto3" json:"website,omitempty"` - Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` - Architectures []string `protobuf:"bytes,8,rep,name=architectures,proto3" json:"architectures,omitempty"` - Types []string `protobuf:"bytes,9,rep,name=types,proto3" json:"types,omitempty"` - InstallDir string `protobuf:"bytes,10,opt,name=install_dir,json=installDir,proto3" json:"install_dir,omitempty"` - SourceDir string `protobuf:"bytes,11,opt,name=source_dir,json=sourceDir,proto3" json:"source_dir,omitempty"` - UtilityDir string `protobuf:"bytes,12,opt,name=utility_dir,json=utilityDir,proto3" json:"utility_dir,omitempty"` - ContainerPlatform string `protobuf:"bytes,14,opt,name=container_platform,json=containerPlatform,proto3" json:"container_platform,omitempty"` - RealName string `protobuf:"bytes,16,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` - DotALinkage bool `protobuf:"varint,17,opt,name=dot_a_linkage,json=dotALinkage,proto3" json:"dot_a_linkage,omitempty"` - Precompiled bool `protobuf:"varint,18,opt,name=precompiled,proto3" json:"precompiled,omitempty"` - LdFlags string `protobuf:"bytes,19,opt,name=ld_flags,json=ldFlags,proto3" json:"ld_flags,omitempty"` - IsLegacy bool `protobuf:"varint,20,opt,name=is_legacy,json=isLegacy,proto3" json:"is_legacy,omitempty"` - Version string `protobuf:"bytes,21,opt,name=version,proto3" json:"version,omitempty"` - License string `protobuf:"bytes,22,opt,name=license,proto3" json:"license,omitempty"` - Properties map[string]string `protobuf:"bytes,23,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - Location LibraryLocation `protobuf:"varint,24,opt,name=location,proto3,enum=cc.arduino.cli.commands.LibraryLocation" json:"location,omitempty"` - Layout LibraryLayout `protobuf:"varint,25,opt,name=layout,proto3,enum=cc.arduino.cli.commands.LibraryLayout" json:"layout,omitempty"` - XXX_NoUnkeyedLiteral struct{} `json:"-"` - XXX_unrecognized []byte `json:"-"` - XXX_sizecache int32 `json:"-"` + // The library's directory name. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Value of the `author` field in library.properties. + Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"` + // Value of the `maintainer` field in library.properties. + Maintainer string `protobuf:"bytes,3,opt,name=maintainer,proto3" json:"maintainer,omitempty"` + // Value of the `sentence` field in library.properties. + Sentence string `protobuf:"bytes,4,opt,name=sentence,proto3" json:"sentence,omitempty"` + // Value of the `paragraph` field in library.properties. + Paragraph string `protobuf:"bytes,5,opt,name=paragraph,proto3" json:"paragraph,omitempty"` + // Value of the `url` field in library.properties. + Website string `protobuf:"bytes,6,opt,name=website,proto3" json:"website,omitempty"` + // Value of the `category` field in library.properties. + Category string `protobuf:"bytes,7,opt,name=category,proto3" json:"category,omitempty"` + // Value of the `architectures` field in library.properties. + Architectures []string `protobuf:"bytes,8,rep,name=architectures,proto3" json:"architectures,omitempty"` + // The type categories of the library. Possible values: `Arduino`, + // `Partner`, `Recommended`, `Contributed`, `Retired`. + Types []string `protobuf:"bytes,9,rep,name=types,proto3" json:"types,omitempty"` + // The path of the library directory. + InstallDir string `protobuf:"bytes,10,opt,name=install_dir,json=installDir,proto3" json:"install_dir,omitempty"` + // The location of the library's source files. + SourceDir string `protobuf:"bytes,11,opt,name=source_dir,json=sourceDir,proto3" json:"source_dir,omitempty"` + // The location of the library's `utility` directory. + UtilityDir string `protobuf:"bytes,12,opt,name=utility_dir,json=utilityDir,proto3" json:"utility_dir,omitempty"` + // If `location` is `platform_builtin` or `referenced_platform_builtin`, the + // identifying string for the platform containing the library + // (e.g., `arduino:avr@1.8.2`). + ContainerPlatform string `protobuf:"bytes,14,opt,name=container_platform,json=containerPlatform,proto3" json:"container_platform,omitempty"` + // Value of the `name` field in library.properties. + RealName string `protobuf:"bytes,16,opt,name=real_name,json=realName,proto3" json:"real_name,omitempty"` + // Value of the `dot_a_linkage` field in library.properties. + DotALinkage bool `protobuf:"varint,17,opt,name=dot_a_linkage,json=dotALinkage,proto3" json:"dot_a_linkage,omitempty"` + // Value of the `precompiled` field in library.properties. + Precompiled bool `protobuf:"varint,18,opt,name=precompiled,proto3" json:"precompiled,omitempty"` + // Value of the `ldflags` field in library.properties. + LdFlags string `protobuf:"bytes,19,opt,name=ld_flags,json=ldFlags,proto3" json:"ld_flags,omitempty"` + // A library.properties file is not present in the library's root directory. + IsLegacy bool `protobuf:"varint,20,opt,name=is_legacy,json=isLegacy,proto3" json:"is_legacy,omitempty"` + // Value of the `version` field in library.properties. + Version string `protobuf:"bytes,21,opt,name=version,proto3" json:"version,omitempty"` + // Value of the `license` field in library.properties. + License string `protobuf:"bytes,22,opt,name=license,proto3" json:"license,omitempty"` + // The data from the library's library.properties file, including unused + // fields. + Properties map[string]string `protobuf:"bytes,23,rep,name=properties,proto3" json:"properties,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The location type of the library installation. + Location LibraryLocation `protobuf:"varint,24,opt,name=location,proto3,enum=cc.arduino.cli.commands.LibraryLocation" json:"location,omitempty"` + // The library format type. + Layout LibraryLayout `protobuf:"varint,25,opt,name=layout,proto3,enum=cc.arduino.cli.commands.LibraryLayout" json:"layout,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } func (m *Library) Reset() { *m = Library{} } diff --git a/rpc/commands/lib.proto b/rpc/commands/lib.proto index e5d7d9534ce..8601a73184b 100644 --- a/rpc/commands/lib.proto +++ b/rpc/commands/lib.proto @@ -22,160 +22,263 @@ option go_package = "github.com/arduino/arduino-cli/rpc/commands"; import "commands/common.proto"; message LibraryDownloadReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // Name of the library. string name = 2; + // The version of the library to download. string version = 3; } message LibraryDownloadResp { + // Progress of the library download. DownloadProgress progress = 1; } message LibraryInstallReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // Name of the library. string name = 2; + // The version of the library to install. string version = 3; } message LibraryInstallResp { + // Progress of the library download. DownloadProgress progress = 1; + // Description of the current stage of the installation. TaskProgress task_progress = 2; } message LibraryUninstallReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // Name of the library. string name = 2; + // The version of the library to uninstall. string version = 3; } message LibraryUninstallResp { + // Description of the current stage of the uninstallation. TaskProgress task_progress = 1; } message LibraryUpgradeAllReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; } message LibraryUpgradeAllResp { + // Progress of the downloads of files needed for the upgrades. DownloadProgress progress = 1; + // Description of the current stage of the upgrade. TaskProgress task_progress = 2; } message LibraryResolveDependenciesReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // Name of the library. string name = 2; + // The version of the library to check dependencies of. If no version is + // specified, dependencies of the newest version will be listed. string version = 3; } message LibraryResolveDependenciesResp { + // Dependencies of the library. repeated LibraryDependencyStatus dependencies = 1; } message LibraryDependencyStatus { + // The name of the library dependency. string name = 1; + // The required version of the library dependency. string versionRequired = 2; + // Version of the library dependency currently installed. string versionInstalled = 3; } message LibrarySearchReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // The search query. string query = 2; } enum LibrarySearchStatus { + // No search results were found. failed = 0; + // Search results were found. success = 1; } message LibrarySearchResp { + // The results of the search. repeated SearchedLibrary libraries = 1; + // Whether the search yielded results. LibrarySearchStatus status = 2; } message SearchedLibrary { + // Library name. string name = 1; + // The index data for the available versions of the library. The key of the + // map is the library version. map releases = 2; + // The index data for the latest version of the library. LibraryRelease latest = 3; } message LibraryRelease { + // Value of the `author` field in library.properties. string author = 1; + // Value of the `version` field in library.properties. string version = 2; + // Value of the `maintainer` field in library.properties. string maintainer = 3; + // Value of the `sentence` field in library.properties. string sentence = 4; + // Value of the `paragraph` field in library.properties. string paragraph = 5; + // Value of the `url` field in library.properties. string website = 6; + // Value of the `category` field in library.properties. string category = 7; + // Value of the `architectures` field in library.properties. repeated string architectures = 8; + // The type categories of the library, as defined in the libraries index. + // Possible values: `Arduino`, `Partner`, `Recommended`, `Contributed`, + // `Retired`. repeated string types = 9; + // Information about the library archive file. DownloadResource resources = 10; + // Value of the `license` field in library.properties. string license = 11; + // Value of the `includes` field in library.properties. repeated string provides_includes = 12; + // The names of the library's dependencies, as defined by the 'depends' + // field of library.properties. repeated LibraryDependency dependencies = 13; } message LibraryDependency { + // Library name of the dependency. string name = 1; + // Version constraint of the dependency. string version_constraint = 2; } message DownloadResource { + // Download URL of the library archive. string url = 1; + // Filename of the library archive. string archivefilename = 2; + // Checksum of the library archive. string checksum = 3; + // File size of the library archive. int64 size = 4; + // The directory under the staging subdirectory of the data directory the + // library archive file will be downloaded to. string cachepath = 5; } message LibraryListReq { + // Arduino Core Service instance from the `Init` response. Instance instance = 1; + // Whether to include built-in libraries (from platforms and the Arduino + // IDE) in the listing. bool all = 2; + // Whether to list only libraries for which there is a newer version than + // the installed version available in the libraries index. bool updatable = 3; } message LibraryListResp { + // List of installed libraries. repeated InstalledLibrary installed_library = 1; } message InstalledLibrary { + // Information about the library. Library library = 1; + // When the `updatable` field of the `LibraryList` request is set to `true`, + // this will contain information on the latest version of the library in the + // libraries index. LibraryRelease release = 2; } message Library { + // The library's directory name. string name = 1; + // Value of the `author` field in library.properties. string author = 2; + // Value of the `maintainer` field in library.properties. string maintainer = 3; + // Value of the `sentence` field in library.properties. string sentence = 4; + // Value of the `paragraph` field in library.properties. string paragraph = 5; + // Value of the `url` field in library.properties. string website = 6; + // Value of the `category` field in library.properties. string category = 7; + // Value of the `architectures` field in library.properties. repeated string architectures = 8; + // The type categories of the library. Possible values: `Arduino`, + // `Partner`, `Recommended`, `Contributed`, `Retired`. repeated string types = 9; + // The path of the library directory. string install_dir = 10; + // The location of the library's source files. string source_dir = 11; + // The location of the library's `utility` directory. string utility_dir = 12; + // If `location` is `platform_builtin` or `referenced_platform_builtin`, the + // identifying string for the platform containing the library + // (e.g., `arduino:avr@1.8.2`). string container_platform = 14; + // Value of the `name` field in library.properties. string real_name = 16; + // Value of the `dot_a_linkage` field in library.properties. bool dot_a_linkage = 17; + // Value of the `precompiled` field in library.properties. bool precompiled = 18; + // Value of the `ldflags` field in library.properties. string ld_flags = 19; + // A library.properties file is not present in the library's root directory. bool is_legacy = 20; + // Value of the `version` field in library.properties. string version = 21; + // Value of the `license` field in library.properties. string license = 22; + // The data from the library's library.properties file, including unused + // fields. map properties = 23; + // The location type of the library installation. LibraryLocation location = 24; + // The library format type. LibraryLayout layout = 25; } enum LibraryLayout { + // Library is in the 1.0 Arduino library format. flat_layout = 0; + // Library is in the 1.5 Arduino library format. recursive_layout = 1; } enum LibraryLocation { + // In the `libraries` subdirectory of the Arduino IDE installation. ide_builtin = 0; - user = 1; // (sketchbook) + // In the `libraries` subdirectory of the user directory (sketchbook). + user = 1; + // In the `libraries` subdirectory of a platform. platform_builtin = 2; + // When `LibraryLocation` is used in a context where a board is specified, + // this indicates the library is in the `libraries` subdirectory of a + // platform referenced by the board's platform. referenced_platform_builtin = 3; } diff --git a/rpc/commands/upload.pb.go b/rpc/commands/upload.pb.go index a7606d4695b..bc150f1e057 100644 --- a/rpc/commands/upload.pb.go +++ b/rpc/commands/upload.pb.go @@ -42,6 +42,7 @@ type UploadReq struct { // Custom path to a directory containing compiled files. When `import_dir` is // not specified, the standard build directory under `sketch_path` is used. ImportDir string `protobuf:"bytes,8,opt,name=import_dir,json=importDir,proto3" json:"import_dir,omitempty"` + Programmer string `protobuf:"bytes,9,opt,name=programmer,proto3" json:"programmer,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -129,6 +130,13 @@ func (m *UploadReq) GetImportDir() string { return "" } +func (m *UploadReq) GetProgrammer() string { + if m != nil { + return m.Programmer + } + return "" +} + type UploadResp struct { // The output of the upload process. OutStream []byte `protobuf:"bytes,1,opt,name=out_stream,json=outStream,proto3" json:"out_stream,omitempty"` @@ -178,33 +186,323 @@ func (m *UploadResp) GetErrStream() []byte { return nil } +type BurnBootloaderReq struct { + // Arduino Core Service instance from the `Init` response. + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + // Fully qualified board name of the target board (e.g., `arduino:avr:uno`). + Fqbn string `protobuf:"bytes,2,opt,name=fqbn,proto3" json:"fqbn,omitempty"` + // The port of the programmer used to program the bootloader. + Port string `protobuf:"bytes,3,opt,name=port,proto3" json:"port,omitempty"` + // Whether to turn on verbose output during the programming. + Verbose bool `protobuf:"varint,4,opt,name=verbose,proto3" json:"verbose,omitempty"` + // After programming, verify the contents of the memory on the board match the + // uploaded binary. + Verify bool `protobuf:"varint,5,opt,name=verify,proto3" json:"verify,omitempty"` + // The programmer to use for burning bootloader. + Programmer string `protobuf:"bytes,6,opt,name=programmer,proto3" json:"programmer,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BurnBootloaderReq) Reset() { *m = BurnBootloaderReq{} } +func (m *BurnBootloaderReq) String() string { return proto.CompactTextString(m) } +func (*BurnBootloaderReq) ProtoMessage() {} +func (*BurnBootloaderReq) Descriptor() ([]byte, []int) { + return fileDescriptor_cd642cc079f8acdb, []int{2} +} + +func (m *BurnBootloaderReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BurnBootloaderReq.Unmarshal(m, b) +} +func (m *BurnBootloaderReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BurnBootloaderReq.Marshal(b, m, deterministic) +} +func (m *BurnBootloaderReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_BurnBootloaderReq.Merge(m, src) +} +func (m *BurnBootloaderReq) XXX_Size() int { + return xxx_messageInfo_BurnBootloaderReq.Size(m) +} +func (m *BurnBootloaderReq) XXX_DiscardUnknown() { + xxx_messageInfo_BurnBootloaderReq.DiscardUnknown(m) +} + +var xxx_messageInfo_BurnBootloaderReq proto.InternalMessageInfo + +func (m *BurnBootloaderReq) GetInstance() *Instance { + if m != nil { + return m.Instance + } + return nil +} + +func (m *BurnBootloaderReq) GetFqbn() string { + if m != nil { + return m.Fqbn + } + return "" +} + +func (m *BurnBootloaderReq) GetPort() string { + if m != nil { + return m.Port + } + return "" +} + +func (m *BurnBootloaderReq) GetVerbose() bool { + if m != nil { + return m.Verbose + } + return false +} + +func (m *BurnBootloaderReq) GetVerify() bool { + if m != nil { + return m.Verify + } + return false +} + +func (m *BurnBootloaderReq) GetProgrammer() string { + if m != nil { + return m.Programmer + } + return "" +} + +type BurnBootloaderResp struct { + // The output of the burn bootloader process. + OutStream []byte `protobuf:"bytes,1,opt,name=out_stream,json=outStream,proto3" json:"out_stream,omitempty"` + // The error output of the burn bootloader process. + ErrStream []byte `protobuf:"bytes,2,opt,name=err_stream,json=errStream,proto3" json:"err_stream,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BurnBootloaderResp) Reset() { *m = BurnBootloaderResp{} } +func (m *BurnBootloaderResp) String() string { return proto.CompactTextString(m) } +func (*BurnBootloaderResp) ProtoMessage() {} +func (*BurnBootloaderResp) Descriptor() ([]byte, []int) { + return fileDescriptor_cd642cc079f8acdb, []int{3} +} + +func (m *BurnBootloaderResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BurnBootloaderResp.Unmarshal(m, b) +} +func (m *BurnBootloaderResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BurnBootloaderResp.Marshal(b, m, deterministic) +} +func (m *BurnBootloaderResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_BurnBootloaderResp.Merge(m, src) +} +func (m *BurnBootloaderResp) XXX_Size() int { + return xxx_messageInfo_BurnBootloaderResp.Size(m) +} +func (m *BurnBootloaderResp) XXX_DiscardUnknown() { + xxx_messageInfo_BurnBootloaderResp.DiscardUnknown(m) +} + +var xxx_messageInfo_BurnBootloaderResp proto.InternalMessageInfo + +func (m *BurnBootloaderResp) GetOutStream() []byte { + if m != nil { + return m.OutStream + } + return nil +} + +func (m *BurnBootloaderResp) GetErrStream() []byte { + if m != nil { + return m.ErrStream + } + return nil +} + +type ListProgrammersAvailableForUploadReq struct { + Instance *Instance `protobuf:"bytes,1,opt,name=instance,proto3" json:"instance,omitempty"` + Fqbn string `protobuf:"bytes,2,opt,name=fqbn,proto3" json:"fqbn,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListProgrammersAvailableForUploadReq) Reset() { *m = ListProgrammersAvailableForUploadReq{} } +func (m *ListProgrammersAvailableForUploadReq) String() string { return proto.CompactTextString(m) } +func (*ListProgrammersAvailableForUploadReq) ProtoMessage() {} +func (*ListProgrammersAvailableForUploadReq) Descriptor() ([]byte, []int) { + return fileDescriptor_cd642cc079f8acdb, []int{4} +} + +func (m *ListProgrammersAvailableForUploadReq) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListProgrammersAvailableForUploadReq.Unmarshal(m, b) +} +func (m *ListProgrammersAvailableForUploadReq) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListProgrammersAvailableForUploadReq.Marshal(b, m, deterministic) +} +func (m *ListProgrammersAvailableForUploadReq) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListProgrammersAvailableForUploadReq.Merge(m, src) +} +func (m *ListProgrammersAvailableForUploadReq) XXX_Size() int { + return xxx_messageInfo_ListProgrammersAvailableForUploadReq.Size(m) +} +func (m *ListProgrammersAvailableForUploadReq) XXX_DiscardUnknown() { + xxx_messageInfo_ListProgrammersAvailableForUploadReq.DiscardUnknown(m) +} + +var xxx_messageInfo_ListProgrammersAvailableForUploadReq proto.InternalMessageInfo + +func (m *ListProgrammersAvailableForUploadReq) GetInstance() *Instance { + if m != nil { + return m.Instance + } + return nil +} + +func (m *ListProgrammersAvailableForUploadReq) GetFqbn() string { + if m != nil { + return m.Fqbn + } + return "" +} + +type ListProgrammersAvailableForUploadResp struct { + Programmers []*Programmer `protobuf:"bytes,1,rep,name=programmers,proto3" json:"programmers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListProgrammersAvailableForUploadResp) Reset() { *m = ListProgrammersAvailableForUploadResp{} } +func (m *ListProgrammersAvailableForUploadResp) String() string { return proto.CompactTextString(m) } +func (*ListProgrammersAvailableForUploadResp) ProtoMessage() {} +func (*ListProgrammersAvailableForUploadResp) Descriptor() ([]byte, []int) { + return fileDescriptor_cd642cc079f8acdb, []int{5} +} + +func (m *ListProgrammersAvailableForUploadResp) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListProgrammersAvailableForUploadResp.Unmarshal(m, b) +} +func (m *ListProgrammersAvailableForUploadResp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListProgrammersAvailableForUploadResp.Marshal(b, m, deterministic) +} +func (m *ListProgrammersAvailableForUploadResp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListProgrammersAvailableForUploadResp.Merge(m, src) +} +func (m *ListProgrammersAvailableForUploadResp) XXX_Size() int { + return xxx_messageInfo_ListProgrammersAvailableForUploadResp.Size(m) +} +func (m *ListProgrammersAvailableForUploadResp) XXX_DiscardUnknown() { + xxx_messageInfo_ListProgrammersAvailableForUploadResp.DiscardUnknown(m) +} + +var xxx_messageInfo_ListProgrammersAvailableForUploadResp proto.InternalMessageInfo + +func (m *ListProgrammersAvailableForUploadResp) GetProgrammers() []*Programmer { + if m != nil { + return m.Programmers + } + return nil +} + +type Programmer struct { + Platform string `protobuf:"bytes,1,opt,name=platform,proto3" json:"platform,omitempty"` + Id string `protobuf:"bytes,2,opt,name=id,proto3" json:"id,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Programmer) Reset() { *m = Programmer{} } +func (m *Programmer) String() string { return proto.CompactTextString(m) } +func (*Programmer) ProtoMessage() {} +func (*Programmer) Descriptor() ([]byte, []int) { + return fileDescriptor_cd642cc079f8acdb, []int{6} +} + +func (m *Programmer) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Programmer.Unmarshal(m, b) +} +func (m *Programmer) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Programmer.Marshal(b, m, deterministic) +} +func (m *Programmer) XXX_Merge(src proto.Message) { + xxx_messageInfo_Programmer.Merge(m, src) +} +func (m *Programmer) XXX_Size() int { + return xxx_messageInfo_Programmer.Size(m) +} +func (m *Programmer) XXX_DiscardUnknown() { + xxx_messageInfo_Programmer.DiscardUnknown(m) +} + +var xxx_messageInfo_Programmer proto.InternalMessageInfo + +func (m *Programmer) GetPlatform() string { + if m != nil { + return m.Platform + } + return "" +} + +func (m *Programmer) GetId() string { + if m != nil { + return m.Id + } + return "" +} + +func (m *Programmer) GetName() string { + if m != nil { + return m.Name + } + return "" +} + func init() { proto.RegisterType((*UploadReq)(nil), "cc.arduino.cli.commands.UploadReq") proto.RegisterType((*UploadResp)(nil), "cc.arduino.cli.commands.UploadResp") + proto.RegisterType((*BurnBootloaderReq)(nil), "cc.arduino.cli.commands.BurnBootloaderReq") + proto.RegisterType((*BurnBootloaderResp)(nil), "cc.arduino.cli.commands.BurnBootloaderResp") + proto.RegisterType((*ListProgrammersAvailableForUploadReq)(nil), "cc.arduino.cli.commands.ListProgrammersAvailableForUploadReq") + proto.RegisterType((*ListProgrammersAvailableForUploadResp)(nil), "cc.arduino.cli.commands.ListProgrammersAvailableForUploadResp") + proto.RegisterType((*Programmer)(nil), "cc.arduino.cli.commands.Programmer") } func init() { proto.RegisterFile("commands/upload.proto", fileDescriptor_cd642cc079f8acdb) } var fileDescriptor_cd642cc079f8acdb = []byte{ - // 312 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x91, 0x41, 0x4b, 0xfc, 0x30, - 0x10, 0xc5, 0x69, 0xff, 0xfb, 0xdf, 0xdd, 0xce, 0x7a, 0x0a, 0xa8, 0x41, 0x10, 0xd7, 0xf5, 0xb2, - 0x20, 0xdb, 0x82, 0x9e, 0xbd, 0x2c, 0x22, 0xe8, 0x49, 0x2a, 0x5e, 0xbc, 0x94, 0x34, 0xcd, 0xda, - 0x60, 0xdb, 0x74, 0x27, 0xe9, 0x82, 0x1f, 0xc1, 0x6f, 0x2d, 0x49, 0x1a, 0x3d, 0x79, 0xea, 0xcc, - 0xfb, 0xbd, 0x37, 0x85, 0x17, 0x38, 0xe6, 0xaa, 0x6d, 0x59, 0x57, 0xe9, 0x6c, 0xe8, 0x1b, 0xc5, - 0xaa, 0xb4, 0x47, 0x65, 0x14, 0x39, 0xe5, 0x3c, 0x65, 0x58, 0x0d, 0xb2, 0x53, 0x29, 0x6f, 0x64, - 0x1a, 0x5c, 0x67, 0xbf, 0x7e, 0x3b, 0xa8, 0xce, 0xfb, 0x57, 0x5f, 0x31, 0x24, 0xaf, 0xee, 0x40, - 0x2e, 0xf6, 0xe4, 0x0e, 0xe6, 0xb2, 0xd3, 0x86, 0x75, 0x5c, 0xd0, 0x68, 0x19, 0xad, 0x17, 0x37, - 0x97, 0xe9, 0x1f, 0x07, 0xd3, 0xc7, 0xd1, 0x98, 0xff, 0x44, 0x08, 0x81, 0xc9, 0x6e, 0x5f, 0x76, - 0x34, 0x5e, 0x46, 0xeb, 0x24, 0x77, 0x33, 0xb9, 0x80, 0x85, 0xfe, 0x10, 0x86, 0xd7, 0x45, 0xcf, - 0x4c, 0x4d, 0xff, 0x39, 0x04, 0x5e, 0x7a, 0x66, 0xa6, 0xb6, 0xa1, 0x5e, 0xa1, 0xa1, 0x13, 0x1f, - 0xb2, 0x33, 0xa1, 0x30, 0x3b, 0x08, 0x2c, 0x95, 0x16, 0xf4, 0xff, 0x32, 0x5a, 0xcf, 0xf3, 0xb0, - 0x92, 0x13, 0x98, 0x1e, 0x04, 0xca, 0xdd, 0x27, 0x9d, 0x3a, 0x30, 0x6e, 0xe4, 0x0a, 0x16, 0xb2, - 0xb5, 0xd9, 0x62, 0x27, 0x1b, 0x41, 0x67, 0xf6, 0xd8, 0x36, 0xa6, 0x51, 0x0e, 0x5e, 0x7e, 0x90, - 0x8d, 0x20, 0xe7, 0x30, 0x6e, 0x45, 0x25, 0x91, 0xce, 0xdd, 0x0f, 0x13, 0xaf, 0xdc, 0x4b, 0x5c, - 0x3d, 0x01, 0x84, 0x2a, 0x74, 0x6f, 0xcd, 0x6a, 0x30, 0x85, 0x36, 0x28, 0x58, 0xeb, 0xda, 0x38, - 0xca, 0x13, 0x35, 0x98, 0x17, 0x27, 0x58, 0x2c, 0x10, 0x03, 0x8e, 0x3d, 0x16, 0x88, 0x1e, 0x6f, - 0x37, 0x6f, 0xd7, 0xef, 0xd2, 0xd4, 0x43, 0x69, 0x0b, 0xcb, 0xc6, 0x02, 0xc3, 0x77, 0xc3, 0x1b, - 0x99, 0x61, 0xcf, 0xb3, 0x50, 0x66, 0x39, 0x75, 0xaf, 0x71, 0xfb, 0x1d, 0x00, 0x00, 0xff, 0xff, - 0xb9, 0xb9, 0xe0, 0xf7, 0xd6, 0x01, 0x00, 0x00, + // 463 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x51, 0x8b, 0xd3, 0x40, + 0x10, 0xc7, 0x49, 0xda, 0xeb, 0x35, 0x13, 0x11, 0x5c, 0x50, 0x97, 0x03, 0xb5, 0xe6, 0x14, 0x0a, + 0x72, 0x29, 0x9c, 0xcf, 0x3e, 0x58, 0xf4, 0x40, 0xb9, 0x87, 0x23, 0xe2, 0x8b, 0x2f, 0x65, 0x93, + 0x6c, 0xaf, 0x8b, 0xc9, 0xee, 0xde, 0xec, 0xa6, 0x70, 0x1f, 0xc9, 0xef, 0xe2, 0x87, 0x92, 0xcd, + 0x26, 0x8d, 0xa7, 0x16, 0x84, 0xa3, 0x4f, 0x9d, 0x99, 0xff, 0xcc, 0x7f, 0xa6, 0xbf, 0x84, 0xc0, + 0xe3, 0x42, 0xd5, 0x35, 0x93, 0xa5, 0x59, 0x34, 0xba, 0x52, 0xac, 0x4c, 0x35, 0x2a, 0xab, 0xc8, + 0xd3, 0xa2, 0x48, 0x19, 0x96, 0x8d, 0x90, 0x2a, 0x2d, 0x2a, 0x91, 0xf6, 0x5d, 0x27, 0x43, 0xbf, + 0x0b, 0x94, 0xf4, 0xfd, 0xc9, 0x8f, 0x10, 0xa2, 0xaf, 0xad, 0x41, 0xc6, 0x6f, 0xc8, 0x3b, 0x98, + 0x0a, 0x69, 0x2c, 0x93, 0x05, 0xa7, 0xc1, 0x2c, 0x98, 0xc7, 0xe7, 0x2f, 0xd3, 0x3d, 0x86, 0xe9, + 0xa7, 0xae, 0x31, 0xdb, 0x8d, 0x10, 0x02, 0xe3, 0xf5, 0x4d, 0x2e, 0x69, 0x38, 0x0b, 0xe6, 0x51, + 0xd6, 0xc6, 0xe4, 0x05, 0xc4, 0xe6, 0x3b, 0xb7, 0xc5, 0x66, 0xa5, 0x99, 0xdd, 0xd0, 0x51, 0x2b, + 0x81, 0x2f, 0x5d, 0x31, 0xbb, 0x71, 0x43, 0x5a, 0xa1, 0xa5, 0x63, 0x3f, 0xe4, 0x62, 0x42, 0xe1, + 0x78, 0xcb, 0x31, 0x57, 0x86, 0xd3, 0xa3, 0x59, 0x30, 0x9f, 0x66, 0x7d, 0x4a, 0x9e, 0xc0, 0x64, + 0xcb, 0x51, 0xac, 0x6f, 0xe9, 0xa4, 0x15, 0xba, 0x8c, 0x9c, 0x42, 0x2c, 0x6a, 0x37, 0xbb, 0x5a, + 0x8b, 0x8a, 0xd3, 0x63, 0x67, 0xb6, 0x0c, 0x69, 0x90, 0x81, 0x2f, 0x5f, 0x88, 0x8a, 0x93, 0x67, + 0xd0, 0x65, 0xab, 0x52, 0x20, 0x9d, 0xb6, 0x0b, 0x23, 0x5f, 0xf9, 0x20, 0x90, 0x3c, 0x07, 0xd0, + 0xa8, 0xae, 0x91, 0xd5, 0x35, 0x47, 0x1a, 0xf9, 0x4b, 0x87, 0x4a, 0xf2, 0x19, 0xa0, 0x47, 0x65, + 0xb4, 0x33, 0x53, 0x8d, 0x5d, 0x19, 0x8b, 0x9c, 0xd5, 0x2d, 0xad, 0x07, 0x59, 0xa4, 0x1a, 0xfb, + 0xa5, 0x2d, 0x38, 0x99, 0x23, 0xf6, 0x72, 0xe8, 0x65, 0x8e, 0xe8, 0xe5, 0xe4, 0x67, 0x00, 0x8f, + 0x96, 0x0d, 0xca, 0xa5, 0x52, 0xd6, 0x59, 0x72, 0x3c, 0x10, 0xff, 0x1e, 0xef, 0xe8, 0xdf, 0x78, + 0xc7, 0xfb, 0xf0, 0x1e, 0xdd, 0xc1, 0x7b, 0x17, 0xcd, 0xe4, 0x2f, 0x34, 0x19, 0x90, 0x3f, 0xff, + 0xcd, 0xbd, 0x11, 0xdd, 0xc2, 0xab, 0x4b, 0x61, 0xec, 0xd5, 0x6e, 0x8b, 0x79, 0xbf, 0x65, 0xa2, + 0x62, 0x79, 0xc5, 0x2f, 0x14, 0x1e, 0xf2, 0xa5, 0x4d, 0x24, 0xbc, 0xfe, 0x8f, 0xd5, 0x46, 0x93, + 0x8f, 0x10, 0x0f, 0x14, 0x0c, 0x0d, 0x66, 0xa3, 0x79, 0x7c, 0x7e, 0xba, 0x77, 0xfd, 0x60, 0x98, + 0xfd, 0x3e, 0x97, 0x5c, 0x02, 0x0c, 0x12, 0x39, 0x81, 0xa9, 0xae, 0x98, 0x5d, 0x2b, 0xf4, 0xd0, + 0xa2, 0x6c, 0x97, 0x93, 0x87, 0x10, 0x8a, 0xb2, 0xbb, 0x35, 0x14, 0xa5, 0xbb, 0x5e, 0xb2, 0x9a, + 0xf7, 0x8f, 0xd7, 0xc5, 0xcb, 0xb3, 0x6f, 0x6f, 0xae, 0x85, 0xdd, 0x34, 0xb9, 0x5b, 0xbc, 0xe8, + 0x0e, 0xe9, 0x7f, 0xcf, 0x8a, 0x4a, 0x2c, 0x50, 0x17, 0x8b, 0xfe, 0xa8, 0x7c, 0xd2, 0x7e, 0x09, + 0xde, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xfd, 0x43, 0xdb, 0xdc, 0x52, 0x04, 0x00, 0x00, } diff --git a/rpc/commands/upload.proto b/rpc/commands/upload.proto index 82b936eb293..2c02c361e90 100644 --- a/rpc/commands/upload.proto +++ b/rpc/commands/upload.proto @@ -43,6 +43,7 @@ message UploadReq { // Custom path to a directory containing compiled files. When `import_dir` is // not specified, the standard build directory under `sketch_path` is used. string import_dir = 8; + string programmer = 9; } message UploadResp { @@ -50,4 +51,42 @@ message UploadResp { bytes out_stream = 1; // The error output of the upload process. bytes err_stream = 2; -} \ No newline at end of file +} + +message BurnBootloaderReq { + // Arduino Core Service instance from the `Init` response. + Instance instance = 1; + // Fully qualified board name of the target board (e.g., `arduino:avr:uno`). + string fqbn = 2; + // The port of the programmer used to program the bootloader. + string port = 3; + // Whether to turn on verbose output during the programming. + bool verbose = 4; + // After programming, verify the contents of the memory on the board match the + // uploaded binary. + bool verify = 5; + // The programmer to use for burning bootloader. + string programmer = 6; +} + +message BurnBootloaderResp { + // The output of the burn bootloader process. + bytes out_stream = 1; + // The error output of the burn bootloader process. + bytes err_stream = 2; +} + +message ListProgrammersAvailableForUploadReq { + Instance instance = 1; + string fqbn = 2; +} + +message ListProgrammersAvailableForUploadResp { + repeated Programmer programmers = 1; +} + +message Programmer { + string platform = 1; + string id = 2; + string name = 3; +} diff --git a/test/test_completion.py b/test/test_completion.py new file mode 100644 index 00000000000..3f6bc303534 --- /dev/null +++ b/test/test_completion.py @@ -0,0 +1,63 @@ +# This file is part of arduino-cli. +# +# Copyright 2020 ARDUINO SA (http://www.arduino.cc/) +# +# This software is released under the GNU General Public License version 3, +# which covers the main part of arduino-cli. +# The terms of this license can be found at: +# https://www.gnu.org/licenses/gpl-3.0.en.html +# +# You can be released from the requirements of the above licenses by purchasing +# a commercial license. Buying such a license is mandatory if you want to modify or +# otherwise use the software for commercial activities involving the Arduino +# software without disclosing the source code of your own applications. To purchase +# a commercial license, send an email to license@arduino.cc. + +import pytest + +def test_completion_no_args(run_command): + result = run_command("completion") + assert not result.ok + assert "Error: accepts 1 arg(s), received 0" in result.stderr + assert result.stdout == "" + +def test_completion_bash(run_command): + result = run_command("completion bash") + assert result.ok + assert result.stderr == "" + assert "_arduino-cli_root_command()" in result.stdout + assert "__start_arduino-cli()" in result.stdout + +def test_completion_zsh(run_command): + result = run_command("completion zsh") + assert result.ok + assert result.stderr == "" + assert "#compdef _arduino-cli arduino-cli" in result.stdout + assert "function _arduino-cli" in result.stdout + +def test_completion_fish(run_command): + result = run_command("completion fish") + assert result.ok + assert result.stderr == "" + assert "# fish completion for arduino-cli" in result.stdout + assert "function __arduino-cli_perform_completion" in result.stdout + +def test_completion_bash_no_desc(run_command): + result = run_command("completion bash --no-descriptions") + assert not result.ok + assert result.stdout == "" + assert "Error: command description is not supported by bash" in result.stderr + +def test_completion_zsh_no_desc(run_command): + result = run_command("completion zsh --no-descriptions") + assert not result.ok + assert result.stdout == "" + assert "Error: command description is not supported by zsh" in result.stderr + +def test_completion_fish_no_desc(run_command): + result = run_command("completion fish --no-descriptions") + assert result.ok + assert result.stderr == "" + assert "# fish completion for arduino-cli" in result.stdout + assert "function __arduino-cli_perform_completion" in result.stdout + assert "__completeNoDesc" in result.stdout \ No newline at end of file