From 1e51cdc5b5518a5d6c9fcdfc4b307f4486e2709a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:14:05 +0200 Subject: [PATCH 1/4] [skip-changelog] Bump google.golang.org/grpc from 1.58.3 to 1.59.0 (#2375) * Bump google.golang.org/grpc from 1.58.3 to 1.59.0 Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.58.3 to 1.59.0. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.58.3...v1.59.0) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * Updated license cache --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristian Maglie --- .licenses/go/google.golang.org/grpc.dep.yml | 2 +- .licenses/go/google.golang.org/grpc/attributes.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/backoff.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/balancer.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/balancer/base.dep.yml | 4 ++-- .../go/google.golang.org/grpc/balancer/grpclb/state.dep.yml | 4 ++-- .../go/google.golang.org/grpc/balancer/roundrobin.dep.yml | 4 ++-- .../grpc/binarylog/grpc_binarylog_v1.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/channelz.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/codes.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/connectivity.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/credentials.dep.yml | 4 ++-- .../go/google.golang.org/grpc/credentials/insecure.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/encoding.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/encoding/proto.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/grpclog.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/internal.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/backoff.dep.yml | 4 ++-- .../grpc/internal/balancer/gracefulswitch.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/balancerload.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/binarylog.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/internal/buffer.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/channelz.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/credentials.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/envconfig.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/grpclog.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/grpcrand.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/grpcsync.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/grpcutil.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/internal/idle.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/metadata.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/internal/pretty.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/resolver.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/resolver/dns.dep.yml | 4 ++-- .../grpc/internal/resolver/passthrough.dep.yml | 4 ++-- .../google.golang.org/grpc/internal/resolver/unix.dep.yml | 4 ++-- .../google.golang.org/grpc/internal/serviceconfig.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/internal/status.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/syscall.dep.yml | 4 ++-- .../go/google.golang.org/grpc/internal/transport.dep.yml | 4 ++-- .../grpc/internal/transport/networktype.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/keepalive.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/metadata.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/peer.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/resolver.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/serviceconfig.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/stats.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/status.dep.yml | 4 ++-- .licenses/go/google.golang.org/grpc/tap.dep.yml | 4 ++-- go.mod | 2 +- go.sum | 4 ++-- mysketchbook/newsketch/newsketch.ino | 6 ++++++ 52 files changed, 106 insertions(+), 100 deletions(-) create mode 100644 mysketchbook/newsketch/newsketch.ino diff --git a/.licenses/go/google.golang.org/grpc.dep.yml b/.licenses/go/google.golang.org/grpc.dep.yml index 22f780ebfee..a585fa9a3a0 100644 --- a/.licenses/go/google.golang.org/grpc.dep.yml +++ b/.licenses/go/google.golang.org/grpc.dep.yml @@ -1,6 +1,6 @@ --- name: google.golang.org/grpc -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpc implements an RPC system called gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc diff --git a/.licenses/go/google.golang.org/grpc/attributes.dep.yml b/.licenses/go/google.golang.org/grpc/attributes.dep.yml index b97b56d5377..9befb12adc6 100644 --- a/.licenses/go/google.golang.org/grpc/attributes.dep.yml +++ b/.licenses/go/google.golang.org/grpc/attributes.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/attributes -version: v1.58.3 +version: v1.59.0 type: go summary: Package attributes defines a generic key/value store used in various gRPC components. homepage: https://pkg.go.dev/google.golang.org/grpc/attributes license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/backoff.dep.yml b/.licenses/go/google.golang.org/grpc/backoff.dep.yml index aa465830b74..0579efa6c6c 100644 --- a/.licenses/go/google.golang.org/grpc/backoff.dep.yml +++ b/.licenses/go/google.golang.org/grpc/backoff.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/backoff -version: v1.58.3 +version: v1.59.0 type: go summary: Package backoff provides configuration options for backoff. homepage: https://pkg.go.dev/google.golang.org/grpc/backoff license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/balancer.dep.yml b/.licenses/go/google.golang.org/grpc/balancer.dep.yml index 5823a4dee33..21aec050d2f 100644 --- a/.licenses/go/google.golang.org/grpc/balancer.dep.yml +++ b/.licenses/go/google.golang.org/grpc/balancer.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/balancer -version: v1.58.3 +version: v1.59.0 type: go summary: Package balancer defines APIs for load balancing in gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/balancer license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/balancer/base.dep.yml b/.licenses/go/google.golang.org/grpc/balancer/base.dep.yml index 2daf6d898b2..82f7d5e6dcb 100644 --- a/.licenses/go/google.golang.org/grpc/balancer/base.dep.yml +++ b/.licenses/go/google.golang.org/grpc/balancer/base.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/balancer/base -version: v1.58.3 +version: v1.59.0 type: go summary: Package base defines a balancer base that can be used to build balancers with different picking algorithms. homepage: https://pkg.go.dev/google.golang.org/grpc/balancer/base license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/balancer/grpclb/state.dep.yml b/.licenses/go/google.golang.org/grpc/balancer/grpclb/state.dep.yml index be500391820..420a6707984 100644 --- a/.licenses/go/google.golang.org/grpc/balancer/grpclb/state.dep.yml +++ b/.licenses/go/google.golang.org/grpc/balancer/grpclb/state.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/balancer/grpclb/state -version: v1.58.3 +version: v1.59.0 type: go summary: Package state declares grpclb types to be set by resolvers wishing to pass information to grpclb via resolver.State Attributes. homepage: https://pkg.go.dev/google.golang.org/grpc/balancer/grpclb/state license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/balancer/roundrobin.dep.yml b/.licenses/go/google.golang.org/grpc/balancer/roundrobin.dep.yml index 96594af6f59..3222ed332d4 100644 --- a/.licenses/go/google.golang.org/grpc/balancer/roundrobin.dep.yml +++ b/.licenses/go/google.golang.org/grpc/balancer/roundrobin.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/balancer/roundrobin -version: v1.58.3 +version: v1.59.0 type: go summary: Package roundrobin defines a roundrobin balancer. homepage: https://pkg.go.dev/google.golang.org/grpc/balancer/roundrobin license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/binarylog/grpc_binarylog_v1.dep.yml b/.licenses/go/google.golang.org/grpc/binarylog/grpc_binarylog_v1.dep.yml index 977367914bc..a9a5be3046d 100644 --- a/.licenses/go/google.golang.org/grpc/binarylog/grpc_binarylog_v1.dep.yml +++ b/.licenses/go/google.golang.org/grpc/binarylog/grpc_binarylog_v1.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/binarylog/grpc_binarylog_v1 -version: v1.58.3 +version: v1.59.0 type: go summary: homepage: https://pkg.go.dev/google.golang.org/grpc/binarylog/grpc_binarylog_v1 license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/channelz.dep.yml b/.licenses/go/google.golang.org/grpc/channelz.dep.yml index 292e5d3a2c7..823fc583aa0 100644 --- a/.licenses/go/google.golang.org/grpc/channelz.dep.yml +++ b/.licenses/go/google.golang.org/grpc/channelz.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/channelz -version: v1.58.3 +version: v1.59.0 type: go summary: Package channelz exports internals of the channelz implementation as required by other gRPC packages. homepage: https://pkg.go.dev/google.golang.org/grpc/channelz license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/codes.dep.yml b/.licenses/go/google.golang.org/grpc/codes.dep.yml index 7c955e07a56..e87033f466c 100644 --- a/.licenses/go/google.golang.org/grpc/codes.dep.yml +++ b/.licenses/go/google.golang.org/grpc/codes.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/codes -version: v1.58.3 +version: v1.59.0 type: go summary: Package codes defines the canonical error codes used by gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/codes license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/connectivity.dep.yml b/.licenses/go/google.golang.org/grpc/connectivity.dep.yml index ad8b385b33d..7efc59fcdb5 100644 --- a/.licenses/go/google.golang.org/grpc/connectivity.dep.yml +++ b/.licenses/go/google.golang.org/grpc/connectivity.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/connectivity -version: v1.58.3 +version: v1.59.0 type: go summary: Package connectivity defines connectivity semantics. homepage: https://pkg.go.dev/google.golang.org/grpc/connectivity license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/credentials.dep.yml b/.licenses/go/google.golang.org/grpc/credentials.dep.yml index 965fd8aa369..70c2e9d2a41 100644 --- a/.licenses/go/google.golang.org/grpc/credentials.dep.yml +++ b/.licenses/go/google.golang.org/grpc/credentials.dep.yml @@ -1,6 +1,6 @@ --- name: google.golang.org/grpc/credentials -version: v1.58.3 +version: v1.59.0 type: go summary: Package credentials implements various credentials supported by gRPC library, which encapsulate all the state needed by a client to authenticate with a server @@ -9,7 +9,7 @@ summary: Package credentials implements various credentials supported by gRPC li homepage: https://pkg.go.dev/google.golang.org/grpc/credentials license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/credentials/insecure.dep.yml b/.licenses/go/google.golang.org/grpc/credentials/insecure.dep.yml index 93b91028418..c057209b0ba 100644 --- a/.licenses/go/google.golang.org/grpc/credentials/insecure.dep.yml +++ b/.licenses/go/google.golang.org/grpc/credentials/insecure.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/credentials/insecure -version: v1.58.3 +version: v1.59.0 type: go summary: Package insecure provides an implementation of the credentials.TransportCredentials interface which disables transport security. homepage: https://pkg.go.dev/google.golang.org/grpc/credentials/insecure license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/encoding.dep.yml b/.licenses/go/google.golang.org/grpc/encoding.dep.yml index 150d80cf818..a564ded5aba 100644 --- a/.licenses/go/google.golang.org/grpc/encoding.dep.yml +++ b/.licenses/go/google.golang.org/grpc/encoding.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/encoding -version: v1.58.3 +version: v1.59.0 type: go summary: Package encoding defines the interface for the compressor and codec, and functions to register and retrieve compressors and codecs. homepage: https://pkg.go.dev/google.golang.org/grpc/encoding license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/encoding/proto.dep.yml b/.licenses/go/google.golang.org/grpc/encoding/proto.dep.yml index 5c436e2570b..cb57fd8dac0 100644 --- a/.licenses/go/google.golang.org/grpc/encoding/proto.dep.yml +++ b/.licenses/go/google.golang.org/grpc/encoding/proto.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/encoding/proto -version: v1.58.3 +version: v1.59.0 type: go summary: Package proto defines the protobuf codec. homepage: https://pkg.go.dev/google.golang.org/grpc/encoding/proto license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/grpclog.dep.yml b/.licenses/go/google.golang.org/grpc/grpclog.dep.yml index cee5f6f25bc..00cdc22eaf5 100644 --- a/.licenses/go/google.golang.org/grpc/grpclog.dep.yml +++ b/.licenses/go/google.golang.org/grpc/grpclog.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/grpclog -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpclog defines logging for grpc. homepage: https://pkg.go.dev/google.golang.org/grpc/grpclog license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal.dep.yml b/.licenses/go/google.golang.org/grpc/internal.dep.yml index 8357c1c4848..2dded8fecfd 100644 --- a/.licenses/go/google.golang.org/grpc/internal.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal -version: v1.58.3 +version: v1.59.0 type: go summary: Package internal contains gRPC-internal code, to avoid polluting the godoc of the top-level grpc package. homepage: https://pkg.go.dev/google.golang.org/grpc/internal license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/backoff.dep.yml b/.licenses/go/google.golang.org/grpc/internal/backoff.dep.yml index 4a1a05b7d10..0b758f3d550 100644 --- a/.licenses/go/google.golang.org/grpc/internal/backoff.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/backoff.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/backoff -version: v1.58.3 +version: v1.59.0 type: go summary: Package backoff implement the backoff strategy for gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/backoff license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/balancer/gracefulswitch.dep.yml b/.licenses/go/google.golang.org/grpc/internal/balancer/gracefulswitch.dep.yml index 47891c92da6..90492543967 100644 --- a/.licenses/go/google.golang.org/grpc/internal/balancer/gracefulswitch.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/balancer/gracefulswitch.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/balancer/gracefulswitch -version: v1.58.3 +version: v1.59.0 type: go summary: Package gracefulswitch implements a graceful switch load balancer. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/balancer/gracefulswitch license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/balancerload.dep.yml b/.licenses/go/google.golang.org/grpc/internal/balancerload.dep.yml index 0e82c9be18c..e26ecfae4ca 100644 --- a/.licenses/go/google.golang.org/grpc/internal/balancerload.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/balancerload.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/balancerload -version: v1.58.3 +version: v1.59.0 type: go summary: Package balancerload defines APIs to parse server loads in trailers. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/balancerload license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/binarylog.dep.yml b/.licenses/go/google.golang.org/grpc/internal/binarylog.dep.yml index 913cbadcdaa..10d9ce6506a 100644 --- a/.licenses/go/google.golang.org/grpc/internal/binarylog.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/binarylog.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/binarylog -version: v1.58.3 +version: v1.59.0 type: go summary: Package binarylog implementation binary logging as defined in https://github.com/grpc/proposal/blob/master/A16-binary-logging.md. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/binarylog license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/buffer.dep.yml b/.licenses/go/google.golang.org/grpc/internal/buffer.dep.yml index 27f91e7d27b..e7e9b96d2b0 100644 --- a/.licenses/go/google.golang.org/grpc/internal/buffer.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/buffer.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/buffer -version: v1.58.3 +version: v1.59.0 type: go summary: Package buffer provides an implementation of an unbounded buffer. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/buffer license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/channelz.dep.yml b/.licenses/go/google.golang.org/grpc/internal/channelz.dep.yml index 600db575c56..e362f694600 100644 --- a/.licenses/go/google.golang.org/grpc/internal/channelz.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/channelz.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/channelz -version: v1.58.3 +version: v1.59.0 type: go summary: Package channelz defines APIs for enabling channelz service, entry registration/deletion, and accessing channelz data. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/channelz license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/credentials.dep.yml b/.licenses/go/google.golang.org/grpc/internal/credentials.dep.yml index 015dd75fe34..9e96e53fa62 100644 --- a/.licenses/go/google.golang.org/grpc/internal/credentials.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/credentials.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/credentials -version: v1.58.3 +version: v1.59.0 type: go summary: Package credentials defines APIs for parsing SPIFFE ID. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/credentials license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/envconfig.dep.yml b/.licenses/go/google.golang.org/grpc/internal/envconfig.dep.yml index a8f4ba64ea5..5bd2910a7c1 100644 --- a/.licenses/go/google.golang.org/grpc/internal/envconfig.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/envconfig.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/envconfig -version: v1.58.3 +version: v1.59.0 type: go summary: Package envconfig contains grpc settings configured by environment variables. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/envconfig license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/grpclog.dep.yml b/.licenses/go/google.golang.org/grpc/internal/grpclog.dep.yml index 526d84ca80f..06459070b61 100644 --- a/.licenses/go/google.golang.org/grpc/internal/grpclog.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/grpclog.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/grpclog -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpclog (internal) defines depth logging for grpc. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/grpclog license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/grpcrand.dep.yml b/.licenses/go/google.golang.org/grpc/internal/grpcrand.dep.yml index 9772e4347d4..5c3ef087218 100644 --- a/.licenses/go/google.golang.org/grpc/internal/grpcrand.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/grpcrand.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/grpcrand -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpcrand implements math/rand functions in a concurrent-safe way with a global random source, independent of math/rand's global source. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/grpcrand license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/grpcsync.dep.yml b/.licenses/go/google.golang.org/grpc/internal/grpcsync.dep.yml index 1fef831f619..6172b356dbd 100644 --- a/.licenses/go/google.golang.org/grpc/internal/grpcsync.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/grpcsync.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/grpcsync -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpcsync implements additional synchronization primitives built upon the sync package. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/grpcsync license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/grpcutil.dep.yml b/.licenses/go/google.golang.org/grpc/internal/grpcutil.dep.yml index de6406dfac6..0b2e60035cb 100644 --- a/.licenses/go/google.golang.org/grpc/internal/grpcutil.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/grpcutil.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/grpcutil -version: v1.58.3 +version: v1.59.0 type: go summary: Package grpcutil provides utility functions used across the gRPC codebase. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/grpcutil license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/idle.dep.yml b/.licenses/go/google.golang.org/grpc/internal/idle.dep.yml index f40f99c13a8..690a1350553 100644 --- a/.licenses/go/google.golang.org/grpc/internal/idle.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/idle.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/idle -version: v1.58.3 +version: v1.59.0 type: go summary: Package idle contains a component for managing idleness (entering and exiting) based on RPC activity. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/idle license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/metadata.dep.yml b/.licenses/go/google.golang.org/grpc/internal/metadata.dep.yml index f61b6e2fede..ee678ec0a75 100644 --- a/.licenses/go/google.golang.org/grpc/internal/metadata.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/metadata.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/metadata -version: v1.58.3 +version: v1.59.0 type: go summary: Package metadata contains functions to set and get metadata from addresses. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/metadata license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/pretty.dep.yml b/.licenses/go/google.golang.org/grpc/internal/pretty.dep.yml index a3ddfb1da2d..4f482986881 100644 --- a/.licenses/go/google.golang.org/grpc/internal/pretty.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/pretty.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/pretty -version: v1.58.3 +version: v1.59.0 type: go summary: Package pretty defines helper functions to pretty-print structs for logging. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/pretty license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/resolver.dep.yml b/.licenses/go/google.golang.org/grpc/internal/resolver.dep.yml index 4211f3cfb05..8e7d86e8c71 100644 --- a/.licenses/go/google.golang.org/grpc/internal/resolver.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/resolver.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/resolver -version: v1.58.3 +version: v1.59.0 type: go summary: Package resolver provides internal resolver-related functionality. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/resolver license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/resolver/dns.dep.yml b/.licenses/go/google.golang.org/grpc/internal/resolver/dns.dep.yml index ce8b87ccbba..a22edaca46a 100644 --- a/.licenses/go/google.golang.org/grpc/internal/resolver/dns.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/resolver/dns.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/resolver/dns -version: v1.58.3 +version: v1.59.0 type: go summary: Package dns implements a dns resolver to be installed as the default resolver in grpc. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/resolver/dns license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/resolver/passthrough.dep.yml b/.licenses/go/google.golang.org/grpc/internal/resolver/passthrough.dep.yml index 51dcaa6889b..e4539c2ed72 100644 --- a/.licenses/go/google.golang.org/grpc/internal/resolver/passthrough.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/resolver/passthrough.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/resolver/passthrough -version: v1.58.3 +version: v1.59.0 type: go summary: Package passthrough implements a pass-through resolver. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/resolver/passthrough license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/resolver/unix.dep.yml b/.licenses/go/google.golang.org/grpc/internal/resolver/unix.dep.yml index 232f9027bde..c0497dc623e 100644 --- a/.licenses/go/google.golang.org/grpc/internal/resolver/unix.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/resolver/unix.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/resolver/unix -version: v1.58.3 +version: v1.59.0 type: go summary: Package unix implements a resolver for unix targets. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/resolver/unix license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/serviceconfig.dep.yml b/.licenses/go/google.golang.org/grpc/internal/serviceconfig.dep.yml index a2966b47c5b..d48a818cd11 100644 --- a/.licenses/go/google.golang.org/grpc/internal/serviceconfig.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/serviceconfig.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/serviceconfig -version: v1.58.3 +version: v1.59.0 type: go summary: Package serviceconfig contains utility functions to parse service config. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/serviceconfig license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/status.dep.yml b/.licenses/go/google.golang.org/grpc/internal/status.dep.yml index e6393b2aec0..b9e184fb3f1 100644 --- a/.licenses/go/google.golang.org/grpc/internal/status.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/status.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/status -version: v1.58.3 +version: v1.59.0 type: go summary: Package status implements errors returned by gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/status license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/syscall.dep.yml b/.licenses/go/google.golang.org/grpc/internal/syscall.dep.yml index f1b004f470f..9669ed849d3 100644 --- a/.licenses/go/google.golang.org/grpc/internal/syscall.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/syscall.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/syscall -version: v1.58.3 +version: v1.59.0 type: go summary: Package syscall provides functionalities that grpc uses to get low-level operating system stats/info. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/syscall license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/transport.dep.yml b/.licenses/go/google.golang.org/grpc/internal/transport.dep.yml index cc0fc60ddb9..5dfe7fa30cb 100644 --- a/.licenses/go/google.golang.org/grpc/internal/transport.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/transport.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/internal/transport -version: v1.58.3 +version: v1.59.0 type: go summary: Package transport defines and implements message oriented communication channel to complete various transactions (e.g., an RPC). homepage: https://pkg.go.dev/google.golang.org/grpc/internal/transport license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/internal/transport/networktype.dep.yml b/.licenses/go/google.golang.org/grpc/internal/transport/networktype.dep.yml index 4d4c17bd7b9..348fb4cc16e 100644 --- a/.licenses/go/google.golang.org/grpc/internal/transport/networktype.dep.yml +++ b/.licenses/go/google.golang.org/grpc/internal/transport/networktype.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/internal/transport/networktype -version: v1.58.3 +version: v1.59.0 type: go summary: Package networktype declares the network type to be used in the default dialer. homepage: https://pkg.go.dev/google.golang.org/grpc/internal/transport/networktype license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/keepalive.dep.yml b/.licenses/go/google.golang.org/grpc/keepalive.dep.yml index 6af589bd62c..38e15142618 100644 --- a/.licenses/go/google.golang.org/grpc/keepalive.dep.yml +++ b/.licenses/go/google.golang.org/grpc/keepalive.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/keepalive -version: v1.58.3 +version: v1.59.0 type: go summary: Package keepalive defines configurable parameters for point-to-point healthcheck. homepage: https://pkg.go.dev/google.golang.org/grpc/keepalive license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/metadata.dep.yml b/.licenses/go/google.golang.org/grpc/metadata.dep.yml index 206d83ac91f..a83c4b25c6e 100644 --- a/.licenses/go/google.golang.org/grpc/metadata.dep.yml +++ b/.licenses/go/google.golang.org/grpc/metadata.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/metadata -version: v1.58.3 +version: v1.59.0 type: go summary: Package metadata define the structure of the metadata supported by gRPC library. homepage: https://pkg.go.dev/google.golang.org/grpc/metadata license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/peer.dep.yml b/.licenses/go/google.golang.org/grpc/peer.dep.yml index 8323b997f19..b714097e75f 100644 --- a/.licenses/go/google.golang.org/grpc/peer.dep.yml +++ b/.licenses/go/google.golang.org/grpc/peer.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/peer -version: v1.58.3 +version: v1.59.0 type: go summary: Package peer defines various peer information associated with RPCs and corresponding utils. homepage: https://pkg.go.dev/google.golang.org/grpc/peer license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/resolver.dep.yml b/.licenses/go/google.golang.org/grpc/resolver.dep.yml index a333cd59fd5..31a507d9d11 100644 --- a/.licenses/go/google.golang.org/grpc/resolver.dep.yml +++ b/.licenses/go/google.golang.org/grpc/resolver.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/resolver -version: v1.58.3 +version: v1.59.0 type: go summary: Package resolver defines APIs for name resolution in gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/resolver license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/serviceconfig.dep.yml b/.licenses/go/google.golang.org/grpc/serviceconfig.dep.yml index 671bb8eb385..4f4f6774fa1 100644 --- a/.licenses/go/google.golang.org/grpc/serviceconfig.dep.yml +++ b/.licenses/go/google.golang.org/grpc/serviceconfig.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/serviceconfig -version: v1.58.3 +version: v1.59.0 type: go summary: Package serviceconfig defines types and methods for operating on gRPC service configs. homepage: https://pkg.go.dev/google.golang.org/grpc/serviceconfig license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/stats.dep.yml b/.licenses/go/google.golang.org/grpc/stats.dep.yml index 4f788a46b7d..105008978f3 100644 --- a/.licenses/go/google.golang.org/grpc/stats.dep.yml +++ b/.licenses/go/google.golang.org/grpc/stats.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/stats -version: v1.58.3 +version: v1.59.0 type: go summary: Package stats is for collecting and reporting various network and RPC stats. homepage: https://pkg.go.dev/google.golang.org/grpc/stats license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/status.dep.yml b/.licenses/go/google.golang.org/grpc/status.dep.yml index 9ca0facab57..f480312b8db 100644 --- a/.licenses/go/google.golang.org/grpc/status.dep.yml +++ b/.licenses/go/google.golang.org/grpc/status.dep.yml @@ -1,12 +1,12 @@ --- name: google.golang.org/grpc/status -version: v1.58.3 +version: v1.59.0 type: go summary: Package status implements errors returned by gRPC. homepage: https://pkg.go.dev/google.golang.org/grpc/status license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/.licenses/go/google.golang.org/grpc/tap.dep.yml b/.licenses/go/google.golang.org/grpc/tap.dep.yml index 914452ebb2a..027c333b0c2 100644 --- a/.licenses/go/google.golang.org/grpc/tap.dep.yml +++ b/.licenses/go/google.golang.org/grpc/tap.dep.yml @@ -1,13 +1,13 @@ --- name: google.golang.org/grpc/tap -version: v1.58.3 +version: v1.59.0 type: go summary: Package tap defines the function handles which are executed on the transport layer of gRPC-Go and related information. homepage: https://pkg.go.dev/google.golang.org/grpc/tap license: apache-2.0 licenses: -- sources: grpc@v1.58.3/LICENSE +- sources: grpc@v1.59.0/LICENSE text: |2 Apache License diff --git a/go.mod b/go.mod index 7351230e8d7..3cb1be40908 100644 --- a/go.mod +++ b/go.mod @@ -40,7 +40,7 @@ require ( golang.org/x/term v0.13.0 golang.org/x/text v0.13.0 google.golang.org/genproto/googleapis/rpc v0.0.0-20231012201019-e917dd12ba7a - google.golang.org/grpc v1.58.3 + google.golang.org/grpc v1.59.0 google.golang.org/protobuf v1.31.0 gopkg.in/yaml.v3 v3.0.1 ) diff --git a/go.sum b/go.sum index 81eaf0ba6dd..7de473165d6 100644 --- a/go.sum +++ b/go.sum @@ -677,8 +677,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.58.3 h1:BjnpXut1btbtgN/6sp+brB2Kbm2LjNXnidYujAVbSoQ= -google.golang.org/grpc v1.58.3/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/mysketchbook/newsketch/newsketch.ino b/mysketchbook/newsketch/newsketch.ino new file mode 100644 index 00000000000..74f966a4e2f --- /dev/null +++ b/mysketchbook/newsketch/newsketch.ino @@ -0,0 +1,6 @@ + +void setup() { +} + +void loop() { +} From 4b2a32befd8eef2520d6c407c7c116a654076a8f Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Thu, 19 Oct 2023 15:35:36 +0200 Subject: [PATCH 2/4] [skip-changelog] refactor: Made `command` functions to access PackageManager unavailable from public API (#2335) * Let instance commands require an *rpc.Instance Removed the shorthand of the InstanceCommand interface. This makes the API more coherent among the `commands` instance handling. * Moved 'command' package's instances functions inside internal package This change highlights the incorrect PackageManager access in 'cli' package. Now those are errors: package github.com/arduino/arduino-cli imports github.com/arduino/arduino-cli/internal/cli imports github.com/arduino/arduino-cli/internal/cli/board imports github.com/arduino/arduino-cli/internal/cli/arguments internal/cli/arguments/completion.go:23:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed package github.com/arduino/arduino-cli imports github.com/arduino/arduino-cli/internal/cli imports github.com/arduino/arduino-cli/internal/cli/board imports github.com/arduino/arduino-cli/internal/cli/arguments internal/cli/arguments/port.go:24:2: use of internal package github.com/arduino/arduino-cli/commands/internal/instances not allowed * Made CoreInstance private * Inlined coreInstancesContainer singleton methods * Removed all wrong accesses to package Explorer * Replaced DiscoveryManager.Watch with equivalent gRPC BoardListWatch call * Replaced direct access to PackageManager to get discovery protocols Previously the function GetConnectedBoards() counter-intuitively returned a list of port address. Now it has been reneamed GetAvailablePorts() and returns the full Port object that is mapped into an array of Addresses or into an array of Prorocols based on the auto-completion request. --- commands/board/details.go | 4 +- commands/board/list.go | 6 +- commands/board/listall.go | 4 +- commands/board/search.go | 4 +- commands/compile/compile.go | 6 +- commands/core/download.go | 3 +- commands/core/install.go | 3 +- commands/core/list.go | 3 +- commands/core/search.go | 3 +- commands/core/uninstall.go | 3 +- commands/core/upgrade.go | 6 +- commands/debug/debug.go | 4 +- commands/debug/debug_info.go | 4 +- commands/instances.go | 150 ++---------------- commands/internal/instances/instances.go | 144 +++++++++++++++++ commands/lib/download.go | 4 +- commands/lib/install.go | 7 +- commands/lib/list.go | 6 +- commands/lib/resolve_deps.go | 4 +- commands/lib/search.go | 4 +- commands/lib/uninstall.go | 4 +- commands/lib/upgrade.go | 5 +- commands/monitor/monitor.go | 4 +- commands/monitor/settings.go | 4 +- commands/upload/burnbootloader.go | 4 +- commands/upload/programmers_list.go | 4 +- commands/upload/upload.go | 6 +- internal/cli/arguments/completion.go | 55 +------ internal/cli/arguments/port.go | 30 ++-- .../completion/completion_test.go | 14 +- rpc/cc/arduino/cli/commands/v1/common.go | 6 - 31 files changed, 237 insertions(+), 271 deletions(-) create mode 100644 commands/internal/instances/instances.go diff --git a/commands/board/details.go b/commands/board/details.go index 3570cc26b05..17314aa1432 100644 --- a/commands/board/details.go +++ b/commands/board/details.go @@ -21,14 +21,14 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/utils" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // Details returns all details for a board including tools and HW identifiers. // This command basically gather al the information and translates it into the required grpc struct properties func Details(ctx context.Context, req *rpc.BoardDetailsRequest) (*rpc.BoardDetailsResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/board/list.go b/commands/board/list.go index a3ebd9b97e0..d0b5cb78dc4 100644 --- a/commands/board/list.go +++ b/commands/board/list.go @@ -31,7 +31,7 @@ import ( "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/arduino/discovery" "github.com/arduino/arduino-cli/arduino/httpclient" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/internal/inventory" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-properties-orderedmap" @@ -203,7 +203,7 @@ func identify(pme *packagemanager.Explorer, port *discovery.Port) ([]*rpc.BoardL // In case of errors partial results from discoveries that didn't fail // are returned. func List(req *rpc.BoardListRequest) (r []*rpc.DetectedPort, discoveryStartErrors []error, e error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, nil, &arduino.InvalidInstanceError{} } @@ -258,7 +258,7 @@ func hasMatchingBoard(b *rpc.DetectedPort, fqbnFilter *cores.FQBN) bool { // Watch returns a channel that receives boards connection and disconnection events. func Watch(ctx context.Context, req *rpc.BoardListWatchRequest) (<-chan *rpc.BoardListWatchResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/board/listall.go b/commands/board/listall.go index 99735658038..d4118aca4e7 100644 --- a/commands/board/listall.go +++ b/commands/board/listall.go @@ -23,13 +23,13 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/utils" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // ListAll FIXMEDOC func ListAll(ctx context.Context, req *rpc.BoardListAllRequest) (*rpc.BoardListAllResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/board/search.go b/commands/board/search.go index 74d5946faaf..da0553463fa 100644 --- a/commands/board/search.go +++ b/commands/board/search.go @@ -22,7 +22,7 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/utils" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -31,7 +31,7 @@ import ( // installed. Note that platforms that are not installed don't include boards' FQBNs. // If no search argument is used all boards are returned. func Search(ctx context.Context, req *rpc.BoardSearchRequest) (*rpc.BoardSearchResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/compile/compile.go b/commands/compile/compile.go index 1f87c8a330d..604a7acb215 100644 --- a/commands/compile/compile.go +++ b/commands/compile/compile.go @@ -30,7 +30,7 @@ import ( "github.com/arduino/arduino-cli/arduino/sketch" "github.com/arduino/arduino-cli/arduino/utils" "github.com/arduino/arduino-cli/buildcache" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/configuration" "github.com/arduino/arduino-cli/i18n" "github.com/arduino/arduino-cli/internal/inventory" @@ -57,13 +57,13 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream exportBinaries = reqExportBinaries.Value } - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } defer release() - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/core/download.go b/commands/core/download.go index 2a7e37bd536..78d7539d9da 100644 --- a/commands/core/download.go +++ b/commands/core/download.go @@ -21,6 +21,7 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -29,7 +30,7 @@ var tr = i18n.Tr // PlatformDownload FIXMEDOC func PlatformDownload(ctx context.Context, req *rpc.PlatformDownloadRequest, downloadCB rpc.DownloadProgressCB) (*rpc.PlatformDownloadResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/core/install.go b/commands/core/install.go index 20525ec58ae..6a159f7de50 100644 --- a/commands/core/install.go +++ b/commands/core/install.go @@ -22,13 +22,14 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // PlatformInstall FIXMEDOC func PlatformInstall(ctx context.Context, req *rpc.PlatformInstallRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) (*rpc.PlatformInstallResponse, error) { install := func() error { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return &arduino.InvalidInstanceError{} } diff --git a/commands/core/list.go b/commands/core/list.go index 426bc19b05d..10d582de2d1 100644 --- a/commands/core/list.go +++ b/commands/core/list.go @@ -22,13 +22,14 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // PlatformList returns a list of installed platforms, optionally filtered by // those requiring an update. func PlatformList(req *rpc.PlatformListRequest) (*rpc.PlatformListResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/core/search.go b/commands/core/search.go index 69b81e3b369..4562eb570e0 100644 --- a/commands/core/search.go +++ b/commands/core/search.go @@ -24,12 +24,13 @@ import ( "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/utils" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // PlatformSearch FIXMEDOC func PlatformSearch(req *rpc.PlatformSearchRequest) (*rpc.PlatformSearchResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/core/uninstall.go b/commands/core/uninstall.go index 3bdbf85fbcc..ec0ae20bc08 100644 --- a/commands/core/uninstall.go +++ b/commands/core/uninstall.go @@ -21,6 +21,7 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -37,7 +38,7 @@ func PlatformUninstall(ctx context.Context, req *rpc.PlatformUninstallRequest, t // platformUninstall is the implementation of platform unistaller func platformUninstall(ctx context.Context, req *rpc.PlatformUninstallRequest, taskCB rpc.TaskProgressCB) error { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return &arduino.InvalidInstanceError{} } diff --git a/commands/core/upgrade.go b/commands/core/upgrade.go index 49b81e68488..2baaf2c97d6 100644 --- a/commands/core/upgrade.go +++ b/commands/core/upgrade.go @@ -18,18 +18,18 @@ package core import ( "context" - "github.com/arduino/arduino-cli/arduino/cores" - "github.com/arduino/arduino-cli/arduino" + "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // PlatformUpgrade FIXMEDOC func PlatformUpgrade(ctx context.Context, req *rpc.PlatformUpgradeRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) (*rpc.PlatformUpgradeResponse, error) { upgrade := func() (*cores.PlatformRelease, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/debug/debug.go b/commands/debug/debug.go index 0681b77c53f..ab55e317508 100644 --- a/commands/debug/debug.go +++ b/commands/debug/debug.go @@ -26,7 +26,7 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/executils" "github.com/arduino/arduino-cli/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" @@ -45,7 +45,7 @@ var tr = i18n.Tr func Debug(ctx context.Context, req *rpc.GetDebugConfigRequest, inStream io.Reader, out io.Writer, interrupt <-chan os.Signal) (*rpc.DebugResponse, error) { // Get debugging command line to run debugger - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/debug/debug_info.go b/commands/debug/debug_info.go index 2df787cc1a8..cd5308ece7c 100644 --- a/commands/debug/debug_info.go +++ b/commands/debug/debug_info.go @@ -25,7 +25,7 @@ import ( "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" "github.com/arduino/arduino-cli/arduino/sketch" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-paths-helper" "github.com/arduino/go-properties-orderedmap" @@ -35,7 +35,7 @@ import ( // GetDebugConfig returns metadata to start debugging with the specified board func GetDebugConfig(ctx context.Context, req *rpc.GetDebugConfigRequest) (*rpc.GetDebugConfigResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/instances.go b/commands/instances.go index 15d52f6996b..ea1a42b45e8 100644 --- a/commands/instances.go +++ b/commands/instances.go @@ -21,7 +21,6 @@ import ( "net/url" "path/filepath" "strings" - "sync" "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores" @@ -34,10 +33,10 @@ import ( "github.com/arduino/arduino-cli/arduino/resources" "github.com/arduino/arduino-cli/arduino/sketch" "github.com/arduino/arduino-cli/arduino/utils" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/configuration" "github.com/arduino/arduino-cli/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" - "github.com/arduino/arduino-cli/version" paths "github.com/arduino/go-paths-helper" "github.com/sirupsen/logrus" "google.golang.org/grpc/codes" @@ -46,90 +45,6 @@ import ( var tr = i18n.Tr -// CoreInstance is an instance of the Arduino Core Services. The user can -// instantiate as many as needed by providing a different configuration -// for each one. -type CoreInstance struct { - pm *packagemanager.PackageManager - lm *librariesmanager.LibrariesManager -} - -// coreInstancesContainer has methods to add an remove instances atomically. -type coreInstancesContainer struct { - instances map[int32]*CoreInstance - instancesCount int32 - instancesMux sync.Mutex -} - -// instances contains all the running Arduino Core Services instances -var instances = &coreInstancesContainer{ - instances: map[int32]*CoreInstance{}, - instancesCount: 1, -} - -// GetInstance returns a CoreInstance for the given ID, or nil if ID -// doesn't exist -func (c *coreInstancesContainer) GetInstance(id int32) *CoreInstance { - c.instancesMux.Lock() - defer c.instancesMux.Unlock() - return c.instances[id] -} - -// AddAndAssignID saves the CoreInstance and assigns a unique ID to -// retrieve it later -func (c *coreInstancesContainer) AddAndAssignID(i *CoreInstance) int32 { - c.instancesMux.Lock() - defer c.instancesMux.Unlock() - id := c.instancesCount - c.instances[id] = i - c.instancesCount++ - return id -} - -// RemoveID removes the CoreInstance referenced by id. Returns true -// if the operation is successful, or false if the CoreInstance does -// not exist -func (c *coreInstancesContainer) RemoveID(id int32) bool { - c.instancesMux.Lock() - defer c.instancesMux.Unlock() - if _, ok := c.instances[id]; !ok { - return false - } - delete(c.instances, id) - return true -} - -// GetPackageManager returns a PackageManager. If the package manager is not found -// (because the instance is invalid or has been destroyed), nil is returned. -// Deprecated: use GetPackageManagerExplorer instead. -func GetPackageManager(instance rpc.InstanceCommand) *packagemanager.PackageManager { - i := instances.GetInstance(instance.GetInstance().GetId()) - if i == nil { - return nil - } - return i.pm -} - -// GetPackageManagerExplorer returns a new package manager Explorer. The -// explorer holds a read lock on the underlying PackageManager and it should -// be released by calling the returned "release" function. -func GetPackageManagerExplorer(req rpc.InstanceCommand) (explorer *packagemanager.Explorer, release func()) { - pm := GetPackageManager(req) - if pm == nil { - return nil, nil - } - return pm.NewExplorer() -} - -// GetLibraryManager returns the library manager for the given instance. -func GetLibraryManager(req rpc.InstanceCommand) *librariesmanager.LibrariesManager { - i := instances.GetInstance(req.GetInstance().GetId()) - if i == nil { - return nil - } - return i.lm -} - func installTool(pm *packagemanager.PackageManager, tool *cores.ToolRelease, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { pme, release := pm.NewExplorer() defer release() @@ -146,50 +61,11 @@ func installTool(pm *packagemanager.PackageManager, tool *cores.ToolRelease, dow // Create a new CoreInstance ready to be initialized, supporting directories are also created. func Create(req *rpc.CreateRequest, extraUserAgent ...string) (*rpc.CreateResponse, error) { - instance := &CoreInstance{} - - // Setup downloads directory - downloadsDir := configuration.DownloadsDir(configuration.Settings) - if downloadsDir.NotExist() { - err := downloadsDir.MkdirAll() - if err != nil { - return nil, &arduino.PermissionDeniedError{Message: tr("Failed to create downloads directory"), Cause: err} - } - } - - // Setup data directory - dataDir := configuration.DataDir(configuration.Settings) - packagesDir := configuration.PackagesDir(configuration.Settings) - if packagesDir.NotExist() { - err := packagesDir.MkdirAll() - if err != nil { - return nil, &arduino.PermissionDeniedError{Message: tr("Failed to create data directory"), Cause: err} - } - } - - // Create package manager - userAgent := "arduino-cli/" + version.VersionInfo.VersionString - for _, ua := range extraUserAgent { - userAgent += " " + ua + inst, err := instances.Create(extraUserAgent...) + if err != nil { + return nil, err } - instance.pm = packagemanager.NewBuilder( - dataDir, - configuration.PackagesDir(configuration.Settings), - downloadsDir, - dataDir.Join("tmp"), - userAgent, - ).Build() - instance.lm = librariesmanager.NewLibraryManager( - dataDir, - downloadsDir, - ) - - // Save instance - instanceID := instances.AddAndAssignID(instance) - - return &rpc.CreateResponse{ - Instance: &rpc.Instance{Id: instanceID}, - }, nil + return &rpc.CreateResponse{Instance: inst}, nil } // Init loads installed libraries and Platforms in CoreInstance with specified ID, @@ -205,8 +81,8 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro if reqInst == nil { return &arduino.InvalidInstanceError{} } - instance := instances.GetInstance(reqInst.GetId()) - if instance == nil { + instance := req.GetInstance() + if !instances.IsValid(instance) { return &arduino.InvalidInstanceError{} } @@ -295,7 +171,7 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro // after reinitializing an instance after installing or uninstalling a core. // If this is not done the information of the uninstall core is kept in memory, // even if it should not. - pmb, commitPackageManager := instance.pm.NewBuilder() + pmb, commitPackageManager := instances.GetPackageManager(instance).NewBuilder() // Load packages index for _, URL := range allPackageIndexUrls { @@ -390,7 +266,7 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro commitPackageManager() } - pme, release := instance.pm.NewExplorer() + pme, release := instances.GetPackageManagerExplorer(instance) defer release() for _, err := range pme.LoadDiscoveries() { @@ -403,7 +279,7 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro pme.IndexDir, pme.DownloadDir, ) - instance.lm = lm + _ = instances.SetLibraryManager(instance, lm) // should never fail // Load libraries for _, pack := range pme.GetPackages() { @@ -485,7 +361,7 @@ func Init(req *rpc.InitRequest, responseCallback func(r *rpc.InitResponse)) erro // Destroy FIXMEDOC func Destroy(ctx context.Context, req *rpc.DestroyRequest) (*rpc.DestroyResponse, error) { - if ok := instances.RemoveID(req.GetInstance().GetId()); !ok { + if ok := instances.Delete(req.GetInstance()); !ok { return nil, &arduino.InvalidInstanceError{} } return &rpc.DestroyResponse{}, nil @@ -494,7 +370,7 @@ func Destroy(ctx context.Context, req *rpc.DestroyRequest) (*rpc.DestroyResponse // UpdateLibrariesIndex updates the library_index.json func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequest, downloadCB rpc.DownloadProgressCB) error { logrus.Info("Updating libraries index") - lm := GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return &arduino.InvalidInstanceError{} } @@ -523,7 +399,7 @@ func UpdateLibrariesIndex(ctx context.Context, req *rpc.UpdateLibrariesIndexRequ // UpdateIndex FIXMEDOC func UpdateIndex(ctx context.Context, req *rpc.UpdateIndexRequest, downloadCB rpc.DownloadProgressCB) error { - if instances.GetInstance(req.GetInstance().GetId()) == nil { + if !instances.IsValid(req.GetInstance()) { return &arduino.InvalidInstanceError{} } diff --git a/commands/internal/instances/instances.go b/commands/internal/instances/instances.go new file mode 100644 index 00000000000..7b13f77234d --- /dev/null +++ b/commands/internal/instances/instances.go @@ -0,0 +1,144 @@ +package instances + +import ( + "sync" + + "github.com/arduino/arduino-cli/arduino" + "github.com/arduino/arduino-cli/arduino/cores/packagemanager" + "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager" + "github.com/arduino/arduino-cli/configuration" + "github.com/arduino/arduino-cli/i18n" + rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" + "github.com/arduino/arduino-cli/version" +) + +var tr = i18n.Tr + +// coreInstance is an instance of the Arduino Core Services. The user can +// instantiate as many as needed by providing a different configuration +// for each one. +type coreInstance struct { + pm *packagemanager.PackageManager + lm *librariesmanager.LibrariesManager +} + +// instances contains all the running Arduino Core Services instances +var instances = map[int32]*coreInstance{} +var instancesCount int32 = 1 +var instancesMux sync.Mutex + +// GetPackageManager returns a PackageManager. If the package manager is not found +// (because the instance is invalid or has been destroyed), nil is returned. +// Deprecated: use GetPackageManagerExplorer instead. +func GetPackageManager(inst *rpc.Instance) *packagemanager.PackageManager { + instancesMux.Lock() + i := instances[inst.GetId()] + instancesMux.Unlock() + if i == nil { + return nil + } + return i.pm +} + +// GetPackageManagerExplorer returns a new package manager Explorer. The +// explorer holds a read lock on the underlying PackageManager and it should +// be released by calling the returned "release" function. +func GetPackageManagerExplorer(req *rpc.Instance) (explorer *packagemanager.Explorer, release func()) { + pm := GetPackageManager(req) + if pm == nil { + return nil, nil + } + return pm.NewExplorer() +} + +// GetLibraryManager returns the library manager for the given instance. +func GetLibraryManager(inst *rpc.Instance) *librariesmanager.LibrariesManager { + instancesMux.Lock() + i := instances[inst.GetId()] + instancesMux.Unlock() + if i == nil { + return nil + } + return i.lm +} + +// SetLibraryManager sets the library manager for the given instance. +func SetLibraryManager(inst *rpc.Instance, lm *librariesmanager.LibrariesManager) bool { + instancesMux.Lock() + i := instances[inst.GetId()] + instancesMux.Unlock() + if i == nil { + return false + } + i.lm = lm + return true +} + +// Create a new *rpc.Instance ready to be initialized, supporting directories are also created. +func Create(extraUserAgent ...string) (*rpc.Instance, error) { + instance := &coreInstance{} + + // Setup downloads directory + downloadsDir := configuration.DownloadsDir(configuration.Settings) + if downloadsDir.NotExist() { + err := downloadsDir.MkdirAll() + if err != nil { + return nil, &arduino.PermissionDeniedError{Message: tr("Failed to create downloads directory"), Cause: err} + } + } + + // Setup data directory + dataDir := configuration.DataDir(configuration.Settings) + packagesDir := configuration.PackagesDir(configuration.Settings) + if packagesDir.NotExist() { + err := packagesDir.MkdirAll() + if err != nil { + return nil, &arduino.PermissionDeniedError{Message: tr("Failed to create data directory"), Cause: err} + } + } + + // Create package manager + userAgent := "arduino-cli/" + version.VersionInfo.VersionString + for _, ua := range extraUserAgent { + userAgent += " " + ua + } + instance.pm = packagemanager.NewBuilder( + dataDir, + configuration.PackagesDir(configuration.Settings), + downloadsDir, + dataDir.Join("tmp"), + userAgent, + ).Build() + instance.lm = librariesmanager.NewLibraryManager( + dataDir, + downloadsDir, + ) + + // Save instance + instancesMux.Lock() + id := instancesCount + instances[id] = instance + instancesCount++ + instancesMux.Unlock() + + return &rpc.Instance{Id: id}, nil +} + +// IsValid returns true if the given instance is valid. +func IsValid(inst *rpc.Instance) bool { + instancesMux.Lock() + i := instances[inst.GetId()] + instancesMux.Unlock() + return i != nil +} + +// Delete removes an instance. +func Delete(inst *rpc.Instance) bool { + instancesMux.Lock() + defer instancesMux.Unlock() + if _, ok := instances[inst.GetId()]; !ok { + return false + } + delete(instances, inst.GetId()) + return true +} diff --git a/commands/lib/download.go b/commands/lib/download.go index 9d6c43cb875..1d30ba1dc48 100644 --- a/commands/lib/download.go +++ b/commands/lib/download.go @@ -22,7 +22,7 @@ import ( "github.com/arduino/arduino-cli/arduino/httpclient" "github.com/arduino/arduino-cli/arduino/libraries/librariesindex" "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" @@ -35,7 +35,7 @@ var tr = i18n.Tr func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadRequest, downloadCB rpc.DownloadProgressCB) (*rpc.LibraryDownloadResponse, error) { logrus.Info("Executing `arduino-cli lib download`") - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/lib/install.go b/commands/lib/install.go index e106981e60c..d06102b57a6 100644 --- a/commands/lib/install.go +++ b/commands/lib/install.go @@ -25,6 +25,7 @@ import ( "github.com/arduino/arduino-cli/arduino/libraries/librariesindex" "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-paths-helper" "github.com/sirupsen/logrus" @@ -32,7 +33,7 @@ import ( // LibraryInstall resolves the library dependencies, then downloads and installs the libraries into the install location. func LibraryInstall(ctx context.Context, req *rpc.LibraryInstallRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return &arduino.InvalidInstanceError{} } @@ -143,7 +144,7 @@ func installLibrary(lm *librariesmanager.LibrariesManager, libRelease *libraries // ZipLibraryInstall FIXMEDOC func ZipLibraryInstall(ctx context.Context, req *rpc.ZipLibraryInstallRequest, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if err := lm.InstallZipLib(ctx, paths.New(req.Path), req.Overwrite); err != nil { return &arduino.FailedLibraryInstallError{Cause: err} } @@ -153,7 +154,7 @@ func ZipLibraryInstall(ctx context.Context, req *rpc.ZipLibraryInstallRequest, t // GitLibraryInstall FIXMEDOC func GitLibraryInstall(ctx context.Context, req *rpc.GitLibraryInstallRequest, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if err := lm.InstallGitLib(req.Url, req.Overwrite); err != nil { return &arduino.FailedLibraryInstallError{Cause: err} } diff --git a/commands/lib/list.go b/commands/lib/list.go index eb226c145c7..553101620e4 100644 --- a/commands/lib/list.go +++ b/commands/lib/list.go @@ -25,7 +25,7 @@ import ( "github.com/arduino/arduino-cli/arduino/libraries/librariesindex" "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager" "github.com/arduino/arduino-cli/arduino/libraries/librariesresolver" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) @@ -36,13 +36,13 @@ type installedLib struct { // LibraryList FIXMEDOC func LibraryList(ctx context.Context, req *rpc.LibraryListRequest) (*rpc.LibraryListResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } defer release() - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/lib/resolve_deps.go b/commands/lib/resolve_deps.go index eee45e81d61..1c26d026f97 100644 --- a/commands/lib/resolve_deps.go +++ b/commands/lib/resolve_deps.go @@ -22,13 +22,13 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/libraries" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // LibraryResolveDependencies FIXMEDOC func LibraryResolveDependencies(ctx context.Context, req *rpc.LibraryResolveDependenciesRequest) (*rpc.LibraryResolveDependenciesResponse, error) { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/lib/search.go b/commands/lib/search.go index da9e12019b5..5e44e2273e1 100644 --- a/commands/lib/search.go +++ b/commands/lib/search.go @@ -24,14 +24,14 @@ import ( "github.com/arduino/arduino-cli/arduino/libraries/librariesindex" "github.com/arduino/arduino-cli/arduino/libraries/librariesmanager" "github.com/arduino/arduino-cli/arduino/utils" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" semver "go.bug.st/relaxed-semver" ) // LibrarySearch FIXMEDOC func LibrarySearch(ctx context.Context, req *rpc.LibrarySearchRequest) (*rpc.LibrarySearchResponse, error) { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/lib/uninstall.go b/commands/lib/uninstall.go index 61cd18a1362..63b54ba064e 100644 --- a/commands/lib/uninstall.go +++ b/commands/lib/uninstall.go @@ -20,14 +20,14 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/libraries" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-paths-helper" ) // LibraryUninstall FIXMEDOC func LibraryUninstall(ctx context.Context, req *rpc.LibraryUninstallRequest, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) ref, err := createLibIndexReference(lm, req) if err != nil { return &arduino.InvalidLibraryError{Cause: err} diff --git a/commands/lib/upgrade.go b/commands/lib/upgrade.go index b02ed8d5733..fe7e938a040 100644 --- a/commands/lib/upgrade.go +++ b/commands/lib/upgrade.go @@ -20,12 +20,13 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // LibraryUpgradeAll upgrades all the available libraries func LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return &arduino.InvalidInstanceError{} } @@ -43,7 +44,7 @@ func LibraryUpgradeAll(req *rpc.LibraryUpgradeAllRequest, downloadCB rpc.Downloa // LibraryUpgrade upgrades a library func LibraryUpgrade(ctx context.Context, req *rpc.LibraryUpgradeRequest, downloadCB rpc.DownloadProgressCB, taskCB rpc.TaskProgressCB) error { - lm := commands.GetLibraryManager(req) + lm := instances.GetLibraryManager(req.GetInstance()) if lm == nil { return &arduino.InvalidInstanceError{} } diff --git a/commands/monitor/monitor.go b/commands/monitor/monitor.go index ef0cc2f1672..4da0c902868 100644 --- a/commands/monitor/monitor.go +++ b/commands/monitor/monitor.go @@ -24,7 +24,7 @@ import ( "github.com/arduino/arduino-cli/arduino/cores" "github.com/arduino/arduino-cli/arduino/cores/packagemanager" pluggableMonitor "github.com/arduino/arduino-cli/arduino/monitor" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/i18n" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/arduino/go-properties-orderedmap" @@ -61,7 +61,7 @@ func (p *PortProxy) Close() error { // Monitor opens a communication port. It returns a PortProxy to communicate with the port and a PortDescriptor // that describes the available configuration settings. func Monitor(ctx context.Context, req *rpc.MonitorRequest) (*PortProxy, *pluggableMonitor.PortDescriptor, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, nil, &arduino.InvalidInstanceError{} } diff --git a/commands/monitor/settings.go b/commands/monitor/settings.go index b2b7e948e35..89976c94d77 100644 --- a/commands/monitor/settings.go +++ b/commands/monitor/settings.go @@ -20,13 +20,13 @@ import ( "github.com/arduino/arduino-cli/arduino" pluggableMonitor "github.com/arduino/arduino-cli/arduino/monitor" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // EnumerateMonitorPortSettings returns a description of the configuration settings of a monitor port func EnumerateMonitorPortSettings(ctx context.Context, req *rpc.EnumerateMonitorPortSettingsRequest) (*rpc.EnumerateMonitorPortSettingsResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/upload/burnbootloader.go b/commands/upload/burnbootloader.go index 99efe2be757..ad98c84d7af 100644 --- a/commands/upload/burnbootloader.go +++ b/commands/upload/burnbootloader.go @@ -20,7 +20,7 @@ import ( "io" "github.com/arduino/arduino-cli/arduino" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" ) @@ -33,7 +33,7 @@ func BurnBootloader(ctx context.Context, req *rpc.BurnBootloaderRequest, outStre WithField("programmer", req.GetProgrammer()). Trace("BurnBootloader started", req.GetFqbn()) - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/upload/programmers_list.go b/commands/upload/programmers_list.go index 07433fca138..b7290e68f5f 100644 --- a/commands/upload/programmers_list.go +++ b/commands/upload/programmers_list.go @@ -20,13 +20,13 @@ import ( "github.com/arduino/arduino-cli/arduino" "github.com/arduino/arduino-cli/arduino/cores" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" ) // ListProgrammersAvailableForUpload FIXMEDOC func ListProgrammersAvailableForUpload(ctx context.Context, req *rpc.ListProgrammersAvailableForUploadRequest) (*rpc.ListProgrammersAvailableForUploadResponse, error) { - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/commands/upload/upload.go b/commands/upload/upload.go index a9fdd3d4e1e..56815f983a6 100644 --- a/commands/upload/upload.go +++ b/commands/upload/upload.go @@ -30,7 +30,7 @@ import ( "github.com/arduino/arduino-cli/arduino/globals" "github.com/arduino/arduino-cli/arduino/serialutils" "github.com/arduino/arduino-cli/arduino/sketch" - "github.com/arduino/arduino-cli/commands" + "github.com/arduino/arduino-cli/commands/internal/instances" "github.com/arduino/arduino-cli/executils" "github.com/arduino/arduino-cli/i18n" f "github.com/arduino/arduino-cli/internal/algorithms" @@ -50,7 +50,7 @@ func SupportedUserFields(ctx context.Context, req *rpc.SupportedUserFieldsReques return nil, &arduino.MissingPortProtocolError{} } - pme, release := commands.GetPackageManagerExplorer(req) + pme, release := instances.GetPackageManagerExplorer(req.GetInstance()) defer release() if pme == nil { @@ -137,7 +137,7 @@ func Upload(ctx context.Context, req *rpc.UploadRequest, outStream io.Writer, er return nil, &arduino.CantOpenSketchError{Cause: err} } - pme, pmeRelease := commands.GetPackageManagerExplorer(req) + pme, pmeRelease := instances.GetPackageManagerExplorer(req.GetInstance()) if pme == nil { return nil, &arduino.InvalidInstanceError{} } diff --git a/internal/cli/arguments/completion.go b/internal/cli/arguments/completion.go index 5b25b2773bc..c97ac72f064 100644 --- a/internal/cli/arguments/completion.go +++ b/internal/cli/arguments/completion.go @@ -18,7 +18,6 @@ package arguments import ( "context" - "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/board" "github.com/arduino/arduino-cli/commands/core" "github.com/arduino/arduino-cli/commands/lib" @@ -46,41 +45,6 @@ func GetInstalledBoards() []string { return res } -// GetInstalledProtocols is an helper function useful to autocomplete. -// It returns a list of protocols available based on the installed boards -func GetInstalledProtocols() []string { - inst := instance.CreateAndInit() - - // FIXME: We must not access PackageManager directly here but use one of the commands.* functions - pme, release := commands.GetPackageManagerExplorer(&rpc.BoardListAllRequest{Instance: inst}) - if pme == nil { - return nil // should never happen... - } - defer release() - - boards := pme.InstalledBoards() - - installedProtocols := make(map[string]struct{}) - for _, board := range boards { - for _, protocol := range board.Properties.SubTree("upload.tool").FirstLevelKeys() { - if protocol == "default" { - // default is used as fallback when trying to upload to a board - // using a protocol not defined for it, it's useless showing it - // in autocompletion - continue - } - installedProtocols[protocol] = struct{}{} - } - } - res := make([]string, len(installedProtocols)) - i := 0 - for k := range installedProtocols { - res[i] = k - i++ - } - return res -} - // GetInstalledProgrammers is an helper function useful to autocomplete. // It returns a list of programmers available based on the installed boards func GetInstalledProgrammers() []string { @@ -94,13 +58,6 @@ func GetInstalledProgrammers() []string { } list, _ := board.ListAll(context.Background(), listAllReq) - // FIXME: We must not access PackageManager directly here but use one of the commands.* functions - pme, release := commands.GetPackageManagerExplorer(listAllReq) - if pme == nil { - return nil // should never happen... - } - defer release() - installedProgrammers := make(map[string]string) for _, board := range list.Boards { programmers, _ := upload.ListProgrammersAvailableForUpload(context.Background(), &rpc.ListProgrammersAvailableForUploadRequest{ @@ -203,19 +160,19 @@ func GetInstallableLibs() []string { return res } -// GetConnectedBoards is an helper function useful to autocomplete. -// It returns a list of boards which are currently connected -// Obviously it does not suggests network ports because of the timeout -func GetConnectedBoards() []string { +// GetAvailablePorts is an helper function useful to autocomplete. +// It returns a list of upload port of the boards which are currently connected. +// It will not suggests network ports because the timeout is not set. +func GetAvailablePorts() []*rpc.Port { inst := instance.CreateAndInit() list, _, _ := board.List(&rpc.BoardListRequest{ Instance: inst, }) - var res []string + var res []*rpc.Port // transform the data structure for the completion for _, i := range list { - res = append(res, i.Port.Address) + res = append(res, i.Port) } return res } diff --git a/internal/cli/arguments/port.go b/internal/cli/arguments/port.go index d94a8b8d406..14f5846d80d 100644 --- a/internal/cli/arguments/port.go +++ b/internal/cli/arguments/port.go @@ -16,12 +16,13 @@ package arguments import ( + "context" "fmt" "time" "github.com/arduino/arduino-cli/arduino" - "github.com/arduino/arduino-cli/commands" "github.com/arduino/arduino-cli/commands/board" + f "github.com/arduino/arduino-cli/internal/algorithms" "github.com/arduino/arduino-cli/internal/cli/feedback" rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" "github.com/sirupsen/logrus" @@ -41,11 +42,11 @@ type Port struct { func (p *Port) AddToCommand(cmd *cobra.Command) { cmd.Flags().StringVarP(&p.address, "port", "p", "", tr("Upload port address, e.g.: COM3 or /dev/ttyACM2")) cmd.RegisterFlagCompletionFunc("port", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetConnectedBoards(), cobra.ShellCompDirectiveDefault + return f.Map(GetAvailablePorts(), (*rpc.Port).GetAddress), cobra.ShellCompDirectiveDefault }) cmd.Flags().StringVarP(&p.protocol, "protocol", "l", "", tr("Upload port protocol, e.g: serial")) cmd.RegisterFlagCompletionFunc("protocol", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - return GetInstalledProtocols(), cobra.ShellCompDirectiveDefault + return f.Map(GetAvailablePorts(), (*rpc.Port).GetProtocol), cobra.ShellCompDirectiveDefault }) p.timeout.AddToCommand(cmd) } @@ -88,30 +89,23 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s } logrus.WithField("port", address).Tracef("Upload port") - // FIXME: We must not access PackageManager directly here but use one of the commands.* functions - pme, release := commands.GetPackageManagerExplorer(&rpc.BoardListAllRequest{Instance: instance}) - if pme == nil { - return nil, &arduino.InvalidInstanceError{} - } - defer release() - - dm := pme.DiscoveryManager() - watcher, err := dm.Watch() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + watcher, err := board.Watch(ctx, &rpc.BoardListWatchRequest{Instance: instance}) if err != nil { return nil, err } - defer watcher.Close() deadline := time.After(p.timeout.Get()) for { select { - case portEvent := <-watcher.Feed(): - if portEvent.Type != "add" { + case portEvent := <-watcher: + if portEvent.GetEventType() != "add" { continue } - port := portEvent.Port - if (protocol == "" || protocol == port.Protocol) && address == port.Address { - return port.ToRPC(), nil + port := portEvent.GetPort().GetPort() + if (protocol == "" || protocol == port.GetProtocol()) && address == port.GetAddress() { + return port, nil } case <-deadline: diff --git a/internal/integrationtest/completion/completion_test.go b/internal/integrationtest/completion/completion_test.go index 0fcdbc32913..75da997a357 100644 --- a/internal/integrationtest/completion/completion_test.go +++ b/internal/integrationtest/completion/completion_test.go @@ -216,16 +216,10 @@ func TestCoreCompletion(t *testing.T) { require.Contains(t, string(stdout), "arduino:avr:uno") stdout, _, _ = cli.Run("__complete", "monitor", "-b", "") require.Contains(t, string(stdout), "arduino:avr:uno") - stdout, _, _ = cli.Run("__complete", "burn-bootloader", "-l", "") - require.Contains(t, string(stdout), "network") - stdout, _, _ = cli.Run("__complete", "compile", "-l", "") - require.Contains(t, string(stdout), "network") - stdout, _, _ = cli.Run("__complete", "debug", "-l", "") - require.Contains(t, string(stdout), "network") - stdout, _, _ = cli.Run("__complete", "upload", "-l", "") - require.Contains(t, string(stdout), "network") - stdout, _, _ = cli.Run("__complete", "monitor", "-l", "") - require.Contains(t, string(stdout), "network") + + // -l/--protocol and -p/--port cannot be tested because there are + // no board connected. + stdout, _, _ = cli.Run("__complete", "burn-bootloader", "-P", "") require.Contains(t, string(stdout), "atmel_ice") stdout, _, _ = cli.Run("__complete", "compile", "-P", "") diff --git a/rpc/cc/arduino/cli/commands/v1/common.go b/rpc/cc/arduino/cli/commands/v1/common.go index 4e5917398e0..9ef27da3e58 100644 --- a/rpc/cc/arduino/cli/commands/v1/common.go +++ b/rpc/cc/arduino/cli/commands/v1/common.go @@ -56,9 +56,3 @@ func (d DownloadProgressCB) End(success bool, message string) { // TaskProgressCB is a callback to receive progress messages type TaskProgressCB func(msg *TaskProgress) - -// InstanceCommand is an interface that represents a gRPC command with -// a gRPC Instance. -type InstanceCommand interface { - GetInstance() *Instance -} From badc853993529a6bd5f44b4bf6981b1cf1a31900 Mon Sep 17 00:00:00 2001 From: MatteoPologruto Date: Wed, 20 Sep 2023 11:45:07 +0200 Subject: [PATCH 3/4] Get default port address and protocol from sketch profile --- internal/cli/monitor/monitor.go | 35 ++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/internal/cli/monitor/monitor.go b/internal/cli/monitor/monitor.go index b15cd5bb436..205225f1ad6 100644 --- a/internal/cli/monitor/monitor.go +++ b/internal/cli/monitor/monitor.go @@ -27,6 +27,7 @@ import ( "time" "github.com/arduino/arduino-cli/commands/monitor" + "github.com/arduino/arduino-cli/commands/sketch" "github.com/arduino/arduino-cli/configuration" "github.com/arduino/arduino-cli/i18n" "github.com/arduino/arduino-cli/internal/cli/arguments" @@ -45,13 +46,14 @@ var tr = i18n.Tr // NewCommand created a new `monitor` command func NewCommand() *cobra.Command { var ( - raw bool - portArgs arguments.Port - describe bool - configs []string - quiet bool - timestamp bool - fqbn arguments.Fqbn + raw bool + portArgs arguments.Port + describe bool + configs []string + quiet bool + timestamp bool + fqbn arguments.Fqbn + sketchPath string ) monitorCommand := &cobra.Command{ Use: "monitor", @@ -61,7 +63,7 @@ func NewCommand() *cobra.Command { " " + os.Args[0] + " monitor -p /dev/ttyACM0\n" + " " + os.Args[0] + " monitor -p /dev/ttyACM0 --describe", Run: func(cmd *cobra.Command, args []string) { - runMonitorCmd(&portArgs, &fqbn, configs, describe, timestamp, quiet, raw) + runMonitorCmd(&portArgs, &fqbn, configs, describe, timestamp, quiet, raw, sketchPath) }, } portArgs.AddToCommand(monitorCommand) @@ -70,12 +72,12 @@ func NewCommand() *cobra.Command { monitorCommand.Flags().StringSliceVarP(&configs, "config", "c", []string{}, tr("Configure communication port settings. The format is =[,=]...")) monitorCommand.Flags().BoolVarP(&quiet, "quiet", "q", false, tr("Run in silent mode, show only monitor input and output.")) monitorCommand.Flags().BoolVar(×tamp, "timestamp", false, tr("Timestamp each incoming line.")) + monitorCommand.Flags().StringVarP(&sketchPath, "sketch", "s", "", tr("Path to the sketch")) fqbn.AddToCommand(monitorCommand) - monitorCommand.MarkFlagRequired("port") return monitorCommand } -func runMonitorCmd(portArgs *arguments.Port, fqbn *arguments.Fqbn, configs []string, describe, timestamp, quiet, raw bool) { +func runMonitorCmd(portArgs *arguments.Port, fqbn *arguments.Fqbn, configs []string, describe, timestamp, quiet, raw bool, sketchPath string) { instance := instance.CreateAndInit() logrus.Info("Executing `arduino-cli monitor`") @@ -83,8 +85,17 @@ func runMonitorCmd(portArgs *arguments.Port, fqbn *arguments.Fqbn, configs []str quiet = true } - // TODO: Should use sketch default_port/protocol? - portAddress, portProtocol, err := portArgs.GetPortAddressAndProtocol(instance, "", "") + addressDefault := "" + protocolDefault := "" + if sketchPath != "" { + sketch, err := sketch.LoadSketch(context.Background(), &rpc.LoadSketchRequest{SketchPath: sketchPath}) + if err != nil { + feedback.FatalError(err, feedback.ErrGeneric) + } + addressDefault = sketch.GetDefaultPort() + protocolDefault = sketch.GetDefaultProtocol() + } + portAddress, portProtocol, err := portArgs.GetPortAddressAndProtocol(instance, addressDefault, protocolDefault) if err != nil { feedback.FatalError(err, feedback.ErrGeneric) } From 05346d3308ec795189a06c48e3d3faa3be97d7d3 Mon Sep 17 00:00:00 2001 From: Alessio Perugini Date: Wed, 18 Oct 2023 17:42:09 +0200 Subject: [PATCH 4/4] remove sketch flag --- internal/cli/monitor/monitor.go | 86 +++++++++++++++++++++++++-------- 1 file changed, 65 insertions(+), 21 deletions(-) diff --git a/internal/cli/monitor/monitor.go b/internal/cli/monitor/monitor.go index 205225f1ad6..2c69c192939 100644 --- a/internal/cli/monitor/monitor.go +++ b/internal/cli/monitor/monitor.go @@ -27,7 +27,7 @@ import ( "time" "github.com/arduino/arduino-cli/commands/monitor" - "github.com/arduino/arduino-cli/commands/sketch" + sk "github.com/arduino/arduino-cli/commands/sketch" "github.com/arduino/arduino-cli/configuration" "github.com/arduino/arduino-cli/i18n" "github.com/arduino/arduino-cli/internal/cli/arguments" @@ -46,14 +46,14 @@ var tr = i18n.Tr // NewCommand created a new `monitor` command func NewCommand() *cobra.Command { var ( - raw bool portArgs arguments.Port + fqbnArg arguments.Fqbn + profileArg arguments.Profile + raw bool describe bool configs []string quiet bool timestamp bool - fqbn arguments.Fqbn - sketchPath string ) monitorCommand := &cobra.Command{ Use: "monitor", @@ -63,47 +63,91 @@ func NewCommand() *cobra.Command { " " + os.Args[0] + " monitor -p /dev/ttyACM0\n" + " " + os.Args[0] + " monitor -p /dev/ttyACM0 --describe", Run: func(cmd *cobra.Command, args []string) { - runMonitorCmd(&portArgs, &fqbn, configs, describe, timestamp, quiet, raw, sketchPath) + sketchPath := "" + if len(args) > 0 { + sketchPath = args[0] + } + var portProvidedFromFlag bool + if p := cmd.Flags().Lookup("port"); p != nil && p.Changed { + portProvidedFromFlag = true + } + runMonitorCmd(&portArgs, &fqbnArg, &profileArg, sketchPath, configs, describe, timestamp, quiet, raw, portProvidedFromFlag) }, } portArgs.AddToCommand(monitorCommand) + profileArg.AddToCommand(monitorCommand) monitorCommand.Flags().BoolVar(&raw, "raw", false, tr("Set terminal in raw mode (unbuffered).")) monitorCommand.Flags().BoolVar(&describe, "describe", false, tr("Show all the settings of the communication port.")) monitorCommand.Flags().StringSliceVarP(&configs, "config", "c", []string{}, tr("Configure communication port settings. The format is =[,=]...")) monitorCommand.Flags().BoolVarP(&quiet, "quiet", "q", false, tr("Run in silent mode, show only monitor input and output.")) monitorCommand.Flags().BoolVar(×tamp, "timestamp", false, tr("Timestamp each incoming line.")) - monitorCommand.Flags().StringVarP(&sketchPath, "sketch", "s", "", tr("Path to the sketch")) - fqbn.AddToCommand(monitorCommand) + fqbnArg.AddToCommand(monitorCommand) return monitorCommand } -func runMonitorCmd(portArgs *arguments.Port, fqbn *arguments.Fqbn, configs []string, describe, timestamp, quiet, raw bool, sketchPath string) { - instance := instance.CreateAndInit() +func runMonitorCmd( + portArgs *arguments.Port, fqbnArg *arguments.Fqbn, profileArg *arguments.Profile, sketchPathArg string, + configs []string, describe, timestamp, quiet, raw bool, portProvidedFromFlag bool, +) { logrus.Info("Executing `arduino-cli monitor`") if !configuration.HasConsole { quiet = true } - addressDefault := "" - protocolDefault := "" - if sketchPath != "" { - sketch, err := sketch.LoadSketch(context.Background(), &rpc.LoadSketchRequest{SketchPath: sketchPath}) + var ( + inst *rpc.Instance + fqbn string + defaultPort, defaultProtocol string + ) + + if !portProvidedFromFlag { + sketchPath := arguments.InitSketchPath(sketchPathArg) + sketch, err := sk.LoadSketch(context.Background(), &rpc.LoadSketchRequest{SketchPath: sketchPath.String()}) if err != nil { - feedback.FatalError(err, feedback.ErrGeneric) + feedback.Fatal( + tr("Error getting default port from `sketch.yaml`. Check if you're in the correct sketch folder or provide the --port flag: %s", err), + feedback.ErrGeneric, + ) + } + defaultPort = sketch.GetDefaultPort() + defaultProtocol = sketch.GetDefaultProtocol() + + var profile *rpc.Profile + if profileArg.Get() == "" { + inst, profile = instance.CreateAndInitWithProfile(sketch.GetDefaultProfile().GetName(), sketchPath) + } else { + inst, profile = instance.CreateAndInitWithProfile(profileArg.Get(), sketchPath) + } + + // Priority on how to retrieve the fqbn + // 1. from flag + // 2. from profile + // 3. from default_fqbn specified in the sketch.yaml + // 4. try to detect from the port + switch { + case fqbnArg.String() != "": + fqbn = fqbnArg.String() + case profile.GetFqbn() != "": + fqbn = profile.GetFqbn() + case sketch.GetDefaultFqbn() != "": + fqbn = sketch.GetDefaultFqbn() + default: + fqbn, _ = portArgs.DetectFQBN(inst) } - addressDefault = sketch.GetDefaultPort() - protocolDefault = sketch.GetDefaultProtocol() + } else { + inst = instance.CreateAndInit() + fqbn = fqbnArg.String() } - portAddress, portProtocol, err := portArgs.GetPortAddressAndProtocol(instance, addressDefault, protocolDefault) + portAddress, portProtocol, err := portArgs.GetPortAddressAndProtocol(inst, defaultPort, defaultProtocol) if err != nil { feedback.FatalError(err, feedback.ErrGeneric) } enumerateResp, err := monitor.EnumerateMonitorPortSettings(context.Background(), &rpc.EnumerateMonitorPortSettingsRequest{ - Instance: instance, + Instance: inst, PortProtocol: portProtocol, - Fqbn: fqbn.String(), + Fqbn: fqbn, }) if err != nil { feedback.Fatal(tr("Error getting port settings details: %s", err), feedback.ErrGeneric) @@ -155,9 +199,9 @@ func runMonitorCmd(portArgs *arguments.Port, fqbn *arguments.Fqbn, configs []str } } portProxy, _, err := monitor.Monitor(context.Background(), &rpc.MonitorRequest{ - Instance: instance, + Instance: inst, Port: &rpc.Port{Address: portAddress, Protocol: portProtocol}, - Fqbn: fqbn.String(), + Fqbn: fqbn, PortConfiguration: configuration, }) if err != nil {