From cee40b3e067764ba2b978f01515342ed80acac3c Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Mon, 13 Feb 2023 18:11:05 +0100 Subject: [PATCH 01/13] WIP, auto-select with hardwareId --- .../browser/boards/boards-service-provider.ts | 63 ++++++++++++------- .../src/common/protocol/boards-service.ts | 17 +++++ .../src/node/board-discovery.ts | 4 +- 3 files changed, 61 insertions(+), 23 deletions(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 65842eca3..b04baea1c 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -158,15 +158,9 @@ export class BoardsServiceProvider this.lastAvailablePortsOnUpload = undefined; } - private portToAutoSelectCanBeDerived(): boolean { - return Boolean( - this.lastBoardsConfigOnUpload && this.lastAvailablePortsOnUpload - ); - } - attemptPostUploadAutoSelect(): void { setTimeout(() => { - if (this.portToAutoSelectCanBeDerived()) { + if (this.lastBoardsConfigOnUpload && this.lastAvailablePortsOnUpload) { this.attemptAutoSelect({ ports: this._availablePorts, boards: this._availableBoards, @@ -185,12 +179,12 @@ export class BoardsServiceProvider private deriveBoardConfigToAutoSelect( newState: AttachedBoardsChangeEvent['newState'] ): void { - if (!this.portToAutoSelectCanBeDerived()) { + if (!this.lastBoardsConfigOnUpload || !this.lastAvailablePortsOnUpload) { this.boardConfigToAutoSelect = undefined; return; } - const oldPorts = this.lastAvailablePortsOnUpload!; + const oldPorts = this.lastAvailablePortsOnUpload; const { ports: newPorts, boards: newBoards } = newState; const appearedPorts = @@ -205,20 +199,36 @@ export class BoardsServiceProvider Port.sameAs(board.port, port) ); - const lastBoardsConfigOnUpload = this.lastBoardsConfigOnUpload!; + const lastBoardsConfigOnUpload = this.lastBoardsConfigOnUpload; - if ( - boardOnAppearedPort && - lastBoardsConfigOnUpload.selectedBoard && - Board.sameAs( + if (boardOnAppearedPort && lastBoardsConfigOnUpload.selectedBoard) { + const boardIsSameHardware = Board.sameDistinctHardwareAs( boardOnAppearedPort, lastBoardsConfigOnUpload.selectedBoard - ) - ) { + ); + + const boardIsSameFqbn = Board.sameAs( + boardOnAppearedPort, + lastBoardsConfigOnUpload.selectedBoard + ); + + if (!boardIsSameHardware && !boardIsSameFqbn) return; + + let boardToAutoSelect = boardOnAppearedPort; + if (boardIsSameHardware && !boardIsSameFqbn) { + const { name, fqbn } = lastBoardsConfigOnUpload.selectedBoard; + + boardToAutoSelect = { + ...boardToAutoSelect, + name, + fqbn, + }; + } + this.clearBoardDiscoverySnapshot(); this.boardConfigToAutoSelect = { - selectedBoard: boardOnAppearedPort, + selectedBoard: boardToAutoSelect, selectedPort: port, }; return; @@ -326,8 +336,10 @@ export class BoardsServiceProvider // it is just a FQBN, so we need to find the `selected` board among the `AvailableBoards` const selectedAvailableBoard = AvailableBoard.is(selectedBoard) ? selectedBoard - : this._availableBoards.find((availableBoard) => - Board.sameAs(availableBoard, selectedBoard) + : this._availableBoards.find( + (availableBoard) => + Board.sameDistinctHardwareAs(availableBoard, selectedBoard) || + Board.sameAs(availableBoard, selectedBoard) ); if ( selectedAvailableBoard && @@ -353,24 +365,33 @@ export class BoardsServiceProvider protected tryReconnect(): boolean { if (this.latestValidBoardsConfig && !this.canUploadTo(this.boardsConfig)) { + // ** Reconnect to a board unplugged from, and plugged back into the same port for (const board of this.availableBoards.filter( ({ state }) => state !== AvailableBoard.State.incomplete )) { if ( - this.latestValidBoardsConfig.selectedBoard.fqbn === board.fqbn && - this.latestValidBoardsConfig.selectedBoard.name === board.name && + (Board.sameDistinctHardwareAs( + this.latestValidBoardsConfig.selectedBoard, + board + ) || + (this.latestValidBoardsConfig.selectedBoard.fqbn === board.fqbn && + this.latestValidBoardsConfig.selectedBoard.name === + board.name)) && Port.sameAs(this.latestValidBoardsConfig.selectedPort, board.port) ) { this.boardsConfig = this.latestValidBoardsConfig; return true; } } + // ** + // ** Reconnect to a board whose port changed due to an upload if (!this.boardConfigToAutoSelect) return false; this.boardsConfig = this.boardConfigToAutoSelect; this.boardConfigToAutoSelect = undefined; return true; + // ** } return false; } diff --git a/arduino-ide-extension/src/common/protocol/boards-service.ts b/arduino-ide-extension/src/common/protocol/boards-service.ts index cbb057028..8ab290807 100644 --- a/arduino-ide-extension/src/common/protocol/boards-service.ts +++ b/arduino-ide-extension/src/common/protocol/boards-service.ts @@ -245,6 +245,7 @@ export interface Port { readonly protocol: string; readonly protocolLabel: string; readonly properties?: Record; + readonly hardwareId?: string; } export namespace Port { export type Properties = Record; @@ -553,6 +554,22 @@ export namespace Board { return left.name === right.name && left.fqbn === right.fqbn; } + export function sameDistinctHardwareAs( + left: Board, + right: string | Board + ): boolean { + if (Board.is(right) && left.port && right.port) { + const { hardwareId: leftHardwareId } = left.port; + const { hardwareId: rightHardwareId } = right.port; + + if (leftHardwareId && rightHardwareId) { + return leftHardwareId === rightHardwareId; + } + } + + return false; + } + export function sameAs(left: Board, right: string | Board): boolean { // How to associate a selected board with one of the available cores: https://typefox.slack.com/archives/CJJHJCJSJ/p1571142327059200 // 1. How to use the FQBN if any and infer the package ID from it: https://typefox.slack.com/archives/CJJHJCJSJ/p1571147549069100 diff --git a/arduino-ide-extension/src/node/board-discovery.ts b/arduino-ide-extension/src/node/board-discovery.ts index bce8a36d0..a763782d2 100644 --- a/arduino-ide-extension/src/node/board-discovery.ts +++ b/arduino-ide-extension/src/node/board-discovery.ts @@ -323,14 +323,14 @@ export class BoardDiscovery } private fromRpcPort(rpcPort: RpcPort): Port { - const port = { + return { address: rpcPort.getAddress(), addressLabel: rpcPort.getLabel(), protocol: rpcPort.getProtocol(), protocolLabel: rpcPort.getProtocolLabel(), properties: Port.Properties.create(rpcPort.getPropertiesMap().toObject()), + hardwareId: rpcPort.getHardwareId(), // method to be confirmed }; - return port; } } From 08203d880dac7bddfff404f7b1300699c62a45bb Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 10:34:41 +0100 Subject: [PATCH 02/13] pin master, update protocols --- arduino-ide-extension/package.json | 6 +- .../src/node/board-discovery.ts | 2 +- .../cc/arduino/cli/commands/v1/board_pb.d.ts | 64 +-- .../cc/arduino/cli/commands/v1/board_pb.js | 468 ++---------------- .../cli/commands/v1/commands_grpc_pb.d.ts | 15 - .../cli/commands/v1/commands_grpc_pb.js | 37 -- .../arduino/cli/commands/v1/commands_pb.d.ts | 8 + .../cc/arduino/cli/commands/v1/commands_pb.js | 64 ++- .../cc/arduino/cli/commands/v1/common_pb.d.ts | 28 ++ .../cc/arduino/cli/commands/v1/common_pb.js | 205 +++++++- .../arduino/cli/commands/v1/compile_pb.d.ts | 6 + .../cc/arduino/cli/commands/v1/compile_pb.js | 53 +- .../cc/arduino/cli/commands/v1/port_pb.d.ts | 4 + .../cc/arduino/cli/commands/v1/port_pb.js | 32 +- 14 files changed, 435 insertions(+), 557 deletions(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index 624f96027..291a78da8 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -161,7 +161,11 @@ ], "arduino": { "cli": { - "version": "0.29.0" + "version": { + "owner": "arduino", + "repo": "arduino-cli", + "commitish": "master" + } }, "fwuploader": { "version": "2.2.2" diff --git a/arduino-ide-extension/src/node/board-discovery.ts b/arduino-ide-extension/src/node/board-discovery.ts index a763782d2..8699b7232 100644 --- a/arduino-ide-extension/src/node/board-discovery.ts +++ b/arduino-ide-extension/src/node/board-discovery.ts @@ -329,7 +329,7 @@ export class BoardDiscovery protocol: rpcPort.getProtocol(), protocolLabel: rpcPort.getProtocolLabel(), properties: Port.Properties.create(rpcPort.getPropertiesMap().toObject()), - hardwareId: rpcPort.getHardwareId(), // method to be confirmed + hardwareId: rpcPort.getHardwareId(), }; } } diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.d.ts index 8b39c5085..8fed14afe 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.d.ts @@ -388,66 +388,6 @@ export namespace ConfigValue { } } -export class BoardAttachRequest extends jspb.Message { - - hasInstance(): boolean; - clearInstance(): void; - getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined; - setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): BoardAttachRequest; - - getBoardUri(): string; - setBoardUri(value: string): BoardAttachRequest; - - getSketchPath(): string; - setSketchPath(value: string): BoardAttachRequest; - - getSearchTimeout(): string; - setSearchTimeout(value: string): BoardAttachRequest; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BoardAttachRequest.AsObject; - static toObject(includeInstance: boolean, msg: BoardAttachRequest): BoardAttachRequest.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: BoardAttachRequest, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BoardAttachRequest; - static deserializeBinaryFromReader(message: BoardAttachRequest, reader: jspb.BinaryReader): BoardAttachRequest; -} - -export namespace BoardAttachRequest { - export type AsObject = { - instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject, - boardUri: string, - sketchPath: string, - searchTimeout: string, - } -} - -export class BoardAttachResponse extends jspb.Message { - - hasTaskProgress(): boolean; - clearTaskProgress(): void; - getTaskProgress(): cc_arduino_cli_commands_v1_common_pb.TaskProgress | undefined; - setTaskProgress(value?: cc_arduino_cli_commands_v1_common_pb.TaskProgress): BoardAttachResponse; - - - serializeBinary(): Uint8Array; - toObject(includeInstance?: boolean): BoardAttachResponse.AsObject; - static toObject(includeInstance: boolean, msg: BoardAttachResponse): BoardAttachResponse.AsObject; - static extensions: {[key: number]: jspb.ExtensionFieldInfo}; - static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; - static serializeBinaryToWriter(message: BoardAttachResponse, writer: jspb.BinaryWriter): void; - static deserializeBinary(bytes: Uint8Array): BoardAttachResponse; - static deserializeBinaryFromReader(message: BoardAttachResponse, reader: jspb.BinaryReader): BoardAttachResponse; -} - -export namespace BoardAttachResponse { - export type AsObject = { - taskProgress?: cc_arduino_cli_commands_v1_common_pb.TaskProgress.AsObject, - } -} - export class BoardListRequest extends jspb.Message { hasInstance(): boolean; @@ -458,6 +398,9 @@ export class BoardListRequest extends jspb.Message { getTimeout(): number; setTimeout(value: number): BoardListRequest; + getFqbn(): string; + setFqbn(value: string): BoardListRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): BoardListRequest.AsObject; @@ -473,6 +416,7 @@ export namespace BoardListRequest { export type AsObject = { instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject, timeout: number, + fqbn: string, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.js index 3753037cb..83a3002b6 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.js @@ -19,8 +19,6 @@ var cc_arduino_cli_commands_v1_common_pb = require('../../../../../cc/arduino/cl goog.object.extend(proto, cc_arduino_cli_commands_v1_common_pb); var cc_arduino_cli_commands_v1_port_pb = require('../../../../../cc/arduino/cli/commands/v1/port_pb.js'); goog.object.extend(proto, cc_arduino_cli_commands_v1_port_pb); -goog.exportSymbol('proto.cc.arduino.cli.commands.v1.BoardAttachRequest', null, global); -goog.exportSymbol('proto.cc.arduino.cli.commands.v1.BoardAttachResponse', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.BoardDetailsRequest', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.BoardDetailsResponse', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties', null, global); @@ -251,48 +249,6 @@ if (goog.DEBUG && !COMPILED) { */ proto.cc.arduino.cli.commands.v1.ConfigValue.displayName = 'proto.cc.arduino.cli.commands.v1.ConfigValue'; } -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.cc.arduino.cli.commands.v1.BoardAttachRequest, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.cc.arduino.cli.commands.v1.BoardAttachRequest.displayName = 'proto.cc.arduino.cli.commands.v1.BoardAttachRequest'; -} -/** - * Generated by JsPbCodeGenerator. - * @param {Array=} opt_data Optional initial data array, typically from a - * server response, or constructed directly in Javascript. The array is used - * in place and becomes part of the constructed object. It is not cloned. - * If no data is provided, the constructed object will be empty, but still - * valid. - * @extends {jspb.Message} - * @constructor - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse = function(opt_data) { - jspb.Message.initialize(this, opt_data, 0, -1, null, null); -}; -goog.inherits(proto.cc.arduino.cli.commands.v1.BoardAttachResponse, jspb.Message); -if (goog.DEBUG && !COMPILED) { - /** - * @public - * @override - */ - proto.cc.arduino.cli.commands.v1.BoardAttachResponse.displayName = 'proto.cc.arduino.cli.commands.v1.BoardAttachResponse'; -} /** * Generated by JsPbCodeGenerator. * @param {Array=} opt_data Optional initial data array, typically from a @@ -3132,398 +3088,6 @@ proto.cc.arduino.cli.commands.v1.ConfigValue.prototype.setSelected = function(va -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.toObject = function(opt_includeInstance) { - return proto.cc.arduino.cli.commands.v1.BoardAttachRequest.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.toObject = function(includeInstance, msg) { - var f, obj = { - instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f), - boardUri: jspb.Message.getFieldWithDefault(msg, 2, ""), - sketchPath: jspb.Message.getFieldWithDefault(msg, 3, ""), - searchTimeout: jspb.Message.getFieldWithDefault(msg, 4, "") - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.cc.arduino.cli.commands.v1.BoardAttachRequest; - return proto.cc.arduino.cli.commands.v1.BoardAttachRequest.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new cc_arduino_cli_commands_v1_common_pb.Instance; - reader.readMessage(value,cc_arduino_cli_commands_v1_common_pb.Instance.deserializeBinaryFromReader); - msg.setInstance(value); - break; - case 2: - var value = /** @type {string} */ (reader.readString()); - msg.setBoardUri(value); - break; - case 3: - var value = /** @type {string} */ (reader.readString()); - msg.setSketchPath(value); - break; - case 4: - var value = /** @type {string} */ (reader.readString()); - msg.setSearchTimeout(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.cc.arduino.cli.commands.v1.BoardAttachRequest.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getInstance(); - if (f != null) { - writer.writeMessage( - 1, - f, - cc_arduino_cli_commands_v1_common_pb.Instance.serializeBinaryToWriter - ); - } - f = message.getBoardUri(); - if (f.length > 0) { - writer.writeString( - 2, - f - ); - } - f = message.getSketchPath(); - if (f.length > 0) { - writer.writeString( - 3, - f - ); - } - f = message.getSearchTimeout(); - if (f.length > 0) { - writer.writeString( - 4, - f - ); - } -}; - - -/** - * optional Instance instance = 1; - * @return {?proto.cc.arduino.cli.commands.v1.Instance} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.getInstance = function() { - return /** @type{?proto.cc.arduino.cli.commands.v1.Instance} */ ( - jspb.Message.getWrapperField(this, cc_arduino_cli_commands_v1_common_pb.Instance, 1)); -}; - - -/** - * @param {?proto.cc.arduino.cli.commands.v1.Instance|undefined} value - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} returns this -*/ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.setInstance = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} returns this - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.clearInstance = function() { - return this.setInstance(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.hasInstance = function() { - return jspb.Message.getField(this, 1) != null; -}; - - -/** - * optional string board_uri = 2; - * @return {string} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.getBoardUri = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, "")); -}; - - -/** - * @param {string} value - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} returns this - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.setBoardUri = function(value) { - return jspb.Message.setProto3StringField(this, 2, value); -}; - - -/** - * optional string sketch_path = 3; - * @return {string} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.getSketchPath = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); -}; - - -/** - * @param {string} value - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} returns this - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.setSketchPath = function(value) { - return jspb.Message.setProto3StringField(this, 3, value); -}; - - -/** - * optional string search_timeout = 4; - * @return {string} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.getSearchTimeout = function() { - return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, "")); -}; - - -/** - * @param {string} value - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachRequest} returns this - */ -proto.cc.arduino.cli.commands.v1.BoardAttachRequest.prototype.setSearchTimeout = function(value) { - return jspb.Message.setProto3StringField(this, 4, value); -}; - - - - - -if (jspb.Message.GENERATE_TO_OBJECT) { -/** - * Creates an object representation of this proto. - * Field names that are reserved in JavaScript and will be renamed to pb_name. - * Optional fields that are not set will be set to undefined. - * To access a reserved field use, foo.pb_, eg, foo.pb_default. - * For the list of reserved names please see: - * net/proto2/compiler/js/internal/generator.cc#kKeyword. - * @param {boolean=} opt_includeInstance Deprecated. whether to include the - * JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @return {!Object} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.toObject = function(opt_includeInstance) { - return proto.cc.arduino.cli.commands.v1.BoardAttachResponse.toObject(opt_includeInstance, this); -}; - - -/** - * Static version of the {@see toObject} method. - * @param {boolean|undefined} includeInstance Deprecated. Whether to include - * the JSPB instance for transitional soy proto support: - * http://goto/soy-param-migration - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} msg The msg instance to transform. - * @return {!Object} - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.toObject = function(includeInstance, msg) { - var f, obj = { - taskProgress: (f = msg.getTaskProgress()) && cc_arduino_cli_commands_v1_common_pb.TaskProgress.toObject(includeInstance, f) - }; - - if (includeInstance) { - obj.$jspbMessageInstance = msg; - } - return obj; -}; -} - - -/** - * Deserializes binary data (in protobuf wire format). - * @param {jspb.ByteSource} bytes The bytes to deserialize. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.deserializeBinary = function(bytes) { - var reader = new jspb.BinaryReader(bytes); - var msg = new proto.cc.arduino.cli.commands.v1.BoardAttachResponse; - return proto.cc.arduino.cli.commands.v1.BoardAttachResponse.deserializeBinaryFromReader(msg, reader); -}; - - -/** - * Deserializes binary data (in protobuf wire format) from the - * given reader into the given message object. - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} msg The message object to deserialize into. - * @param {!jspb.BinaryReader} reader The BinaryReader to use. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.deserializeBinaryFromReader = function(msg, reader) { - while (reader.nextField()) { - if (reader.isEndGroup()) { - break; - } - var field = reader.getFieldNumber(); - switch (field) { - case 1: - var value = new cc_arduino_cli_commands_v1_common_pb.TaskProgress; - reader.readMessage(value,cc_arduino_cli_commands_v1_common_pb.TaskProgress.deserializeBinaryFromReader); - msg.setTaskProgress(value); - break; - default: - reader.skipField(); - break; - } - } - return msg; -}; - - -/** - * Serializes the message to binary data (in protobuf wire format). - * @return {!Uint8Array} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.serializeBinary = function() { - var writer = new jspb.BinaryWriter(); - proto.cc.arduino.cli.commands.v1.BoardAttachResponse.serializeBinaryToWriter(this, writer); - return writer.getResultBuffer(); -}; - - -/** - * Serializes the given message to binary data (in protobuf wire - * format), writing to the given BinaryWriter. - * @param {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} message - * @param {!jspb.BinaryWriter} writer - * @suppress {unusedLocalVariables} f is only used for nested messages - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.serializeBinaryToWriter = function(message, writer) { - var f = undefined; - f = message.getTaskProgress(); - if (f != null) { - writer.writeMessage( - 1, - f, - cc_arduino_cli_commands_v1_common_pb.TaskProgress.serializeBinaryToWriter - ); - } -}; - - -/** - * optional TaskProgress task_progress = 1; - * @return {?proto.cc.arduino.cli.commands.v1.TaskProgress} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.getTaskProgress = function() { - return /** @type{?proto.cc.arduino.cli.commands.v1.TaskProgress} */ ( - jspb.Message.getWrapperField(this, cc_arduino_cli_commands_v1_common_pb.TaskProgress, 1)); -}; - - -/** - * @param {?proto.cc.arduino.cli.commands.v1.TaskProgress|undefined} value - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} returns this -*/ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.setTaskProgress = function(value) { - return jspb.Message.setWrapperField(this, 1, value); -}; - - -/** - * Clears the message field making it undefined. - * @return {!proto.cc.arduino.cli.commands.v1.BoardAttachResponse} returns this - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.clearTaskProgress = function() { - return this.setTaskProgress(undefined); -}; - - -/** - * Returns whether this field is set. - * @return {boolean} - */ -proto.cc.arduino.cli.commands.v1.BoardAttachResponse.prototype.hasTaskProgress = function() { - return jspb.Message.getField(this, 1) != null; -}; - - - - - if (jspb.Message.GENERATE_TO_OBJECT) { /** * Creates an object representation of this proto. @@ -3554,7 +3118,8 @@ proto.cc.arduino.cli.commands.v1.BoardListRequest.prototype.toObject = function( proto.cc.arduino.cli.commands.v1.BoardListRequest.toObject = function(includeInstance, msg) { var f, obj = { instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f), - timeout: jspb.Message.getFieldWithDefault(msg, 2, 0) + timeout: jspb.Message.getFieldWithDefault(msg, 2, 0), + fqbn: jspb.Message.getFieldWithDefault(msg, 3, "") }; if (includeInstance) { @@ -3600,6 +3165,10 @@ proto.cc.arduino.cli.commands.v1.BoardListRequest.deserializeBinaryFromReader = var value = /** @type {number} */ (reader.readInt64()); msg.setTimeout(value); break; + case 3: + var value = /** @type {string} */ (reader.readString()); + msg.setFqbn(value); + break; default: reader.skipField(); break; @@ -3644,6 +3213,13 @@ proto.cc.arduino.cli.commands.v1.BoardListRequest.serializeBinaryToWriter = func f ); } + f = message.getFqbn(); + if (f.length > 0) { + writer.writeString( + 3, + f + ); + } }; @@ -3702,6 +3278,24 @@ proto.cc.arduino.cli.commands.v1.BoardListRequest.prototype.setTimeout = functio }; +/** + * optional string fqbn = 3; + * @return {string} + */ +proto.cc.arduino.cli.commands.v1.BoardListRequest.prototype.getFqbn = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.v1.BoardListRequest} returns this + */ +proto.cc.arduino.cli.commands.v1.BoardListRequest.prototype.setFqbn = function(value) { + return jspb.Message.setProto3StringField(this, 3, value); +}; + + /** * List of repeated fields within this message type. diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.d.ts index f4adeb149..b321b3c23 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.d.ts @@ -27,7 +27,6 @@ interface IArduinoCoreServiceService extends grpc.ServiceDefinition; responseDeserialize: grpc.deserialize; } -interface IArduinoCoreServiceService_IBoardAttach extends grpc.MethodDefinition { - path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardAttach"; - requestStream: false; - responseStream: true; - requestSerialize: grpc.serialize; - requestDeserialize: grpc.deserialize; - responseSerialize: grpc.serialize; - responseDeserialize: grpc.deserialize; -} interface IArduinoCoreServiceService_IBoardList extends grpc.MethodDefinition { path: "/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardList"; requestStream: false; @@ -423,7 +413,6 @@ export interface IArduinoCoreServiceServer { loadSketch: grpc.handleUnaryCall; archiveSketch: grpc.handleUnaryCall; boardDetails: grpc.handleUnaryCall; - boardAttach: grpc.handleServerStreamingCall; boardList: grpc.handleUnaryCall; boardListAll: grpc.handleUnaryCall; boardSearch: grpc.handleUnaryCall; @@ -482,8 +471,6 @@ export interface IArduinoCoreServiceClient { boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; - boardAttach(request: cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest, options?: Partial): grpc.ClientReadableStream; - boardAttach(request: cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; @@ -584,8 +571,6 @@ export class ArduinoCoreServiceClient extends grpc.Client implements IArduinoCor public boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; public boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; public boardDetails(request: cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardDetailsResponse) => void): grpc.ClientUnaryCall; - public boardAttach(request: cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest, options?: Partial): grpc.ClientReadableStream; - public boardAttach(request: cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest, metadata?: grpc.Metadata, options?: Partial): grpc.ClientReadableStream; public boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; public boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; public boardList(request: cc_arduino_cli_commands_v1_board_pb.BoardListRequest, metadata: grpc.Metadata, options: Partial, callback: (error: grpc.ServiceError | null, response: cc_arduino_cli_commands_v1_board_pb.BoardListResponse) => void): grpc.ClientUnaryCall; diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js index 1e4a70058..49ec3d019 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js @@ -49,28 +49,6 @@ function deserialize_cc_arduino_cli_commands_v1_ArchiveSketchResponse(buffer_arg return cc_arduino_cli_commands_v1_commands_pb.ArchiveSketchResponse.deserializeBinary(new Uint8Array(buffer_arg)); } -function serialize_cc_arduino_cli_commands_v1_BoardAttachRequest(arg) { - if (!(arg instanceof cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest)) { - throw new Error('Expected argument of type cc.arduino.cli.commands.v1.BoardAttachRequest'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_cc_arduino_cli_commands_v1_BoardAttachRequest(buffer_arg) { - return cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest.deserializeBinary(new Uint8Array(buffer_arg)); -} - -function serialize_cc_arduino_cli_commands_v1_BoardAttachResponse(arg) { - if (!(arg instanceof cc_arduino_cli_commands_v1_board_pb.BoardAttachResponse)) { - throw new Error('Expected argument of type cc.arduino.cli.commands.v1.BoardAttachResponse'); - } - return Buffer.from(arg.serializeBinary()); -} - -function deserialize_cc_arduino_cli_commands_v1_BoardAttachResponse(buffer_arg) { - return cc_arduino_cli_commands_v1_board_pb.BoardAttachResponse.deserializeBinary(new Uint8Array(buffer_arg)); -} - function serialize_cc_arduino_cli_commands_v1_BoardDetailsRequest(arg) { if (!(arg instanceof cc_arduino_cli_commands_v1_board_pb.BoardDetailsRequest)) { throw new Error('Expected argument of type cc.arduino.cli.commands.v1.BoardDetailsRequest'); @@ -1012,19 +990,6 @@ boardDetails: { responseSerialize: serialize_cc_arduino_cli_commands_v1_BoardDetailsResponse, responseDeserialize: deserialize_cc_arduino_cli_commands_v1_BoardDetailsResponse, }, - // Attach a board to a sketch. When the `fqbn` field of a request is not -// provided, the FQBN of the attached board will be used. -boardAttach: { - path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardAttach', - requestStream: false, - responseStream: true, - requestType: cc_arduino_cli_commands_v1_board_pb.BoardAttachRequest, - responseType: cc_arduino_cli_commands_v1_board_pb.BoardAttachResponse, - requestSerialize: serialize_cc_arduino_cli_commands_v1_BoardAttachRequest, - requestDeserialize: deserialize_cc_arduino_cli_commands_v1_BoardAttachRequest, - responseSerialize: serialize_cc_arduino_cli_commands_v1_BoardAttachResponse, - responseDeserialize: deserialize_cc_arduino_cli_commands_v1_BoardAttachResponse, - }, // List the boards currently connected to the computer. boardList: { path: '/cc.arduino.cli.commands.v1.ArduinoCoreService/BoardList', @@ -1368,5 +1333,3 @@ enumerateMonitorPortSettings: { }, }; -// BOOTSTRAP COMMANDS -// ------------------- diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts index 471a774ca..ecfeeb4ff 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.d.ts @@ -364,6 +364,9 @@ export class NewSketchRequest extends jspb.Message { getSketchDir(): string; setSketchDir(value: string): NewSketchRequest; + getOverwrite(): boolean; + setOverwrite(value: boolean): NewSketchRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): NewSketchRequest.AsObject; @@ -380,6 +383,7 @@ export namespace NewSketchRequest { instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject, sketchName: string, sketchDir: string, + overwrite: boolean, } } @@ -485,6 +489,9 @@ export class ArchiveSketchRequest extends jspb.Message { getIncludeBuildDir(): boolean; setIncludeBuildDir(value: boolean): ArchiveSketchRequest; + getOverwrite(): boolean; + setOverwrite(value: boolean): ArchiveSketchRequest; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): ArchiveSketchRequest.AsObject; @@ -501,6 +508,7 @@ export namespace ArchiveSketchRequest { sketchPath: string, archivePath: string, includeBuildDir: boolean, + overwrite: boolean, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js index 51ae173e3..9d688b4f4 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_pb.js @@ -2546,7 +2546,8 @@ proto.cc.arduino.cli.commands.v1.NewSketchRequest.toObject = function(includeIns var f, obj = { instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f), sketchName: jspb.Message.getFieldWithDefault(msg, 2, ""), - sketchDir: jspb.Message.getFieldWithDefault(msg, 3, "") + sketchDir: jspb.Message.getFieldWithDefault(msg, 3, ""), + overwrite: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -2596,6 +2597,10 @@ proto.cc.arduino.cli.commands.v1.NewSketchRequest.deserializeBinaryFromReader = var value = /** @type {string} */ (reader.readString()); msg.setSketchDir(value); break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOverwrite(value); + break; default: reader.skipField(); break; @@ -2647,6 +2652,13 @@ proto.cc.arduino.cli.commands.v1.NewSketchRequest.serializeBinaryToWriter = func f ); } + f = message.getOverwrite(); + if (f) { + writer.writeBool( + 4, + f + ); + } }; @@ -2723,6 +2735,24 @@ proto.cc.arduino.cli.commands.v1.NewSketchRequest.prototype.setSketchDir = funct }; +/** + * optional bool overwrite = 4; + * @return {boolean} + */ +proto.cc.arduino.cli.commands.v1.NewSketchRequest.prototype.getOverwrite = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.cc.arduino.cli.commands.v1.NewSketchRequest} returns this + */ +proto.cc.arduino.cli.commands.v1.NewSketchRequest.prototype.setOverwrite = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + @@ -3382,7 +3412,8 @@ proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.toObject = function(includ var f, obj = { sketchPath: jspb.Message.getFieldWithDefault(msg, 1, ""), archivePath: jspb.Message.getFieldWithDefault(msg, 2, ""), - includeBuildDir: jspb.Message.getBooleanFieldWithDefault(msg, 3, false) + includeBuildDir: jspb.Message.getBooleanFieldWithDefault(msg, 3, false), + overwrite: jspb.Message.getBooleanFieldWithDefault(msg, 4, false) }; if (includeInstance) { @@ -3431,6 +3462,10 @@ proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.deserializeBinaryFromReade var value = /** @type {boolean} */ (reader.readBool()); msg.setIncludeBuildDir(value); break; + case 4: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setOverwrite(value); + break; default: reader.skipField(); break; @@ -3481,6 +3516,13 @@ proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.serializeBinaryToWriter = f ); } + f = message.getOverwrite(); + if (f) { + writer.writeBool( + 4, + f + ); + } }; @@ -3538,6 +3580,24 @@ proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.prototype.setIncludeBuildD }; +/** + * optional bool overwrite = 4; + * @return {boolean} + */ +proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.prototype.getOverwrite = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 4, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest} returns this + */ +proto.cc.arduino.cli.commands.v1.ArchiveSketchRequest.prototype.setOverwrite = function(value) { + return jspb.Message.setProto3BooleanField(this, 4, value); +}; + + diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.d.ts index de19321dc..7d7926f9e 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.d.ts @@ -255,6 +255,12 @@ export class Platform extends jspb.Message { addType(value: string, index?: number): string; + hasHelp(): boolean; + clearHelp(): void; + getHelp(): HelpResources | undefined; + setHelp(value?: HelpResources): Platform; + + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Platform.AsObject; static toObject(includeInstance: boolean, msg: Platform): Platform.AsObject; @@ -278,6 +284,7 @@ export namespace Platform { manuallyInstalled: boolean, deprecated: boolean, typeList: Array, + help?: HelpResources.AsObject, } } @@ -363,3 +370,24 @@ export namespace Profile { fqbn: string, } } + +export class HelpResources extends jspb.Message { + getOnline(): string; + setOnline(value: string): HelpResources; + + + serializeBinary(): Uint8Array; + toObject(includeInstance?: boolean): HelpResources.AsObject; + static toObject(includeInstance: boolean, msg: HelpResources): HelpResources.AsObject; + static extensions: {[key: number]: jspb.ExtensionFieldInfo}; + static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo}; + static serializeBinaryToWriter(message: HelpResources, writer: jspb.BinaryWriter): void; + static deserializeBinary(bytes: Uint8Array): HelpResources; + static deserializeBinaryFromReader(message: HelpResources, reader: jspb.BinaryReader): HelpResources; +} + +export namespace HelpResources { + export type AsObject = { + online: string, + } +} diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.js index 7b7a4bcd3..3a8294695 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.js @@ -21,6 +21,7 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgress.MessageCase goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgressEnd', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgressStart', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgressUpdate', null, global); +goog.exportSymbol('proto.cc.arduino.cli.commands.v1.HelpResources', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InstalledPlatformReference', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Instance', null, global); goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Platform', null, global); @@ -258,6 +259,27 @@ if (goog.DEBUG && !COMPILED) { */ proto.cc.arduino.cli.commands.v1.Profile.displayName = 'proto.cc.arduino.cli.commands.v1.Profile'; } +/** + * Generated by JsPbCodeGenerator. + * @param {Array=} opt_data Optional initial data array, typically from a + * server response, or constructed directly in Javascript. The array is used + * in place and becomes part of the constructed object. It is not cloned. + * If no data is provided, the constructed object will be empty, but still + * valid. + * @extends {jspb.Message} + * @constructor + */ +proto.cc.arduino.cli.commands.v1.HelpResources = function(opt_data) { + jspb.Message.initialize(this, opt_data, 0, -1, null, null); +}; +goog.inherits(proto.cc.arduino.cli.commands.v1.HelpResources, jspb.Message); +if (goog.DEBUG && !COMPILED) { + /** + * @public + * @override + */ + proto.cc.arduino.cli.commands.v1.HelpResources.displayName = 'proto.cc.arduino.cli.commands.v1.HelpResources'; +} @@ -1608,7 +1630,8 @@ proto.cc.arduino.cli.commands.v1.Platform.toObject = function(includeInstance, m proto.cc.arduino.cli.commands.v1.Board.toObject, includeInstance), manuallyInstalled: jspb.Message.getBooleanFieldWithDefault(msg, 9, false), deprecated: jspb.Message.getBooleanFieldWithDefault(msg, 10, false), - typeList: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f + typeList: (f = jspb.Message.getRepeatedField(msg, 11)) == null ? undefined : f, + help: (f = msg.getHelp()) && proto.cc.arduino.cli.commands.v1.HelpResources.toObject(includeInstance, f) }; if (includeInstance) { @@ -1690,6 +1713,11 @@ proto.cc.arduino.cli.commands.v1.Platform.deserializeBinaryFromReader = function var value = /** @type {string} */ (reader.readString()); msg.addType(value); break; + case 12: + var value = new proto.cc.arduino.cli.commands.v1.HelpResources; + reader.readMessage(value,proto.cc.arduino.cli.commands.v1.HelpResources.deserializeBinaryFromReader); + msg.setHelp(value); + break; default: reader.skipField(); break; @@ -1797,6 +1825,14 @@ proto.cc.arduino.cli.commands.v1.Platform.serializeBinaryToWriter = function(mes f ); } + f = message.getHelp(); + if (f != null) { + writer.writeMessage( + 12, + f, + proto.cc.arduino.cli.commands.v1.HelpResources.serializeBinaryToWriter + ); + } }; @@ -2037,6 +2073,43 @@ proto.cc.arduino.cli.commands.v1.Platform.prototype.clearTypeList = function() { }; +/** + * optional HelpResources help = 12; + * @return {?proto.cc.arduino.cli.commands.v1.HelpResources} + */ +proto.cc.arduino.cli.commands.v1.Platform.prototype.getHelp = function() { + return /** @type{?proto.cc.arduino.cli.commands.v1.HelpResources} */ ( + jspb.Message.getWrapperField(this, proto.cc.arduino.cli.commands.v1.HelpResources, 12)); +}; + + +/** + * @param {?proto.cc.arduino.cli.commands.v1.HelpResources|undefined} value + * @return {!proto.cc.arduino.cli.commands.v1.Platform} returns this +*/ +proto.cc.arduino.cli.commands.v1.Platform.prototype.setHelp = function(value) { + return jspb.Message.setWrapperField(this, 12, value); +}; + + +/** + * Clears the message field making it undefined. + * @return {!proto.cc.arduino.cli.commands.v1.Platform} returns this + */ +proto.cc.arduino.cli.commands.v1.Platform.prototype.clearHelp = function() { + return this.setHelp(undefined); +}; + + +/** + * Returns whether this field is set. + * @return {boolean} + */ +proto.cc.arduino.cli.commands.v1.Platform.prototype.hasHelp = function() { + return jspb.Message.getField(this, 12) != null; +}; + + @@ -2577,4 +2650,134 @@ proto.cc.arduino.cli.commands.v1.Profile.prototype.setFqbn = function(value) { }; + + + +if (jspb.Message.GENERATE_TO_OBJECT) { +/** + * Creates an object representation of this proto. + * Field names that are reserved in JavaScript and will be renamed to pb_name. + * Optional fields that are not set will be set to undefined. + * To access a reserved field use, foo.pb_, eg, foo.pb_default. + * For the list of reserved names please see: + * net/proto2/compiler/js/internal/generator.cc#kKeyword. + * @param {boolean=} opt_includeInstance Deprecated. whether to include the + * JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @return {!Object} + */ +proto.cc.arduino.cli.commands.v1.HelpResources.prototype.toObject = function(opt_includeInstance) { + return proto.cc.arduino.cli.commands.v1.HelpResources.toObject(opt_includeInstance, this); +}; + + +/** + * Static version of the {@see toObject} method. + * @param {boolean|undefined} includeInstance Deprecated. Whether to include + * the JSPB instance for transitional soy proto support: + * http://goto/soy-param-migration + * @param {!proto.cc.arduino.cli.commands.v1.HelpResources} msg The msg instance to transform. + * @return {!Object} + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.v1.HelpResources.toObject = function(includeInstance, msg) { + var f, obj = { + online: jspb.Message.getFieldWithDefault(msg, 1, "") + }; + + if (includeInstance) { + obj.$jspbMessageInstance = msg; + } + return obj; +}; +} + + +/** + * Deserializes binary data (in protobuf wire format). + * @param {jspb.ByteSource} bytes The bytes to deserialize. + * @return {!proto.cc.arduino.cli.commands.v1.HelpResources} + */ +proto.cc.arduino.cli.commands.v1.HelpResources.deserializeBinary = function(bytes) { + var reader = new jspb.BinaryReader(bytes); + var msg = new proto.cc.arduino.cli.commands.v1.HelpResources; + return proto.cc.arduino.cli.commands.v1.HelpResources.deserializeBinaryFromReader(msg, reader); +}; + + +/** + * Deserializes binary data (in protobuf wire format) from the + * given reader into the given message object. + * @param {!proto.cc.arduino.cli.commands.v1.HelpResources} msg The message object to deserialize into. + * @param {!jspb.BinaryReader} reader The BinaryReader to use. + * @return {!proto.cc.arduino.cli.commands.v1.HelpResources} + */ +proto.cc.arduino.cli.commands.v1.HelpResources.deserializeBinaryFromReader = function(msg, reader) { + while (reader.nextField()) { + if (reader.isEndGroup()) { + break; + } + var field = reader.getFieldNumber(); + switch (field) { + case 1: + var value = /** @type {string} */ (reader.readString()); + msg.setOnline(value); + break; + default: + reader.skipField(); + break; + } + } + return msg; +}; + + +/** + * Serializes the message to binary data (in protobuf wire format). + * @return {!Uint8Array} + */ +proto.cc.arduino.cli.commands.v1.HelpResources.prototype.serializeBinary = function() { + var writer = new jspb.BinaryWriter(); + proto.cc.arduino.cli.commands.v1.HelpResources.serializeBinaryToWriter(this, writer); + return writer.getResultBuffer(); +}; + + +/** + * Serializes the given message to binary data (in protobuf wire + * format), writing to the given BinaryWriter. + * @param {!proto.cc.arduino.cli.commands.v1.HelpResources} message + * @param {!jspb.BinaryWriter} writer + * @suppress {unusedLocalVariables} f is only used for nested messages + */ +proto.cc.arduino.cli.commands.v1.HelpResources.serializeBinaryToWriter = function(message, writer) { + var f = undefined; + f = message.getOnline(); + if (f.length > 0) { + writer.writeString( + 1, + f + ); + } +}; + + +/** + * optional string online = 1; + * @return {string} + */ +proto.cc.arduino.cli.commands.v1.HelpResources.prototype.getOnline = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.v1.HelpResources} returns this + */ +proto.cc.arduino.cli.commands.v1.HelpResources.prototype.setOnline = function(value) { + return jspb.Message.setProto3StringField(this, 1, value); +}; + + goog.object.extend(exports, proto.cc.arduino.cli.commands.v1); diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.d.ts index 34c8ec082..5954b8501 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.d.ts @@ -182,6 +182,11 @@ export class CompileResponse extends jspb.Message { getProgress(): cc_arduino_cli_commands_v1_common_pb.TaskProgress | undefined; setProgress(value?: cc_arduino_cli_commands_v1_common_pb.TaskProgress): CompileResponse; + clearBuildPropertiesList(): void; + getBuildPropertiesList(): Array; + setBuildPropertiesList(value: Array): CompileResponse; + addBuildProperties(value: string, index?: number): string; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): CompileResponse.AsObject; @@ -203,6 +208,7 @@ export namespace CompileResponse { boardPlatform?: cc_arduino_cli_commands_v1_common_pb.InstalledPlatformReference.AsObject, buildPlatform?: cc_arduino_cli_commands_v1_common_pb.InstalledPlatformReference.AsObject, progress?: cc_arduino_cli_commands_v1_common_pb.TaskProgress.AsObject, + buildPropertiesList: Array, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.js index c2bae211d..d5d0a7812 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/compile_pb.js @@ -1052,7 +1052,7 @@ proto.cc.arduino.cli.commands.v1.CompileRequest.prototype.setSkipLibrariesDiscov * @private {!Array} * @const */ -proto.cc.arduino.cli.commands.v1.CompileResponse.repeatedFields_ = [4,5]; +proto.cc.arduino.cli.commands.v1.CompileResponse.repeatedFields_ = [4,5,9]; @@ -1094,7 +1094,8 @@ proto.cc.arduino.cli.commands.v1.CompileResponse.toObject = function(includeInst proto.cc.arduino.cli.commands.v1.ExecutableSectionSize.toObject, includeInstance), boardPlatform: (f = msg.getBoardPlatform()) && cc_arduino_cli_commands_v1_common_pb.InstalledPlatformReference.toObject(includeInstance, f), buildPlatform: (f = msg.getBuildPlatform()) && cc_arduino_cli_commands_v1_common_pb.InstalledPlatformReference.toObject(includeInstance, f), - progress: (f = msg.getProgress()) && cc_arduino_cli_commands_v1_common_pb.TaskProgress.toObject(includeInstance, f) + progress: (f = msg.getProgress()) && cc_arduino_cli_commands_v1_common_pb.TaskProgress.toObject(includeInstance, f), + buildPropertiesList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f }; if (includeInstance) { @@ -1168,6 +1169,10 @@ proto.cc.arduino.cli.commands.v1.CompileResponse.deserializeBinaryFromReader = f reader.readMessage(value,cc_arduino_cli_commands_v1_common_pb.TaskProgress.deserializeBinaryFromReader); msg.setProgress(value); break; + case 9: + var value = /** @type {string} */ (reader.readString()); + msg.addBuildProperties(value); + break; default: reader.skipField(); break; @@ -1258,6 +1263,13 @@ proto.cc.arduino.cli.commands.v1.CompileResponse.serializeBinaryToWriter = funct cc_arduino_cli_commands_v1_common_pb.TaskProgress.serializeBinaryToWriter ); } + f = message.getBuildPropertiesList(); + if (f.length > 0) { + writer.writeRepeatedString( + 9, + f + ); + } }; @@ -1550,6 +1562,43 @@ proto.cc.arduino.cli.commands.v1.CompileResponse.prototype.hasProgress = functio }; +/** + * repeated string build_properties = 9; + * @return {!Array} + */ +proto.cc.arduino.cli.commands.v1.CompileResponse.prototype.getBuildPropertiesList = function() { + return /** @type {!Array} */ (jspb.Message.getRepeatedField(this, 9)); +}; + + +/** + * @param {!Array} value + * @return {!proto.cc.arduino.cli.commands.v1.CompileResponse} returns this + */ +proto.cc.arduino.cli.commands.v1.CompileResponse.prototype.setBuildPropertiesList = function(value) { + return jspb.Message.setField(this, 9, value || []); +}; + + +/** + * @param {string} value + * @param {number=} opt_index + * @return {!proto.cc.arduino.cli.commands.v1.CompileResponse} returns this + */ +proto.cc.arduino.cli.commands.v1.CompileResponse.prototype.addBuildProperties = function(value, opt_index) { + return jspb.Message.addToRepeatedField(this, 9, value, opt_index); +}; + + +/** + * Clears the list making it empty but non-null. + * @return {!proto.cc.arduino.cli.commands.v1.CompileResponse} returns this + */ +proto.cc.arduino.cli.commands.v1.CompileResponse.prototype.clearBuildPropertiesList = function() { + return this.setBuildPropertiesList([]); +}; + + diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.d.ts index 233f0d59f..17c863eea 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.d.ts @@ -23,6 +23,9 @@ export class Port extends jspb.Message { getPropertiesMap(): jspb.Map; clearPropertiesMap(): void; + getHardwareId(): string; + setHardwareId(value: string): Port; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): Port.AsObject; @@ -42,5 +45,6 @@ export namespace Port { protocolLabel: string, propertiesMap: Array<[string, string]>, + hardwareId: string, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.js index 6b8eacaee..6f905454d 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/port_pb.js @@ -73,7 +73,8 @@ proto.cc.arduino.cli.commands.v1.Port.toObject = function(includeInstance, msg) label: jspb.Message.getFieldWithDefault(msg, 2, ""), protocol: jspb.Message.getFieldWithDefault(msg, 3, ""), protocolLabel: jspb.Message.getFieldWithDefault(msg, 4, ""), - propertiesMap: (f = msg.getPropertiesMap()) ? f.toObject(includeInstance, undefined) : [] + propertiesMap: (f = msg.getPropertiesMap()) ? f.toObject(includeInstance, undefined) : [], + hardwareId: jspb.Message.getFieldWithDefault(msg, 6, "") }; if (includeInstance) { @@ -132,6 +133,10 @@ proto.cc.arduino.cli.commands.v1.Port.deserializeBinaryFromReader = function(msg jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); }); break; + case 6: + var value = /** @type {string} */ (reader.readString()); + msg.setHardwareId(value); + break; default: reader.skipField(); break; @@ -193,6 +198,13 @@ proto.cc.arduino.cli.commands.v1.Port.serializeBinaryToWriter = function(message if (f && f.getLength() > 0) { f.serializeBinary(5, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); } + f = message.getHardwareId(); + if (f.length > 0) { + writer.writeString( + 6, + f + ); + } }; @@ -290,4 +302,22 @@ proto.cc.arduino.cli.commands.v1.Port.prototype.clearPropertiesMap = function() return this;}; +/** + * optional string hardware_id = 6; + * @return {string} + */ +proto.cc.arduino.cli.commands.v1.Port.prototype.getHardwareId = function() { + return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, "")); +}; + + +/** + * @param {string} value + * @return {!proto.cc.arduino.cli.commands.v1.Port} returns this + */ +proto.cc.arduino.cli.commands.v1.Port.prototype.setHardwareId = function(value) { + return jspb.Message.setProto3StringField(this, 6, value); +}; + + goog.object.extend(exports, proto.cc.arduino.cli.commands.v1); From 788b4179a7e3a7e4f40f49359e872bc4d5125f8b Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 11:40:19 +0100 Subject: [PATCH 03/13] pin arduino-cli 0.31.0-rc.1 --- arduino-ide-extension/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index 0e2d9eb92..2b4a52e0e 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -166,7 +166,7 @@ "version": { "owner": "arduino", "repo": "arduino-cli", - "commitish": "master" + "commitish": "940c945" } }, "fwuploader": { From 8a3591f2ad53ad0e109d70315d799fa96e7cd1f1 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 11:45:05 +0100 Subject: [PATCH 04/13] naming and param fixup --- .../src/browser/boards/boards-service-provider.ts | 6 +++--- arduino-ide-extension/src/common/protocol/boards-service.ts | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index b04baea1c..94dd8b9bf 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -202,7 +202,7 @@ export class BoardsServiceProvider const lastBoardsConfigOnUpload = this.lastBoardsConfigOnUpload; if (boardOnAppearedPort && lastBoardsConfigOnUpload.selectedBoard) { - const boardIsSameHardware = Board.sameDistinctHardwareAs( + const boardIsSameHardware = Board.hardwareIdEquals( boardOnAppearedPort, lastBoardsConfigOnUpload.selectedBoard ); @@ -338,7 +338,7 @@ export class BoardsServiceProvider ? selectedBoard : this._availableBoards.find( (availableBoard) => - Board.sameDistinctHardwareAs(availableBoard, selectedBoard) || + Board.hardwareIdEquals(availableBoard, selectedBoard) || Board.sameAs(availableBoard, selectedBoard) ); if ( @@ -370,7 +370,7 @@ export class BoardsServiceProvider ({ state }) => state !== AvailableBoard.State.incomplete )) { if ( - (Board.sameDistinctHardwareAs( + (Board.hardwareIdEquals( this.latestValidBoardsConfig.selectedBoard, board ) || diff --git a/arduino-ide-extension/src/common/protocol/boards-service.ts b/arduino-ide-extension/src/common/protocol/boards-service.ts index 8ab290807..e70e6e232 100644 --- a/arduino-ide-extension/src/common/protocol/boards-service.ts +++ b/arduino-ide-extension/src/common/protocol/boards-service.ts @@ -554,10 +554,7 @@ export namespace Board { return left.name === right.name && left.fqbn === right.fqbn; } - export function sameDistinctHardwareAs( - left: Board, - right: string | Board - ): boolean { + export function hardwareIdEquals(left: Board, right: Board): boolean { if (Board.is(right) && left.port && right.port) { const { hardwareId: leftHardwareId } = left.port; const { hardwareId: rightHardwareId } = right.port; From 491b7574cdaa7752931822c464b600716fa43487 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:00:52 +0100 Subject: [PATCH 05/13] re-gen protocol with 0.31.0-rc.1 --- .../cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js index 49ec3d019..887ef6b04 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js @@ -1333,3 +1333,5 @@ enumerateMonitorPortSettings: { }, }; +// BOOTSTRAP COMMANDS +// ------------------- From f0e696c391054b17c7869ec4081c391cae75baa7 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:07:34 +0100 Subject: [PATCH 06/13] fixup --- arduino-ide-extension/src/common/protocol/boards-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/common/protocol/boards-service.ts b/arduino-ide-extension/src/common/protocol/boards-service.ts index e70e6e232..c955b9462 100644 --- a/arduino-ide-extension/src/common/protocol/boards-service.ts +++ b/arduino-ide-extension/src/common/protocol/boards-service.ts @@ -555,7 +555,7 @@ export namespace Board { } export function hardwareIdEquals(left: Board, right: Board): boolean { - if (Board.is(right) && left.port && right.port) { + if (left.port && right.port) { const { hardwareId: leftHardwareId } = left.port; const { hardwareId: rightHardwareId } = right.port; From 8cb5a4cabcf54624a95950370c56844d6c39dfe0 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 12:15:22 +0100 Subject: [PATCH 07/13] gen protocol from c73f735 --- arduino-ide-extension/package.json | 2 +- .../cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index 2b4a52e0e..61ea834ab 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -166,7 +166,7 @@ "version": { "owner": "arduino", "repo": "arduino-cli", - "commitish": "940c945" + "commitish": "c73f735" } }, "fwuploader": { diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js index 887ef6b04..49ec3d019 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js @@ -1333,5 +1333,3 @@ enumerateMonitorPortSettings: { }, }; -// BOOTSTRAP COMMANDS -// ------------------- From 3f1609f11ffc7fe4bc12bc9d003e652e036c7412 Mon Sep 17 00:00:00 2001 From: David Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 16:18:13 +0100 Subject: [PATCH 08/13] revert protocol to 0.31.0-rc.1 equivalent --- .../cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js index 49ec3d019..887ef6b04 100644 --- a/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/commands_grpc_pb.js @@ -1333,3 +1333,5 @@ enumerateMonitorPortSettings: { }, }; +// BOOTSTRAP COMMANDS +// ------------------- From 9323160a840478b937832839b35f57ec1560da90 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Wed, 22 Feb 2023 20:39:11 +0100 Subject: [PATCH 09/13] auto-select for unplug-plug: same board diff. port --- .../browser/boards/boards-service-provider.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 94dd8b9bf..891da3cc0 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -370,13 +370,24 @@ export class BoardsServiceProvider ({ state }) => state !== AvailableBoard.State.incomplete )) { if ( - (Board.hardwareIdEquals( + Board.hardwareIdEquals( this.latestValidBoardsConfig.selectedBoard, board - ) || - (this.latestValidBoardsConfig.selectedBoard.fqbn === board.fqbn && - this.latestValidBoardsConfig.selectedBoard.name === - board.name)) && + ) + ) { + this.boardsConfig = { + selectedBoard: { + ...this.latestValidBoardsConfig.selectedBoard, + port: board.port, + }, + selectedPort: board.port, + }; + return true; + } + + if ( + this.latestValidBoardsConfig.selectedBoard.fqbn === board.fqbn && + this.latestValidBoardsConfig.selectedBoard.name === board.name && Port.sameAs(this.latestValidBoardsConfig.selectedPort, board.port) ) { this.boardsConfig = this.latestValidBoardsConfig; From 83bb50a1547736d3cc9369757356b4bf4570f117 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 23 Feb 2023 09:45:39 +0100 Subject: [PATCH 10/13] don't overwrite fqbn & name --- .../src/browser/boards/boards-service-provider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 891da3cc0..18f9c853e 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -220,8 +220,8 @@ export class BoardsServiceProvider boardToAutoSelect = { ...boardToAutoSelect, - name, - fqbn, + name: boardToAutoSelect.name || name, + fqbn: boardToAutoSelect.fqbn || fqbn, }; } From 7386232271916cf8dbf1457cf945d8a7963eb340 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:17:23 +0100 Subject: [PATCH 11/13] fix erroneous return --- .../src/browser/boards/boards-service-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 18f9c853e..e0794d61e 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -212,7 +212,7 @@ export class BoardsServiceProvider lastBoardsConfigOnUpload.selectedBoard ); - if (!boardIsSameHardware && !boardIsSameFqbn) return; + if (!boardIsSameHardware && !boardIsSameFqbn) continue; let boardToAutoSelect = boardOnAppearedPort; if (boardIsSameHardware && !boardIsSameFqbn) { From dd9d4f92c95ae75baa6344a27119f736faf68a43 Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 23 Feb 2023 10:39:03 +0100 Subject: [PATCH 12/13] align logic with deriveBoardConfigToAutoSelect --- .../src/browser/boards/boards-service-provider.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index e0794d61e..7e7f54b20 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -375,9 +375,11 @@ export class BoardsServiceProvider board ) ) { + const { name, fqbn } = this.latestValidBoardsConfig.selectedBoard; this.boardsConfig = { selectedBoard: { - ...this.latestValidBoardsConfig.selectedBoard, + name: board.name || name, + fqbn: board.fqbn || fqbn, port: board.port, }, selectedPort: board.port, From 2fb1757a6e0f1a0fefe51ef886e648ae3789192f Mon Sep 17 00:00:00 2001 From: Dave Simpson <45690499+davegarthsimpson@users.noreply.github.com> Date: Thu, 23 Feb 2023 17:36:45 +0100 Subject: [PATCH 13/13] prefer previous name over "Unknown" --- .../src/browser/boards/boards-service-provider.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts index 7e7f54b20..279a2e3fa 100644 --- a/arduino-ide-extension/src/browser/boards/boards-service-provider.ts +++ b/arduino-ide-extension/src/browser/boards/boards-service-provider.ts @@ -220,7 +220,10 @@ export class BoardsServiceProvider boardToAutoSelect = { ...boardToAutoSelect, - name: boardToAutoSelect.name || name, + name: + boardToAutoSelect.name === Unknown || !boardToAutoSelect.name + ? name + : boardToAutoSelect.name, fqbn: boardToAutoSelect.fqbn || fqbn, }; } @@ -378,7 +381,7 @@ export class BoardsServiceProvider const { name, fqbn } = this.latestValidBoardsConfig.selectedBoard; this.boardsConfig = { selectedBoard: { - name: board.name || name, + name: board.name === Unknown || !board.name ? name : board.name, fqbn: board.fqbn || fqbn, port: board.port, },