Added overwrite confirmation to ZIP lib install

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2021-03-12 15:36:12 +01:00 committed by Akos Kitta
parent 9cd91464e3
commit 5c8669d699
17 changed files with 1488 additions and 742 deletions

View File

@ -124,7 +124,7 @@
],
"arduino": {
"cli": {
"version": "0.16.1"
"version": "20210315"
}
}
}

View File

@ -6,6 +6,7 @@ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
import URI from '@theia/core/lib/common/uri';
import { InstallationProgressDialog } from '../widgets/progress-dialog';
import { LibraryService } from '../../common/protocol';
import { ConfirmDialog } from '@theia/core/lib/browser';
@injectable()
export class AddZipLibrary extends SketchContribution {
@ -49,19 +50,58 @@ export class AddZipLibrary extends SketchContribution {
});
if (!canceled && filePaths.length) {
const zipUri = await this.fileSystemExt.getUri(filePaths[0]);
const dialog = new InstallationProgressDialog('Installing library', 'zip');
try {
this.outputChannelManager.getChannel('Arduino').clear();
dialog.open();
await this.libraryService.installZip({ zipUri });
} catch (e) {
this.messageService.error(e.toString());
} finally {
dialog.close();
await this.doInstall(zipUri);
} catch (error) {
if (error instanceof AlreadyInstalledError) {
const result = await new ConfirmDialog({
msg: error.message,
title: 'Do you want to overwrite the existing library?',
ok: 'Yes',
cancel: 'No'
}).open();
if (result) {
await this.doInstall(zipUri, true);
}
}
}
}
}
private async doInstall(zipUri: string, overwrite?: boolean): Promise<void> {
const dialog = new InstallationProgressDialog('Installing library', 'zip');
try {
this.outputChannelManager.getChannel('Arduino').clear();
dialog.open();
await this.libraryService.installZip({ zipUri, overwrite });
} catch (error) {
if (error instanceof Error) {
const match = error.message.match(/library (.*?) already installed/);
if (match && match.length >= 2) {
const name = match[1].trim();
if (name) {
throw new AlreadyInstalledError(`A library folder named ${name} already exists. Do you want to overwrite it?`, name);
} else {
throw new AlreadyInstalledError(`A library already exists. Do you want to overwrite it?`);
}
}
}
this.messageService.error(error.toString());
throw error;
} finally {
dialog.close();
}
}
}
class AlreadyInstalledError extends Error {
constructor(message: string, readonly libraryName?: string) {
super(message);
Object.setPrototypeOf(this, AlreadyInstalledError.prototype);
}
}
export namespace AddZipLibrary {

View File

@ -10,7 +10,7 @@ export interface LibraryService extends Installable<LibraryPackage>, Searchable<
* When `installDependencies` is not set, it is `true` by default. If you want to skip the installation of required dependencies, set it to `false`.
*/
install(options: { item: LibraryPackage, version?: Installable.Version, installDependencies?: boolean }): Promise<void>;
installZip(options: { zipUri: string }): Promise<void>;
installZip(options: { zipUri: string, overwrite?: boolean }): Promise<void>;
/**
* Set `filterSelf` to `true` if you want to avoid having `item` in the result set.
* Note: as of today (22.02.2021), the CLI works like this: `./arduino-cli lib deps Adaino@0.1.0 ✕ Adaino 0.1.0 must be installed.`.

View File

@ -8,12 +8,13 @@ import {
} from '../common/protocol';
import {
PlatformSearchReq, PlatformSearchResp, PlatformInstallReq, PlatformInstallResp, PlatformListReq,
PlatformListResp, Platform, PlatformUninstallResp, PlatformUninstallReq
PlatformListResp, PlatformUninstallResp, PlatformUninstallReq
} from './cli-protocol/commands/core_pb';
import { BoardDiscovery } from './board-discovery';
import { CoreClientAware } from './core-client-provider';
import { BoardDetailsReq, BoardDetailsResp } from './cli-protocol/commands/board_pb';
import { ListProgrammersAvailableForUploadReq, ListProgrammersAvailableForUploadResp } from './cli-protocol/commands/upload_pb';
import { Platform } from './cli-protocol/commands/common_pb';
@injectable()
export class BoardsServiceImpl extends CoreClientAware implements BoardsService {

View File

@ -92,6 +92,9 @@ export class BoardDetailsResp extends jspb.Message {
getDebuggingSupported(): boolean;
setDebuggingSupported(value: boolean): BoardDetailsResp;
getSerialnumber(): string;
setSerialnumber(value: string): BoardDetailsResp;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardDetailsResp.AsObject;
@ -119,6 +122,7 @@ export namespace BoardDetailsResp {
identificationPrefList: Array<IdentificationPref.AsObject>,
programmersList: Array<commands_common_pb.Programmer.AsObject>,
debuggingSupported: boolean,
serialnumber: string,
}
}
@ -535,6 +539,9 @@ export class DetectedPort extends jspb.Message {
setBoardsList(value: Array<BoardListItem>): DetectedPort;
addBoards(value?: BoardListItem, index?: number): BoardListItem;
getSerialNumber(): string;
setSerialNumber(value: string): DetectedPort;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): DetectedPort.AsObject;
@ -552,6 +559,7 @@ export namespace DetectedPort {
protocol: string,
protocolLabel: string,
boardsList: Array<BoardListItem.AsObject>,
serialNumber: string,
}
}
@ -689,6 +697,12 @@ export class BoardListItem extends jspb.Message {
setPid(value: string): BoardListItem;
hasPlatform(): boolean;
clearPlatform(): void;
getPlatform(): commands_common_pb.Platform | undefined;
setPlatform(value?: commands_common_pb.Platform): BoardListItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardListItem.AsObject;
static toObject(includeInstance: boolean, msg: BoardListItem): BoardListItem.AsObject;
@ -706,5 +720,61 @@ export namespace BoardListItem {
isHidden: boolean,
vid: string,
pid: string,
platform?: commands_common_pb.Platform.AsObject,
}
}
export class BoardSearchReq extends jspb.Message {
hasInstance(): boolean;
clearInstance(): void;
getInstance(): commands_common_pb.Instance | undefined;
setInstance(value?: commands_common_pb.Instance): BoardSearchReq;
getSearchArgs(): string;
setSearchArgs(value: string): BoardSearchReq;
getIncludeHiddenBoards(): boolean;
setIncludeHiddenBoards(value: boolean): BoardSearchReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardSearchReq.AsObject;
static toObject(includeInstance: boolean, msg: BoardSearchReq): BoardSearchReq.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: BoardSearchReq, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): BoardSearchReq;
static deserializeBinaryFromReader(message: BoardSearchReq, reader: jspb.BinaryReader): BoardSearchReq;
}
export namespace BoardSearchReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
searchArgs: string,
includeHiddenBoards: boolean,
}
}
export class BoardSearchResp extends jspb.Message {
clearBoardsList(): void;
getBoardsList(): Array<BoardListItem>;
setBoardsList(value: Array<BoardListItem>): BoardSearchResp;
addBoards(value?: BoardListItem, index?: number): BoardListItem;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardSearchResp.AsObject;
static toObject(includeInstance: boolean, msg: BoardSearchResp): BoardSearchResp.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: BoardSearchResp, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): BoardSearchResp;
static deserializeBinaryFromReader(message: BoardSearchResp, reader: jspb.BinaryReader): BoardSearchResp;
}
export namespace BoardSearchResp {
export type AsObject = {
boardsList: Array<BoardListItem.AsObject>,
}
}

View File

@ -28,6 +28,8 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.BoardListResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.BoardListWatchReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.BoardListWatchResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.BoardPlatform', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.BoardSearchReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.BoardSearchResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.ConfigOption', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.ConfigValue', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.DetectedPort', null, global);
@ -478,6 +480,48 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.BoardListItem.displayName = 'proto.cc.arduino.cli.commands.BoardListItem';
}
/**
* 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.BoardSearchReq = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.BoardSearchReq, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.BoardSearchReq.displayName = 'proto.cc.arduino.cli.commands.BoardSearchReq';
}
/**
* 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.BoardSearchResp = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.BoardSearchResp.repeatedFields_, null);
};
goog.inherits(proto.cc.arduino.cli.commands.BoardSearchResp, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.BoardSearchResp.displayName = 'proto.cc.arduino.cli.commands.BoardSearchResp';
}
@ -715,7 +759,8 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.toObject = function(includeInstan
proto.cc.arduino.cli.commands.IdentificationPref.toObject, includeInstance),
programmersList: jspb.Message.toObjectList(msg.getProgrammersList(),
commands_common_pb.Programmer.toObject, includeInstance),
debuggingSupported: jspb.Message.getBooleanFieldWithDefault(msg, 14, false)
debuggingSupported: jspb.Message.getBooleanFieldWithDefault(msg, 14, false),
serialnumber: jspb.Message.getFieldWithDefault(msg, 15, "")
};
if (includeInstance) {
@ -814,6 +859,10 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.deserializeBinaryFromReader = fun
var value = /** @type {boolean} */ (reader.readBool());
msg.setDebuggingSupported(value);
break;
case 15:
var value = /** @type {string} */ (reader.readString());
msg.setSerialnumber(value);
break;
default:
reader.skipField();
break;
@ -947,6 +996,13 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.serializeBinaryToWriter = functio
f
);
}
f = message.getSerialnumber();
if (f.length > 0) {
writer.writeString(
15,
f
);
}
};
@ -1320,6 +1376,24 @@ proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.setDebuggingSupported =
};
/**
* optional string serialNumber = 15;
* @return {string}
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.getSerialnumber = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 15, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.BoardDetailsResp} returns this
*/
proto.cc.arduino.cli.commands.BoardDetailsResp.prototype.setSerialnumber = function(value) {
return jspb.Message.setProto3StringField(this, 15, value);
};
@ -4028,7 +4102,8 @@ proto.cc.arduino.cli.commands.DetectedPort.toObject = function(includeInstance,
protocol: jspb.Message.getFieldWithDefault(msg, 2, ""),
protocolLabel: jspb.Message.getFieldWithDefault(msg, 3, ""),
boardsList: jspb.Message.toObjectList(msg.getBoardsList(),
proto.cc.arduino.cli.commands.BoardListItem.toObject, includeInstance)
proto.cc.arduino.cli.commands.BoardListItem.toObject, includeInstance),
serialNumber: jspb.Message.getFieldWithDefault(msg, 5, "")
};
if (includeInstance) {
@ -4082,6 +4157,10 @@ proto.cc.arduino.cli.commands.DetectedPort.deserializeBinaryFromReader = functio
reader.readMessage(value,proto.cc.arduino.cli.commands.BoardListItem.deserializeBinaryFromReader);
msg.addBoards(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setSerialNumber(value);
break;
default:
reader.skipField();
break;
@ -4140,6 +4219,13 @@ proto.cc.arduino.cli.commands.DetectedPort.serializeBinaryToWriter = function(me
proto.cc.arduino.cli.commands.BoardListItem.serializeBinaryToWriter
);
}
f = message.getSerialNumber();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
};
@ -4235,6 +4321,24 @@ proto.cc.arduino.cli.commands.DetectedPort.prototype.clearBoardsList = function(
};
/**
* optional string serial_number = 5;
* @return {string}
*/
proto.cc.arduino.cli.commands.DetectedPort.prototype.getSerialNumber = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.DetectedPort} returns this
*/
proto.cc.arduino.cli.commands.DetectedPort.prototype.setSerialNumber = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* List of repeated fields within this message type.
@ -5060,7 +5164,8 @@ proto.cc.arduino.cli.commands.BoardListItem.toObject = function(includeInstance,
fqbn: jspb.Message.getFieldWithDefault(msg, 2, ""),
isHidden: jspb.Message.getBooleanFieldWithDefault(msg, 3, false),
vid: jspb.Message.getFieldWithDefault(msg, 4, ""),
pid: jspb.Message.getFieldWithDefault(msg, 5, "")
pid: jspb.Message.getFieldWithDefault(msg, 5, ""),
platform: (f = msg.getPlatform()) && commands_common_pb.Platform.toObject(includeInstance, f)
};
if (includeInstance) {
@ -5117,6 +5222,11 @@ proto.cc.arduino.cli.commands.BoardListItem.deserializeBinaryFromReader = functi
var value = /** @type {string} */ (reader.readString());
msg.setPid(value);
break;
case 6:
var value = new commands_common_pb.Platform;
reader.readMessage(value,commands_common_pb.Platform.deserializeBinaryFromReader);
msg.setPlatform(value);
break;
default:
reader.skipField();
break;
@ -5181,6 +5291,14 @@ proto.cc.arduino.cli.commands.BoardListItem.serializeBinaryToWriter = function(m
f
);
}
f = message.getPlatform();
if (f != null) {
writer.writeMessage(
6,
f,
commands_common_pb.Platform.serializeBinaryToWriter
);
}
};
@ -5274,4 +5392,412 @@ proto.cc.arduino.cli.commands.BoardListItem.prototype.setPid = function(value) {
};
/**
* optional Platform platform = 6;
* @return {?proto.cc.arduino.cli.commands.Platform}
*/
proto.cc.arduino.cli.commands.BoardListItem.prototype.getPlatform = function() {
return /** @type{?proto.cc.arduino.cli.commands.Platform} */ (
jspb.Message.getWrapperField(this, commands_common_pb.Platform, 6));
};
/**
* @param {?proto.cc.arduino.cli.commands.Platform|undefined} value
* @return {!proto.cc.arduino.cli.commands.BoardListItem} returns this
*/
proto.cc.arduino.cli.commands.BoardListItem.prototype.setPlatform = function(value) {
return jspb.Message.setWrapperField(this, 6, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cc.arduino.cli.commands.BoardListItem} returns this
*/
proto.cc.arduino.cli.commands.BoardListItem.prototype.clearPlatform = function() {
return this.setPlatform(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.commands.BoardListItem.prototype.hasPlatform = function() {
return jspb.Message.getField(this, 6) != null;
};
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_<name>, 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.BoardSearchReq.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.BoardSearchReq.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.BoardSearchReq} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.BoardSearchReq.toObject = function(includeInstance, msg) {
var f, obj = {
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
searchArgs: jspb.Message.getFieldWithDefault(msg, 2, ""),
includeHiddenBoards: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
};
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.BoardSearchReq}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.BoardSearchReq;
return proto.cc.arduino.cli.commands.BoardSearchReq.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.BoardSearchReq} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.BoardSearchReq}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new commands_common_pb.Instance;
reader.readMessage(value,commands_common_pb.Instance.deserializeBinaryFromReader);
msg.setInstance(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setSearchArgs(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setIncludeHiddenBoards(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.BoardSearchReq.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.BoardSearchReq.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.BoardSearchReq} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.BoardSearchReq.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getInstance();
if (f != null) {
writer.writeMessage(
1,
f,
commands_common_pb.Instance.serializeBinaryToWriter
);
}
f = message.getSearchArgs();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getIncludeHiddenBoards();
if (f) {
writer.writeBool(
3,
f
);
}
};
/**
* optional Instance instance = 1;
* @return {?proto.cc.arduino.cli.commands.Instance}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.getInstance = function() {
return /** @type{?proto.cc.arduino.cli.commands.Instance} */ (
jspb.Message.getWrapperField(this, commands_common_pb.Instance, 1));
};
/**
* @param {?proto.cc.arduino.cli.commands.Instance|undefined} value
* @return {!proto.cc.arduino.cli.commands.BoardSearchReq} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.setInstance = function(value) {
return jspb.Message.setWrapperField(this, 1, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cc.arduino.cli.commands.BoardSearchReq} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.clearInstance = function() {
return this.setInstance(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.hasInstance = function() {
return jspb.Message.getField(this, 1) != null;
};
/**
* optional string search_args = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.getSearchArgs = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.BoardSearchReq} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.setSearchArgs = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional bool include_hidden_boards = 3;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.getIncludeHiddenBoards = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.BoardSearchReq} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchReq.prototype.setIncludeHiddenBoards = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cc.arduino.cli.commands.BoardSearchResp.repeatedFields_ = [1];
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_<name>, 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.BoardSearchResp.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.BoardSearchResp.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.BoardSearchResp} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.BoardSearchResp.toObject = function(includeInstance, msg) {
var f, obj = {
boardsList: jspb.Message.toObjectList(msg.getBoardsList(),
proto.cc.arduino.cli.commands.BoardListItem.toObject, includeInstance)
};
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.BoardSearchResp}
*/
proto.cc.arduino.cli.commands.BoardSearchResp.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.BoardSearchResp;
return proto.cc.arduino.cli.commands.BoardSearchResp.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.BoardSearchResp} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.BoardSearchResp}
*/
proto.cc.arduino.cli.commands.BoardSearchResp.deserializeBinaryFromReader = function(msg, reader) {
while (reader.nextField()) {
if (reader.isEndGroup()) {
break;
}
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.commands.BoardListItem;
reader.readMessage(value,proto.cc.arduino.cli.commands.BoardListItem.deserializeBinaryFromReader);
msg.addBoards(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.BoardSearchResp.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.BoardSearchResp.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.BoardSearchResp} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.BoardSearchResp.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getBoardsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
1,
f,
proto.cc.arduino.cli.commands.BoardListItem.serializeBinaryToWriter
);
}
};
/**
* repeated BoardListItem boards = 1;
* @return {!Array<!proto.cc.arduino.cli.commands.BoardListItem>}
*/
proto.cc.arduino.cli.commands.BoardSearchResp.prototype.getBoardsList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.BoardListItem>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.BoardListItem, 1));
};
/**
* @param {!Array<!proto.cc.arduino.cli.commands.BoardListItem>} value
* @return {!proto.cc.arduino.cli.commands.BoardSearchResp} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchResp.prototype.setBoardsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 1, value);
};
/**
* @param {!proto.cc.arduino.cli.commands.BoardListItem=} opt_value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.BoardListItem}
*/
proto.cc.arduino.cli.commands.BoardSearchResp.prototype.addBoards = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.cc.arduino.cli.commands.BoardListItem, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.BoardSearchResp} returns this
*/
proto.cc.arduino.cli.commands.BoardSearchResp.prototype.clearBoardsList = function() {
return this.setBoardsList([]);
};
goog.object.extend(exports, proto.cc.arduino.cli.commands);

View File

@ -30,6 +30,7 @@ interface IArduinoCoreService extends grpc.ServiceDefinition<grpc.UntypedService
boardAttach: IArduinoCoreService_IBoardAttach;
boardList: IArduinoCoreService_IBoardList;
boardListAll: IArduinoCoreService_IBoardListAll;
boardSearch: IArduinoCoreService_IBoardSearch;
boardListWatch: IArduinoCoreService_IBoardListWatch;
compile: IArduinoCoreService_ICompile;
platformInstall: IArduinoCoreService_IPlatformInstall;
@ -188,6 +189,15 @@ interface IArduinoCoreService_IBoardListAll extends grpc.MethodDefinition<comman
responseSerialize: grpc.serialize<commands_board_pb.BoardListAllResp>;
responseDeserialize: grpc.deserialize<commands_board_pb.BoardListAllResp>;
}
interface IArduinoCoreService_IBoardSearch extends grpc.MethodDefinition<commands_board_pb.BoardSearchReq, commands_board_pb.BoardSearchResp> {
path: "/cc.arduino.cli.commands.ArduinoCore/BoardSearch";
requestStream: false;
responseStream: false;
requestSerialize: grpc.serialize<commands_board_pb.BoardSearchReq>;
requestDeserialize: grpc.deserialize<commands_board_pb.BoardSearchReq>;
responseSerialize: grpc.serialize<commands_board_pb.BoardSearchResp>;
responseDeserialize: grpc.deserialize<commands_board_pb.BoardSearchResp>;
}
interface IArduinoCoreService_IBoardListWatch extends grpc.MethodDefinition<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp> {
path: "/cc.arduino.cli.commands.ArduinoCore/BoardListWatch";
requestStream: true;
@ -396,6 +406,7 @@ export interface IArduinoCoreServer {
boardAttach: grpc.handleServerStreamingCall<commands_board_pb.BoardAttachReq, commands_board_pb.BoardAttachResp>;
boardList: grpc.handleUnaryCall<commands_board_pb.BoardListReq, commands_board_pb.BoardListResp>;
boardListAll: grpc.handleUnaryCall<commands_board_pb.BoardListAllReq, commands_board_pb.BoardListAllResp>;
boardSearch: grpc.handleUnaryCall<commands_board_pb.BoardSearchReq, commands_board_pb.BoardSearchResp>;
boardListWatch: grpc.handleBidiStreamingCall<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
compile: grpc.handleServerStreamingCall<commands_compile_pb.CompileReq, commands_compile_pb.CompileResp>;
platformInstall: grpc.handleServerStreamingCall<commands_core_pb.PlatformInstallReq, commands_core_pb.PlatformInstallResp>;
@ -459,6 +470,9 @@ export interface IArduinoCoreClient {
boardListAll(request: commands_board_pb.BoardListAllReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
boardListAll(request: commands_board_pb.BoardListAllReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
boardListAll(request: commands_board_pb.BoardListAllReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
boardSearch(request: commands_board_pb.BoardSearchReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
boardSearch(request: commands_board_pb.BoardSearchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
boardSearch(request: commands_board_pb.BoardSearchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
boardListWatch(): grpc.ClientDuplexStream<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
boardListWatch(options: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
boardListWatch(metadata: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
@ -551,6 +565,9 @@ export class ArduinoCoreClient extends grpc.Client implements IArduinoCoreClient
public boardListAll(request: commands_board_pb.BoardListAllReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
public boardListAll(request: commands_board_pb.BoardListAllReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
public boardListAll(request: commands_board_pb.BoardListAllReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardListAllResp) => void): grpc.ClientUnaryCall;
public boardSearch(request: commands_board_pb.BoardSearchReq, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
public boardSearch(request: commands_board_pb.BoardSearchReq, metadata: grpc.Metadata, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
public boardSearch(request: commands_board_pb.BoardSearchReq, metadata: grpc.Metadata, options: Partial<grpc.CallOptions>, callback: (error: grpc.ServiceError | null, response: commands_board_pb.BoardSearchResp) => void): grpc.ClientUnaryCall;
public boardListWatch(options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
public boardListWatch(metadata?: grpc.Metadata, options?: Partial<grpc.CallOptions>): grpc.ClientDuplexStream<commands_board_pb.BoardListWatchReq, commands_board_pb.BoardListWatchResp>;
public compile(request: commands_compile_pb.CompileReq, options?: Partial<grpc.CallOptions>): grpc.ClientReadableStream<commands_compile_pb.CompileResp>;

View File

@ -157,6 +157,28 @@ function deserialize_cc_arduino_cli_commands_BoardListWatchResp(buffer_arg) {
return commands_board_pb.BoardListWatchResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_BoardSearchReq(arg) {
if (!(arg instanceof commands_board_pb.BoardSearchReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.BoardSearchReq');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_BoardSearchReq(buffer_arg) {
return commands_board_pb.BoardSearchReq.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_BoardSearchResp(arg) {
if (!(arg instanceof commands_board_pb.BoardSearchResp)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.BoardSearchResp');
}
return Buffer.from(arg.serializeBinary());
}
function deserialize_cc_arduino_cli_commands_BoardSearchResp(buffer_arg) {
return commands_board_pb.BoardSearchResp.deserializeBinary(new Uint8Array(buffer_arg));
}
function serialize_cc_arduino_cli_commands_BurnBootloaderReq(arg) {
if (!(arg instanceof commands_upload_pb.BurnBootloaderReq)) {
throw new Error('Expected argument of type cc.arduino.cli.commands.BurnBootloaderReq');
@ -1004,6 +1026,18 @@ boardListAll: {
responseSerialize: serialize_cc_arduino_cli_commands_BoardListAllResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_BoardListAllResp,
},
// Search boards in installed and not installed Platforms.
boardSearch: {
path: '/cc.arduino.cli.commands.ArduinoCore/BoardSearch',
requestStream: false,
responseStream: false,
requestType: commands_board_pb.BoardSearchReq,
responseType: commands_board_pb.BoardSearchResp,
requestSerialize: serialize_cc_arduino_cli_commands_BoardSearchReq,
requestDeserialize: deserialize_cc_arduino_cli_commands_BoardSearchReq,
responseSerialize: serialize_cc_arduino_cli_commands_BoardSearchResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_BoardSearchResp,
},
// List boards connection and disconnected events.
boardListWatch: {
path: '/cc.arduino.cli.commands.ArduinoCore/BoardListWatch',

View File

@ -348,9 +348,9 @@ export class OutdatedResp extends jspb.Message {
addOutdatedLibrary(value?: commands_lib_pb.InstalledLibrary, index?: number): commands_lib_pb.InstalledLibrary;
clearOutdatedPlatformList(): void;
getOutdatedPlatformList(): Array<commands_core_pb.Platform>;
setOutdatedPlatformList(value: Array<commands_core_pb.Platform>): OutdatedResp;
addOutdatedPlatform(value?: commands_core_pb.Platform, index?: number): commands_core_pb.Platform;
getOutdatedPlatformList(): Array<commands_common_pb.Platform>;
setOutdatedPlatformList(value: Array<commands_common_pb.Platform>): OutdatedResp;
addOutdatedPlatform(value?: commands_common_pb.Platform, index?: number): commands_common_pb.Platform;
serializeBinary(): Uint8Array;
@ -366,7 +366,7 @@ export class OutdatedResp extends jspb.Message {
export namespace OutdatedResp {
export type AsObject = {
outdatedLibraryList: Array<commands_lib_pb.InstalledLibrary.AsObject>,
outdatedPlatformList: Array<commands_core_pb.Platform.AsObject>,
outdatedPlatformList: Array<commands_common_pb.Platform.AsObject>,
}
}

View File

@ -2667,7 +2667,7 @@ proto.cc.arduino.cli.commands.OutdatedResp.toObject = function(includeInstance,
outdatedLibraryList: jspb.Message.toObjectList(msg.getOutdatedLibraryList(),
commands_lib_pb.InstalledLibrary.toObject, includeInstance),
outdatedPlatformList: jspb.Message.toObjectList(msg.getOutdatedPlatformList(),
commands_core_pb.Platform.toObject, includeInstance)
commands_common_pb.Platform.toObject, includeInstance)
};
if (includeInstance) {
@ -2710,8 +2710,8 @@ proto.cc.arduino.cli.commands.OutdatedResp.deserializeBinaryFromReader = functio
msg.addOutdatedLibrary(value);
break;
case 2:
var value = new commands_core_pb.Platform;
reader.readMessage(value,commands_core_pb.Platform.deserializeBinaryFromReader);
var value = new commands_common_pb.Platform;
reader.readMessage(value,commands_common_pb.Platform.deserializeBinaryFromReader);
msg.addOutdatedPlatform(value);
break;
default:
@ -2756,7 +2756,7 @@ proto.cc.arduino.cli.commands.OutdatedResp.serializeBinaryToWriter = function(me
writer.writeRepeatedMessage(
2,
f,
commands_core_pb.Platform.serializeBinaryToWriter
commands_common_pb.Platform.serializeBinaryToWriter
);
}
};
@ -2806,7 +2806,7 @@ proto.cc.arduino.cli.commands.OutdatedResp.prototype.clearOutdatedLibraryList =
*/
proto.cc.arduino.cli.commands.OutdatedResp.prototype.getOutdatedPlatformList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Platform>} */ (
jspb.Message.getRepeatedWrapperField(this, commands_core_pb.Platform, 2));
jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Platform, 2));
};

View File

@ -121,3 +121,83 @@ export namespace Programmer {
name: string,
}
}
export class Platform extends jspb.Message {
getId(): string;
setId(value: string): Platform;
getInstalled(): string;
setInstalled(value: string): Platform;
getLatest(): string;
setLatest(value: string): Platform;
getName(): string;
setName(value: string): Platform;
getMaintainer(): string;
setMaintainer(value: string): Platform;
getWebsite(): string;
setWebsite(value: string): Platform;
getEmail(): string;
setEmail(value: string): Platform;
clearBoardsList(): void;
getBoardsList(): Array<Board>;
setBoardsList(value: Array<Board>): Platform;
addBoards(value?: Board, index?: number): Board;
getManuallyinstalled(): boolean;
setManuallyinstalled(value: boolean): Platform;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Platform.AsObject;
static toObject(includeInstance: boolean, msg: Platform): Platform.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Platform, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Platform;
static deserializeBinaryFromReader(message: Platform, reader: jspb.BinaryReader): Platform;
}
export namespace Platform {
export type AsObject = {
id: string,
installed: string,
latest: string,
name: string,
maintainer: string,
website: string,
email: string,
boardsList: Array<Board.AsObject>,
manuallyinstalled: boolean,
}
}
export class Board extends jspb.Message {
getName(): string;
setName(value: string): Board;
getFqbn(): string;
setFqbn(value: string): Board;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Board.AsObject;
static toObject(includeInstance: boolean, msg: Board): Board.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Board, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Board;
static deserializeBinaryFromReader(message: Board, reader: jspb.BinaryReader): Board;
}
export namespace Board {
export type AsObject = {
name: string,
fqbn: string,
}
}

View File

@ -14,8 +14,10 @@ var jspb = require('google-protobuf');
var goog = jspb;
var global = Function('return this')();
goog.exportSymbol('proto.cc.arduino.cli.commands.Board', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.DownloadProgress', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Instance', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Platform', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Programmer', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.TaskProgress', null, global);
/**
@ -102,6 +104,48 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.Programmer.displayName = 'proto.cc.arduino.cli.commands.Programmer';
}
/**
* 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.Platform = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.Platform.repeatedFields_, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Platform, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Platform.displayName = 'proto.cc.arduino.cli.commands.Platform';
}
/**
* 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.Board = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Board, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Board.displayName = 'proto.cc.arduino.cli.commands.Board';
}
@ -862,4 +906,564 @@ proto.cc.arduino.cli.commands.Programmer.prototype.setName = function(value) {
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cc.arduino.cli.commands.Platform.repeatedFields_ = [8];
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_<name>, 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.Platform.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Platform.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.Platform} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Platform.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
installed: jspb.Message.getFieldWithDefault(msg, 2, ""),
latest: jspb.Message.getFieldWithDefault(msg, 3, ""),
name: jspb.Message.getFieldWithDefault(msg, 4, ""),
maintainer: jspb.Message.getFieldWithDefault(msg, 5, ""),
website: jspb.Message.getFieldWithDefault(msg, 6, ""),
email: jspb.Message.getFieldWithDefault(msg, 7, ""),
boardsList: jspb.Message.toObjectList(msg.getBoardsList(),
proto.cc.arduino.cli.commands.Board.toObject, includeInstance),
manuallyinstalled: jspb.Message.getBooleanFieldWithDefault(msg, 9, false)
};
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.Platform}
*/
proto.cc.arduino.cli.commands.Platform.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Platform;
return proto.cc.arduino.cli.commands.Platform.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.Platform} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Platform}
*/
proto.cc.arduino.cli.commands.Platform.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.setId(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setInstalled(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setLatest(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setMaintainer(value);
break;
case 6:
var value = /** @type {string} */ (reader.readString());
msg.setWebsite(value);
break;
case 7:
var value = /** @type {string} */ (reader.readString());
msg.setEmail(value);
break;
case 8:
var value = new proto.cc.arduino.cli.commands.Board;
reader.readMessage(value,proto.cc.arduino.cli.commands.Board.deserializeBinaryFromReader);
msg.addBoards(value);
break;
case 9:
var value = /** @type {boolean} */ (reader.readBool());
msg.setManuallyinstalled(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.Platform.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Platform.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.Platform} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Platform.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getInstalled();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getLatest();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getName();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getMaintainer();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getWebsite();
if (f.length > 0) {
writer.writeString(
6,
f
);
}
f = message.getEmail();
if (f.length > 0) {
writer.writeString(
7,
f
);
}
f = message.getBoardsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
8,
f,
proto.cc.arduino.cli.commands.Board.serializeBinaryToWriter
);
}
f = message.getManuallyinstalled();
if (f) {
writer.writeBool(
9,
f
);
}
};
/**
* optional string ID = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string Installed = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getInstalled = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setInstalled = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string Latest = 3;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getLatest = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setLatest = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string Name = 4;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional string Maintainer = 5;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getMaintainer = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setMaintainer = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* optional string Website = 6;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getWebsite = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setWebsite = function(value) {
return jspb.Message.setProto3StringField(this, 6, value);
};
/**
* optional string Email = 7;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getEmail = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setEmail = function(value) {
return jspb.Message.setProto3StringField(this, 7, value);
};
/**
* repeated Board Boards = 8;
* @return {!Array<!proto.cc.arduino.cli.commands.Board>}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getBoardsList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Board>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.Board, 8));
};
/**
* @param {!Array<!proto.cc.arduino.cli.commands.Board>} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setBoardsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 8, value);
};
/**
* @param {!proto.cc.arduino.cli.commands.Board=} opt_value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.Board}
*/
proto.cc.arduino.cli.commands.Platform.prototype.addBoards = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 8, opt_value, proto.cc.arduino.cli.commands.Board, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.clearBoardsList = function() {
return this.setBoardsList([]);
};
/**
* optional bool ManuallyInstalled = 9;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getManuallyinstalled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setManuallyinstalled = function(value) {
return jspb.Message.setProto3BooleanField(this, 9, 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_<name>, 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.Board.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Board.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.Board} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Board.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
fqbn: jspb.Message.getFieldWithDefault(msg, 2, "")
};
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.Board}
*/
proto.cc.arduino.cli.commands.Board.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Board;
return proto.cc.arduino.cli.commands.Board.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.Board} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Board}
*/
proto.cc.arduino.cli.commands.Board.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.setName(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setFqbn(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.Board.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Board.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.Board} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Board.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getFqbn();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Board.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Board} returns this
*/
proto.cc.arduino.cli.commands.Board.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string fqbn = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Board.prototype.getFqbn = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Board} returns this
*/
proto.cc.arduino.cli.commands.Board.prototype.setFqbn = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.commands);

View File

@ -295,9 +295,9 @@ export namespace PlatformSearchReq {
export class PlatformSearchResp extends jspb.Message {
clearSearchOutputList(): void;
getSearchOutputList(): Array<Platform>;
setSearchOutputList(value: Array<Platform>): PlatformSearchResp;
addSearchOutput(value?: Platform, index?: number): Platform;
getSearchOutputList(): Array<commands_common_pb.Platform>;
setSearchOutputList(value: Array<commands_common_pb.Platform>): PlatformSearchResp;
addSearchOutput(value?: commands_common_pb.Platform, index?: number): commands_common_pb.Platform;
serializeBinary(): Uint8Array;
@ -312,7 +312,7 @@ export class PlatformSearchResp extends jspb.Message {
export namespace PlatformSearchResp {
export type AsObject = {
searchOutputList: Array<Platform.AsObject>,
searchOutputList: Array<commands_common_pb.Platform.AsObject>,
}
}
@ -350,9 +350,9 @@ export namespace PlatformListReq {
export class PlatformListResp extends jspb.Message {
clearInstalledPlatformList(): void;
getInstalledPlatformList(): Array<Platform>;
setInstalledPlatformList(value: Array<Platform>): PlatformListResp;
addInstalledPlatform(value?: Platform, index?: number): Platform;
getInstalledPlatformList(): Array<commands_common_pb.Platform>;
setInstalledPlatformList(value: Array<commands_common_pb.Platform>): PlatformListResp;
addInstalledPlatform(value?: commands_common_pb.Platform, index?: number): commands_common_pb.Platform;
serializeBinary(): Uint8Array;
@ -367,86 +367,6 @@ export class PlatformListResp extends jspb.Message {
export namespace PlatformListResp {
export type AsObject = {
installedPlatformList: Array<Platform.AsObject>,
}
}
export class Platform extends jspb.Message {
getId(): string;
setId(value: string): Platform;
getInstalled(): string;
setInstalled(value: string): Platform;
getLatest(): string;
setLatest(value: string): Platform;
getName(): string;
setName(value: string): Platform;
getMaintainer(): string;
setMaintainer(value: string): Platform;
getWebsite(): string;
setWebsite(value: string): Platform;
getEmail(): string;
setEmail(value: string): Platform;
clearBoardsList(): void;
getBoardsList(): Array<Board>;
setBoardsList(value: Array<Board>): Platform;
addBoards(value?: Board, index?: number): Board;
getManuallyinstalled(): boolean;
setManuallyinstalled(value: boolean): Platform;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Platform.AsObject;
static toObject(includeInstance: boolean, msg: Platform): Platform.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Platform, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Platform;
static deserializeBinaryFromReader(message: Platform, reader: jspb.BinaryReader): Platform;
}
export namespace Platform {
export type AsObject = {
id: string,
installed: string,
latest: string,
name: string,
maintainer: string,
website: string,
email: string,
boardsList: Array<Board.AsObject>,
manuallyinstalled: boolean,
}
}
export class Board extends jspb.Message {
getName(): string;
setName(value: string): Board;
getFqbn(): string;
setFqbn(value: string): Board;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): Board.AsObject;
static toObject(includeInstance: boolean, msg: Board): Board.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: Board, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): Board;
static deserializeBinaryFromReader(message: Board, reader: jspb.BinaryReader): Board;
}
export namespace Board {
export type AsObject = {
name: string,
fqbn: string,
installedPlatformList: Array<commands_common_pb.Platform.AsObject>,
}
}

View File

@ -16,8 +16,6 @@ var global = Function('return this')();
var commands_common_pb = require('../commands/common_pb.js');
goog.object.extend(proto, commands_common_pb);
goog.exportSymbol('proto.cc.arduino.cli.commands.Board', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.Platform', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.PlatformDownloadReq', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.PlatformDownloadResp', null, global);
goog.exportSymbol('proto.cc.arduino.cli.commands.PlatformInstallReq', null, global);
@ -282,48 +280,6 @@ if (goog.DEBUG && !COMPILED) {
*/
proto.cc.arduino.cli.commands.PlatformListResp.displayName = 'proto.cc.arduino.cli.commands.PlatformListResp';
}
/**
* 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.Platform = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.cc.arduino.cli.commands.Platform.repeatedFields_, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Platform, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Platform.displayName = 'proto.cc.arduino.cli.commands.Platform';
}
/**
* 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.Board = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.cc.arduino.cli.commands.Board, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.cc.arduino.cli.commands.Board.displayName = 'proto.cc.arduino.cli.commands.Board';
}
@ -2245,7 +2201,7 @@ proto.cc.arduino.cli.commands.PlatformSearchResp.prototype.toObject = function(o
proto.cc.arduino.cli.commands.PlatformSearchResp.toObject = function(includeInstance, msg) {
var f, obj = {
searchOutputList: jspb.Message.toObjectList(msg.getSearchOutputList(),
proto.cc.arduino.cli.commands.Platform.toObject, includeInstance)
commands_common_pb.Platform.toObject, includeInstance)
};
if (includeInstance) {
@ -2283,8 +2239,8 @@ proto.cc.arduino.cli.commands.PlatformSearchResp.deserializeBinaryFromReader = f
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.commands.Platform;
reader.readMessage(value,proto.cc.arduino.cli.commands.Platform.deserializeBinaryFromReader);
var value = new commands_common_pb.Platform;
reader.readMessage(value,commands_common_pb.Platform.deserializeBinaryFromReader);
msg.addSearchOutput(value);
break;
default:
@ -2321,7 +2277,7 @@ proto.cc.arduino.cli.commands.PlatformSearchResp.serializeBinaryToWriter = funct
writer.writeRepeatedMessage(
1,
f,
proto.cc.arduino.cli.commands.Platform.serializeBinaryToWriter
commands_common_pb.Platform.serializeBinaryToWriter
);
}
};
@ -2333,7 +2289,7 @@ proto.cc.arduino.cli.commands.PlatformSearchResp.serializeBinaryToWriter = funct
*/
proto.cc.arduino.cli.commands.PlatformSearchResp.prototype.getSearchOutputList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Platform>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.Platform, 1));
jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Platform, 1));
};
@ -2616,7 +2572,7 @@ proto.cc.arduino.cli.commands.PlatformListResp.prototype.toObject = function(opt
proto.cc.arduino.cli.commands.PlatformListResp.toObject = function(includeInstance, msg) {
var f, obj = {
installedPlatformList: jspb.Message.toObjectList(msg.getInstalledPlatformList(),
proto.cc.arduino.cli.commands.Platform.toObject, includeInstance)
commands_common_pb.Platform.toObject, includeInstance)
};
if (includeInstance) {
@ -2654,8 +2610,8 @@ proto.cc.arduino.cli.commands.PlatformListResp.deserializeBinaryFromReader = fun
var field = reader.getFieldNumber();
switch (field) {
case 1:
var value = new proto.cc.arduino.cli.commands.Platform;
reader.readMessage(value,proto.cc.arduino.cli.commands.Platform.deserializeBinaryFromReader);
var value = new commands_common_pb.Platform;
reader.readMessage(value,commands_common_pb.Platform.deserializeBinaryFromReader);
msg.addInstalledPlatform(value);
break;
default:
@ -2692,7 +2648,7 @@ proto.cc.arduino.cli.commands.PlatformListResp.serializeBinaryToWriter = functio
writer.writeRepeatedMessage(
1,
f,
proto.cc.arduino.cli.commands.Platform.serializeBinaryToWriter
commands_common_pb.Platform.serializeBinaryToWriter
);
}
};
@ -2704,7 +2660,7 @@ proto.cc.arduino.cli.commands.PlatformListResp.serializeBinaryToWriter = functio
*/
proto.cc.arduino.cli.commands.PlatformListResp.prototype.getInstalledPlatformList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Platform>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.Platform, 1));
jspb.Message.getRepeatedWrapperField(this, commands_common_pb.Platform, 1));
};
@ -2736,564 +2692,4 @@ proto.cc.arduino.cli.commands.PlatformListResp.prototype.clearInstalledPlatformL
};
/**
* List of repeated fields within this message type.
* @private {!Array<number>}
* @const
*/
proto.cc.arduino.cli.commands.Platform.repeatedFields_ = [8];
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_<name>, 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.Platform.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Platform.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.Platform} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Platform.toObject = function(includeInstance, msg) {
var f, obj = {
id: jspb.Message.getFieldWithDefault(msg, 1, ""),
installed: jspb.Message.getFieldWithDefault(msg, 2, ""),
latest: jspb.Message.getFieldWithDefault(msg, 3, ""),
name: jspb.Message.getFieldWithDefault(msg, 4, ""),
maintainer: jspb.Message.getFieldWithDefault(msg, 5, ""),
website: jspb.Message.getFieldWithDefault(msg, 6, ""),
email: jspb.Message.getFieldWithDefault(msg, 7, ""),
boardsList: jspb.Message.toObjectList(msg.getBoardsList(),
proto.cc.arduino.cli.commands.Board.toObject, includeInstance),
manuallyinstalled: jspb.Message.getBooleanFieldWithDefault(msg, 9, false)
};
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.Platform}
*/
proto.cc.arduino.cli.commands.Platform.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Platform;
return proto.cc.arduino.cli.commands.Platform.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.Platform} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Platform}
*/
proto.cc.arduino.cli.commands.Platform.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.setId(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setInstalled(value);
break;
case 3:
var value = /** @type {string} */ (reader.readString());
msg.setLatest(value);
break;
case 4:
var value = /** @type {string} */ (reader.readString());
msg.setName(value);
break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.setMaintainer(value);
break;
case 6:
var value = /** @type {string} */ (reader.readString());
msg.setWebsite(value);
break;
case 7:
var value = /** @type {string} */ (reader.readString());
msg.setEmail(value);
break;
case 8:
var value = new proto.cc.arduino.cli.commands.Board;
reader.readMessage(value,proto.cc.arduino.cli.commands.Board.deserializeBinaryFromReader);
msg.addBoards(value);
break;
case 9:
var value = /** @type {boolean} */ (reader.readBool());
msg.setManuallyinstalled(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.Platform.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Platform.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.Platform} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Platform.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getId();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getInstalled();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
f = message.getLatest();
if (f.length > 0) {
writer.writeString(
3,
f
);
}
f = message.getName();
if (f.length > 0) {
writer.writeString(
4,
f
);
}
f = message.getMaintainer();
if (f.length > 0) {
writer.writeString(
5,
f
);
}
f = message.getWebsite();
if (f.length > 0) {
writer.writeString(
6,
f
);
}
f = message.getEmail();
if (f.length > 0) {
writer.writeString(
7,
f
);
}
f = message.getBoardsList();
if (f.length > 0) {
writer.writeRepeatedMessage(
8,
f,
proto.cc.arduino.cli.commands.Board.serializeBinaryToWriter
);
}
f = message.getManuallyinstalled();
if (f) {
writer.writeBool(
9,
f
);
}
};
/**
* optional string ID = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getId = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setId = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string Installed = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getInstalled = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setInstalled = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
/**
* optional string Latest = 3;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getLatest = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setLatest = function(value) {
return jspb.Message.setProto3StringField(this, 3, value);
};
/**
* optional string Name = 4;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 4, value);
};
/**
* optional string Maintainer = 5;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getMaintainer = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 5, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setMaintainer = function(value) {
return jspb.Message.setProto3StringField(this, 5, value);
};
/**
* optional string Website = 6;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getWebsite = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 6, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setWebsite = function(value) {
return jspb.Message.setProto3StringField(this, 6, value);
};
/**
* optional string Email = 7;
* @return {string}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getEmail = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 7, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setEmail = function(value) {
return jspb.Message.setProto3StringField(this, 7, value);
};
/**
* repeated Board Boards = 8;
* @return {!Array<!proto.cc.arduino.cli.commands.Board>}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getBoardsList = function() {
return /** @type{!Array<!proto.cc.arduino.cli.commands.Board>} */ (
jspb.Message.getRepeatedWrapperField(this, proto.cc.arduino.cli.commands.Board, 8));
};
/**
* @param {!Array<!proto.cc.arduino.cli.commands.Board>} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setBoardsList = function(value) {
return jspb.Message.setRepeatedWrapperField(this, 8, value);
};
/**
* @param {!proto.cc.arduino.cli.commands.Board=} opt_value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.Board}
*/
proto.cc.arduino.cli.commands.Platform.prototype.addBoards = function(opt_value, opt_index) {
return jspb.Message.addToRepeatedWrapperField(this, 8, opt_value, proto.cc.arduino.cli.commands.Board, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.clearBoardsList = function() {
return this.setBoardsList([]);
};
/**
* optional bool ManuallyInstalled = 9;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.Platform.prototype.getManuallyinstalled = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 9, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.Platform} returns this
*/
proto.cc.arduino.cli.commands.Platform.prototype.setManuallyinstalled = function(value) {
return jspb.Message.setProto3BooleanField(this, 9, 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_<name>, 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.Board.prototype.toObject = function(opt_includeInstance) {
return proto.cc.arduino.cli.commands.Board.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.Board} msg The msg instance to transform.
* @return {!Object}
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Board.toObject = function(includeInstance, msg) {
var f, obj = {
name: jspb.Message.getFieldWithDefault(msg, 1, ""),
fqbn: jspb.Message.getFieldWithDefault(msg, 2, "")
};
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.Board}
*/
proto.cc.arduino.cli.commands.Board.deserializeBinary = function(bytes) {
var reader = new jspb.BinaryReader(bytes);
var msg = new proto.cc.arduino.cli.commands.Board;
return proto.cc.arduino.cli.commands.Board.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.Board} msg The message object to deserialize into.
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
* @return {!proto.cc.arduino.cli.commands.Board}
*/
proto.cc.arduino.cli.commands.Board.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.setName(value);
break;
case 2:
var value = /** @type {string} */ (reader.readString());
msg.setFqbn(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.Board.prototype.serializeBinary = function() {
var writer = new jspb.BinaryWriter();
proto.cc.arduino.cli.commands.Board.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.Board} message
* @param {!jspb.BinaryWriter} writer
* @suppress {unusedLocalVariables} f is only used for nested messages
*/
proto.cc.arduino.cli.commands.Board.serializeBinaryToWriter = function(message, writer) {
var f = undefined;
f = message.getName();
if (f.length > 0) {
writer.writeString(
1,
f
);
}
f = message.getFqbn();
if (f.length > 0) {
writer.writeString(
2,
f
);
}
};
/**
* optional string name = 1;
* @return {string}
*/
proto.cc.arduino.cli.commands.Board.prototype.getName = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 1, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Board} returns this
*/
proto.cc.arduino.cli.commands.Board.prototype.setName = function(value) {
return jspb.Message.setProto3StringField(this, 1, value);
};
/**
* optional string fqbn = 2;
* @return {string}
*/
proto.cc.arduino.cli.commands.Board.prototype.getFqbn = function() {
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 2, ""));
};
/**
* @param {string} value
* @return {!proto.cc.arduino.cli.commands.Board} returns this
*/
proto.cc.arduino.cli.commands.Board.prototype.setFqbn = function(value) {
return jspb.Message.setProto3StringField(this, 2, value);
};
goog.object.extend(exports, proto.cc.arduino.cli.commands);

View File

@ -793,6 +793,9 @@ export class ZipLibraryInstallReq extends jspb.Message {
getPath(): string;
setPath(value: string): ZipLibraryInstallReq;
getOverwrite(): boolean;
setOverwrite(value: boolean): ZipLibraryInstallReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): ZipLibraryInstallReq.AsObject;
@ -808,6 +811,7 @@ export namespace ZipLibraryInstallReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
path: string,
overwrite: boolean,
}
}
@ -845,6 +849,9 @@ export class GitLibraryInstallReq extends jspb.Message {
getUrl(): string;
setUrl(value: string): GitLibraryInstallReq;
getOverwrite(): boolean;
setOverwrite(value: boolean): GitLibraryInstallReq;
serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): GitLibraryInstallReq.AsObject;
@ -860,6 +867,7 @@ export namespace GitLibraryInstallReq {
export type AsObject = {
instance?: commands_common_pb.Instance.AsObject,
url: string,
overwrite: boolean,
}
}

View File

@ -5878,7 +5878,8 @@ proto.cc.arduino.cli.commands.ZipLibraryInstallReq.prototype.toObject = function
proto.cc.arduino.cli.commands.ZipLibraryInstallReq.toObject = function(includeInstance, msg) {
var f, obj = {
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
path: jspb.Message.getFieldWithDefault(msg, 2, "")
path: jspb.Message.getFieldWithDefault(msg, 2, ""),
overwrite: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
};
if (includeInstance) {
@ -5924,6 +5925,10 @@ proto.cc.arduino.cli.commands.ZipLibraryInstallReq.deserializeBinaryFromReader =
var value = /** @type {string} */ (reader.readString());
msg.setPath(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setOverwrite(value);
break;
default:
reader.skipField();
break;
@ -5968,6 +5973,13 @@ proto.cc.arduino.cli.commands.ZipLibraryInstallReq.serializeBinaryToWriter = fun
f
);
}
f = message.getOverwrite();
if (f) {
writer.writeBool(
3,
f
);
}
};
@ -6026,6 +6038,24 @@ proto.cc.arduino.cli.commands.ZipLibraryInstallReq.prototype.setPath = function(
};
/**
* optional bool overwrite = 3;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.ZipLibraryInstallReq.prototype.getOverwrite = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.ZipLibraryInstallReq} returns this
*/
proto.cc.arduino.cli.commands.ZipLibraryInstallReq.prototype.setOverwrite = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};
@ -6210,7 +6240,8 @@ proto.cc.arduino.cli.commands.GitLibraryInstallReq.prototype.toObject = function
proto.cc.arduino.cli.commands.GitLibraryInstallReq.toObject = function(includeInstance, msg) {
var f, obj = {
instance: (f = msg.getInstance()) && commands_common_pb.Instance.toObject(includeInstance, f),
url: jspb.Message.getFieldWithDefault(msg, 2, "")
url: jspb.Message.getFieldWithDefault(msg, 2, ""),
overwrite: jspb.Message.getBooleanFieldWithDefault(msg, 3, false)
};
if (includeInstance) {
@ -6256,6 +6287,10 @@ proto.cc.arduino.cli.commands.GitLibraryInstallReq.deserializeBinaryFromReader =
var value = /** @type {string} */ (reader.readString());
msg.setUrl(value);
break;
case 3:
var value = /** @type {boolean} */ (reader.readBool());
msg.setOverwrite(value);
break;
default:
reader.skipField();
break;
@ -6300,6 +6335,13 @@ proto.cc.arduino.cli.commands.GitLibraryInstallReq.serializeBinaryToWriter = fun
f
);
}
f = message.getOverwrite();
if (f) {
writer.writeBool(
3,
f
);
}
};
@ -6358,6 +6400,24 @@ proto.cc.arduino.cli.commands.GitLibraryInstallReq.prototype.setUrl = function(v
};
/**
* optional bool overwrite = 3;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.GitLibraryInstallReq.prototype.getOverwrite = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 3, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.GitLibraryInstallReq} returns this
*/
proto.cc.arduino.cli.commands.GitLibraryInstallReq.prototype.setOverwrite = function(value) {
return jspb.Message.setProto3BooleanField(this, 3, value);
};

View File

@ -1,5 +1,4 @@
import { injectable, inject } from 'inversify';
import * as path from 'path';
import { LibraryDependency, LibraryPackage, LibraryService } from '../common/protocol/library-service';
import { CoreClientAware } from './core-client-provider';
import {
@ -196,12 +195,15 @@ export class LibraryServiceImpl extends CoreClientAware implements LibraryServic
console.info('<<< Library package installation done.', item);
}
async installZip({ zipUri }: { zipUri: string }): Promise<void> {
async installZip({ zipUri, overwrite }: { zipUri: string, overwrite?: boolean }): Promise<void> {
const coreClient = await this.coreClient();
const { client, instance } = coreClient;
const req = new ZipLibraryInstallReq();
req.setPath(FileUri.fsPath(zipUri));
req.setInstance(instance);
if (typeof overwrite === 'boolean') {
req.setOverwrite(overwrite);
}
const resp = client.zipLibraryInstall(req);
resp.on('data', (r: ZipLibraryInstallResp) => {
const task = r.getTaskProgress();
@ -211,19 +213,7 @@ export class LibraryServiceImpl extends CoreClientAware implements LibraryServic
});
await new Promise<void>((resolve, reject) => {
resp.on('end', resolve);
resp.on('error', error => {
// This is a hack to have better error messages for the user. We try to get the name of the library from this:
// Request installZip failed with error: 2 UNKNOWN: copying library: destination /path/to/lib already exists
const match = error.message.match(/destination (.*?) already exists/);
if (match && match.length >= 2) {
const name = path.basename(match[1].trim());
if (name) {
reject(new Error(`A library named ${name} already exists.`));
return;
}
}
reject(error);
});
resp.on('error', reject);
});
}