Unverified Commit c8059b5d authored by Silvano Cerza's avatar Silvano Cerza Committed by GitHub

[skip changelog] Update proto files build step (#1277)

* [skip changelog] Update proto files build step

* Added missing go.sum

* Update builders to 1.16.4

* Fixed crossbuild for Linux ARMv6/ARMv7

* Fixed macOS_64bit build
Co-authored-by: default avatarCristian Maglie <c.maglie@arduino.cc>
parent d4f31dfe
......@@ -25,11 +25,11 @@ jobs:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: "1.14"
go-version: "1.16"
- name: Installs Go dependencies
shell: bash
run: go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
run: go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.4.1
- name: Install protoc compiler
uses: arduino/setup-protoc@v1
......
......@@ -33,6 +33,7 @@ jobs:
go get golang.org/x/lint/golint
go get github.com/golang/protobuf/protoc-gen-go
go get github.com/cmaglie/go.rice/rice
go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
shell: bash
- name: Install Taskfile
......
......@@ -39,12 +39,12 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.14"
go-version: "1.16"
- name: Install Go dependencies
run: |
go version
go get -u github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v1.4.1
- name: Install protoc compiler
uses: arduino/setup-protoc@v1
......
......@@ -135,7 +135,7 @@ tasks:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_7"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/armv7"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
CONTAINER_TAG: "{{ .GO_VERSION }}-armhf"
PACKAGE_PLATFORM: "Linux_ARMv7"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
......@@ -157,7 +157,35 @@ tasks:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_linux_arm_6"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "linux/armv6"
CONTAINER_TAG: "{{ .GO_VERSION }}-arm"
# We are experiencing the following error with ARMv6 build:
#
# # github.com/arduino/arduino-cli
# net(.text): unexpected relocation type 296 (R_ARM_V4BX)
# panic: runtime error: invalid memory address or nil pointer dereference
# [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x51ae53]
#
# goroutine 1 [running]:
# cmd/link/internal/loader.(*Loader).SymName(0xc000095c00, 0x0, 0xc0000958d8, 0x5a0ac)
# /usr/local/go/src/cmd/link/internal/loader/loader.go:684 +0x53
# cmd/link/internal/ld.dynrelocsym2(0xc000095880, 0x5a0ac)
# /usr/local/go/src/cmd/link/internal/ld/data.go:777 +0x295
# cmd/link/internal/ld.(*dodataState).dynreloc2(0xc007df9800, 0xc000095880)
# /usr/local/go/src/cmd/link/internal/ld/data.go:794 +0x89
# cmd/link/internal/ld.(*Link).dodata2(0xc000095880, 0xc007d00000, 0x60518, 0x60518)
# /usr/local/go/src/cmd/link/internal/ld/data.go:1434 +0x4d4
# cmd/link/internal/ld.Main(0x8729a0, 0x4, 0x8, 0x1, 0xd, 0xe, 0x0, 0x0, 0x6d7737, 0x12, ...)
# /usr/local/go/src/cmd/link/internal/ld/main.go:302 +0x123a
# main.main()
# /usr/local/go/src/cmd/link/main.go:68 +0x1dc
# Error: failed building for linux/armv6: exit status 2
#
# This seems to be a problem in the go builder 1.16.x that removed support for the R_ARM_V4BX instruction:
# https://github.com/golang/go/pull/44998
# https://groups.google.com/g/golang-codereviews/c/yzN80xxwu2E
#
# Until there is a fix released we must use a recent gcc for Linux_ARMv6 build, so for this
# build we select the debian10 based container.
CONTAINER_TAG: "{{ .GO_VERSION }}-armel-debian10"
PACKAGE_PLATFORM: "Linux_ARMv6"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
......@@ -201,11 +229,24 @@ tasks:
PLATFORM_DIR: "{{ .PROJECT_NAME }}_osx_darwin_amd64"
BUILD_COMMAND: "go build -o {{ .DIST_DIR }}/{{ .PLATFORM_DIR }}/{{ .PROJECT_NAME }} {{ .LDFLAGS }}"
BUILD_PLATFORM: "darwin/amd64"
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin"
# We are experiencing the following error with macOS_64bit build:
#
# Undefined symbols for architecture x86_64:
# "_clock_gettime", referenced from:
# _runtime.walltime_trampoline in go.o
# ld: symbol(s) not found for architecture x86_64
# clang: error: linker command failed with exit code 1 (use -v to see invocation)
#
# The reason seems that go 1.16.x use a macos API which is available since 10.12
# https://github.com/techknowlogick/xgo/issues/100#issuecomment-780894190
#
# To compile it we need an SDK >=10.12 so we use the debian10 based container that
# has the SDK 10.14 installed.
CONTAINER_TAG: "{{ .GO_VERSION }}-darwin-debian10"
PACKAGE_PLATFORM: "macOS_64bit"
PACKAGE_NAME: "{{ .PROJECT_NAME }}_{{ .VERSION }}_{{ .PACKAGE_PLATFORM }}.tar.gz"
vars:
CONTAINER: "docker.elastic.co/beats-dev/golang-crossbuild"
GO_VERSION: "1.14.7"
GO_VERSION: "1.16.4"
CHECKSUM_FILE: "{{ .VERSION }}-checksums.txt"
......@@ -86,10 +86,10 @@ tasks:
protoc:compile:
desc: Compile protobuf definitions
cmds:
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/commands/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/monitor/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/settings/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=plugins=grpc,paths=source_relative:rpc ./rpc/cc/arduino/cli/debug/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/commands/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/monitor/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/settings/v1/*.proto'
- '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/debug/v1/*.proto'
protoc:docs:
desc: Generate docs for protobuf definitions
......
......@@ -34,6 +34,7 @@ import (
// ArduinoCoreServerImpl FIXMEDOC
type ArduinoCoreServerImpl struct {
rpc.UnimplementedArduinoCoreServiceServer
VersionString string
}
......
......@@ -26,7 +26,9 @@ import (
)
// DebugService implements the `Debug` service
type DebugService struct{}
type DebugService struct {
dbg.UnimplementedDebugServiceServer
}
// Debug returns a stream response that can be used to fetch data from the
// target. The first message passed through the `Debug` request must
......
......@@ -25,7 +25,9 @@ import (
)
// MonitorService implements the `Monitor` service
type MonitorService struct{}
type MonitorService struct {
rpc.UnimplementedMonitorServiceServer
}
// StreamingOpen returns a stream response that can be used to fetch data from the
// monitor target. The first message passed through the `StreamingOpenReq` must
......
......@@ -27,7 +27,9 @@ import (
)
// SettingsService implements the `Settings` service
type SettingsService struct{}
type SettingsService struct {
rpc.UnimplementedSettingsServiceServer
}
// GetAll returns a message with a string field containing all the settings
// currently in use, marshalled in JSON format.
......
This diff is collapsed.
......@@ -16,7 +16,7 @@ require (
github.com/fluxio/iohelpers v0.0.0-20160419043813-3a4dd67a94d2 // indirect
github.com/fluxio/multierror v0.0.0-20160419044231-9c68d39025e5 // indirect
github.com/gofrs/uuid v3.2.0+incompatible
github.com/golang/protobuf v1.4.2
github.com/golang/protobuf v1.5.2
github.com/h2non/filetype v1.0.8 // indirect
github.com/juju/loggo v0.0.0-20190526231331-6e530bcce5d8 // indirect
github.com/kr/text v0.2.0 // indirect
......@@ -38,16 +38,19 @@ require (
github.com/spf13/jwalterweatherman v1.0.0
github.com/spf13/viper v1.6.2
github.com/stretchr/testify v1.6.1
github.com/xanzy/ssh-agent v0.2.1 // indirect
go.bug.st/cleanup v1.0.0
go.bug.st/downloader/v2 v2.1.1
go.bug.st/relaxed-semver v0.0.0-20190922224835-391e10178d18
go.bug.st/serial v1.1.2
go.bug.st/serial.v1 v0.0.0-20180827123349-5f7892a7bb45 // indirect
golang.org/x/crypto v0.0.0-20200406173513-056763e48d71
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
golang.org/x/text v0.3.2
google.golang.org/grpc v1.27.0
google.golang.org/protobuf v1.25.0
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125
golang.org/x/sys v0.0.0-20210503173754-0981d6026fa6 // indirect
golang.org/x/text v0.3.6
google.golang.org/genproto v0.0.0-20210504143626-3b2ad6ccc450 // indirect
google.golang.org/grpc v1.37.0
google.golang.org/protobuf v1.26.0
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce // indirect
gopkg.in/src-d/go-git.v4 v4.13.1
gopkg.in/yaml.v2 v2.3.0
......
This diff is collapsed.
This diff is collapsed.
......@@ -22,11 +22,7 @@
package debug
import (
context "context"
v1 "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
......@@ -602,154 +598,3 @@ func file_cc_arduino_cli_debug_v1_debug_proto_init() {
file_cc_arduino_cli_debug_v1_debug_proto_goTypes = nil
file_cc_arduino_cli_debug_v1_debug_proto_depIdxs = nil
}
// Reference imports to suppress errors if they are not otherwise used.
var _ context.Context
var _ grpc.ClientConnInterface
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion6
// DebugServiceClient is the client API for DebugService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
type DebugServiceClient interface {
// Start a debug session and communicate with the debugger tool.
Debug(ctx context.Context, opts ...grpc.CallOption) (DebugService_DebugClient, error)
GetDebugConfig(ctx context.Context, in *DebugConfigRequest, opts ...grpc.CallOption) (*GetDebugConfigResponse, error)
}
type debugServiceClient struct {
cc grpc.ClientConnInterface
}
func NewDebugServiceClient(cc grpc.ClientConnInterface) DebugServiceClient {
return &debugServiceClient{cc}
}
func (c *debugServiceClient) Debug(ctx context.Context, opts ...grpc.CallOption) (DebugService_DebugClient, error) {
stream, err := c.cc.NewStream(ctx, &_DebugService_serviceDesc.Streams[0], "/cc.arduino.cli.debug.v1.DebugService/Debug", opts...)
if err != nil {
return nil, err
}
x := &debugServiceDebugClient{stream}
return x, nil
}
type DebugService_DebugClient interface {
Send(*DebugRequest) error
Recv() (*DebugResponse, error)
grpc.ClientStream
}
type debugServiceDebugClient struct {
grpc.ClientStream
}
func (x *debugServiceDebugClient) Send(m *DebugRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *debugServiceDebugClient) Recv() (*DebugResponse, error) {
m := new(DebugResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *debugServiceClient) GetDebugConfig(ctx context.Context, in *DebugConfigRequest, opts ...grpc.CallOption) (*GetDebugConfigResponse, error) {
out := new(GetDebugConfigResponse)
err := c.cc.Invoke(ctx, "/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DebugServiceServer is the server API for DebugService service.
type DebugServiceServer interface {
// Start a debug session and communicate with the debugger tool.
Debug(DebugService_DebugServer) error
GetDebugConfig(context.Context, *DebugConfigRequest) (*GetDebugConfigResponse, error)
}
// UnimplementedDebugServiceServer can be embedded to have forward compatible implementations.
type UnimplementedDebugServiceServer struct {
}
func (*UnimplementedDebugServiceServer) Debug(DebugService_DebugServer) error {
return status.Errorf(codes.Unimplemented, "method Debug not implemented")
}
func (*UnimplementedDebugServiceServer) GetDebugConfig(context.Context, *DebugConfigRequest) (*GetDebugConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDebugConfig not implemented")
}
func RegisterDebugServiceServer(s *grpc.Server, srv DebugServiceServer) {
s.RegisterService(&_DebugService_serviceDesc, srv)
}
func _DebugService_Debug_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(DebugServiceServer).Debug(&debugServiceDebugServer{stream})
}
type DebugService_DebugServer interface {
Send(*DebugResponse) error
Recv() (*DebugRequest, error)
grpc.ServerStream
}
type debugServiceDebugServer struct {
grpc.ServerStream
}
func (x *debugServiceDebugServer) Send(m *DebugResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *debugServiceDebugServer) Recv() (*DebugRequest, error) {
m := new(DebugRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _DebugService_GetDebugConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DebugConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DebugServiceServer).GetDebugConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DebugServiceServer).GetDebugConfig(ctx, req.(*DebugConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
var _DebugService_serviceDesc = grpc.ServiceDesc{
ServiceName: "cc.arduino.cli.debug.v1.DebugService",
HandlerType: (*DebugServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetDebugConfig",
Handler: _DebugService_GetDebugConfig_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Debug",
Handler: _DebugService_Debug_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "cc/arduino/cli/debug/v1/debug.proto",
}
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package debug
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// DebugServiceClient is the client API for DebugService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type DebugServiceClient interface {
// Start a debug session and communicate with the debugger tool.
Debug(ctx context.Context, opts ...grpc.CallOption) (DebugService_DebugClient, error)
GetDebugConfig(ctx context.Context, in *DebugConfigRequest, opts ...grpc.CallOption) (*GetDebugConfigResponse, error)
}
type debugServiceClient struct {
cc grpc.ClientConnInterface
}
func NewDebugServiceClient(cc grpc.ClientConnInterface) DebugServiceClient {
return &debugServiceClient{cc}
}
func (c *debugServiceClient) Debug(ctx context.Context, opts ...grpc.CallOption) (DebugService_DebugClient, error) {
stream, err := c.cc.NewStream(ctx, &DebugService_ServiceDesc.Streams[0], "/cc.arduino.cli.debug.v1.DebugService/Debug", opts...)
if err != nil {
return nil, err
}
x := &debugServiceDebugClient{stream}
return x, nil
}
type DebugService_DebugClient interface {
Send(*DebugRequest) error
Recv() (*DebugResponse, error)
grpc.ClientStream
}
type debugServiceDebugClient struct {
grpc.ClientStream
}
func (x *debugServiceDebugClient) Send(m *DebugRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *debugServiceDebugClient) Recv() (*DebugResponse, error) {
m := new(DebugResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *debugServiceClient) GetDebugConfig(ctx context.Context, in *DebugConfigRequest, opts ...grpc.CallOption) (*GetDebugConfigResponse, error) {
out := new(GetDebugConfigResponse)
err := c.cc.Invoke(ctx, "/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// DebugServiceServer is the server API for DebugService service.
// All implementations must embed UnimplementedDebugServiceServer
// for forward compatibility
type DebugServiceServer interface {
// Start a debug session and communicate with the debugger tool.
Debug(DebugService_DebugServer) error
GetDebugConfig(context.Context, *DebugConfigRequest) (*GetDebugConfigResponse, error)
mustEmbedUnimplementedDebugServiceServer()
}
// UnimplementedDebugServiceServer must be embedded to have forward compatible implementations.
type UnimplementedDebugServiceServer struct {
}
func (UnimplementedDebugServiceServer) Debug(DebugService_DebugServer) error {
return status.Errorf(codes.Unimplemented, "method Debug not implemented")
}
func (UnimplementedDebugServiceServer) GetDebugConfig(context.Context, *DebugConfigRequest) (*GetDebugConfigResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetDebugConfig not implemented")
}
func (UnimplementedDebugServiceServer) mustEmbedUnimplementedDebugServiceServer() {}
// UnsafeDebugServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DebugServiceServer will
// result in compilation errors.
type UnsafeDebugServiceServer interface {
mustEmbedUnimplementedDebugServiceServer()
}
func RegisterDebugServiceServer(s grpc.ServiceRegistrar, srv DebugServiceServer) {
s.RegisterService(&DebugService_ServiceDesc, srv)
}
func _DebugService_Debug_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(DebugServiceServer).Debug(&debugServiceDebugServer{stream})
}
type DebugService_DebugServer interface {
Send(*DebugResponse) error
Recv() (*DebugRequest, error)
grpc.ServerStream
}
type debugServiceDebugServer struct {
grpc.ServerStream
}
func (x *debugServiceDebugServer) Send(m *DebugResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *debugServiceDebugServer) Recv() (*DebugRequest, error) {
m := new(DebugRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func _DebugService_GetDebugConfig_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DebugConfigRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(DebugServiceServer).GetDebugConfig(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/cc.arduino.cli.debug.v1.DebugService/GetDebugConfig",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(DebugServiceServer).GetDebugConfig(ctx, req.(*DebugConfigRequest))
}
return interceptor(ctx, in, info, handler)
}
// DebugService_ServiceDesc is the grpc.ServiceDesc for DebugService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var DebugService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "cc.arduino.cli.debug.v1.DebugService",
HandlerType: (*DebugServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetDebugConfig",
Handler: _DebugService_GetDebugConfig_Handler,
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "Debug",
Handler: _DebugService_Debug_Handler,
ServerStreams: true,
ClientStreams: true,
},
},
Metadata: "cc/arduino/cli/debug/v1/debug.proto",
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment