Skip to content

[ATL-1531] Integrate arduino-cli 0.19.0 #505

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"tslint.enable": true,
"tslint.configFile": "./tslint.json",
"editor.formatOnSave": true,
"files.exclude": {
"**/lib": false
},
Expand Down
2 changes: 1 addition & 1 deletion arduino-ide-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
],
"arduino": {
"cli": {
"version": "0.18.3"
"version": "0.19.0"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class BurnBootloader extends SketchContribution {
}
try {
const { boardsConfig } = this.boardsServiceClientImpl;
const port = boardsConfig.selectedPort?.address;
const port = boardsConfig.selectedPort;
const [fqbn, { selectedProgrammer: programmer }, verify, verbose] = await Promise.all([
this.boardsDataStore.appendConfigToFqbn(boardsConfig.selectedBoard?.fqbn),
this.boardsDataStore.getData(boardsConfig.selectedBoard?.fqbn),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export class UploadSketch extends SketchContribution {
const sketchUri = sketch.uri;
const optimizeForDebug = this.editorMode.compileForDebug;
const { selectedPort } = boardsConfig;
const port = selectedPort?.address;
const port = selectedPort;

if (usingProgrammer) {
const programmer = selectedProgrammer;
Expand Down
5 changes: 3 additions & 2 deletions arduino-ide-extension/src/common/protocol/core-service.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Port} from '../../common/protocol/boards-service';
import { Programmer } from './boards-service';

export const CompilerWarningLiterals = ['None', 'Default', 'More', 'All'] as const;
Expand Down Expand Up @@ -29,7 +30,7 @@ export namespace CoreService {

export namespace Upload {
export interface Options extends Compile.Options {
readonly port?: string | undefined;
readonly port?: Port | undefined;
readonly programmer?: Programmer | undefined;
readonly verify: boolean;
}
Expand All @@ -38,7 +39,7 @@ export namespace CoreService {
export namespace Bootloader {
export interface Options {
readonly fqbn?: string | undefined;
readonly port?: string | undefined;
readonly port?: Port | undefined;
readonly programmer?: Programmer | undefined;
readonly verbose: boolean;
readonly verify: boolean;
Expand Down
7 changes: 4 additions & 3 deletions arduino-ide-extension/src/node/board-discovery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class BoardDiscovery extends CoreClientAware {

@postConstruct()
protected async init(): Promise<void> {
await this.coreClientProvider.initialized;
const coreClient = await this.coreClient();
const { client, instance } = coreClient;
const req = new BoardListWatchRequest();
Expand All @@ -66,12 +67,12 @@ export class BoardDiscovery extends CoreClientAware {
const oldState = deepClone(this._state);
const newState = deepClone(this._state);

const address = detectedPort.getAddress();
const protocol = Port.Protocol.toProtocol(detectedPort.getProtocol());
const address = (detectedPort as any).getPort().getAddress();
const protocol = Port.Protocol.toProtocol((detectedPort as any).getPort().getProtocol());
// const label = detectedPort.getProtocolLabel();
const port = { address, protocol };
const boards: Board[] = [];
for (const item of detectedPort.getBoardsList()) {
for (const item of detectedPort.getMatchingBoardsList()) {
boards.push({ fqbn: item.getFqbn(), name: item.getName() || 'unknown', port });
}

Expand Down
13 changes: 9 additions & 4 deletions arduino-ide-extension/src/node/boards-service-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
}

async getBoardDetails(options: { fqbn: string }): Promise<BoardDetails | undefined> {
await this.coreClientProvider.initialized;
const coreClient = await this.coreClient();
const { client, instance } = coreClient;
const { fqbn } = options;
Expand Down Expand Up @@ -116,10 +117,10 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService

let VID = 'N/A';
let PID = 'N/A';
const usbId = detailsResp.getIdentificationPrefsList().map(item => item.getUsbId()).find(notEmpty);
if (usbId) {
VID = usbId.getVid();
PID = usbId.getPid();
const prop = detailsResp.getIdentificationPropertiesList().map(item => item.getPropertiesMap()).find(notEmpty);
if (prop) {
VID = prop.get('vid') || '';
PID = prop.get('pid') || '';
}

return {
Expand Down Expand Up @@ -152,6 +153,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
}

async searchBoards({ query }: { query?: string }): Promise<BoardWithPackage[]> {
await this.coreClientProvider.initialized;
const { instance, client } = await this.coreClient();
const req = new BoardSearchRequest();
req.setSearchArgs(query || '');
Expand Down Expand Up @@ -181,6 +183,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
}

async search(options: { query?: string }): Promise<BoardsPackage[]> {
await this.coreClientProvider.initialized;
const coreClient = await this.coreClient();
const { client, instance } = coreClient;

Expand Down Expand Up @@ -264,6 +267,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService
async install(options: { item: BoardsPackage, progressId?: string, version?: Installable.Version }): Promise<void> {
const item = options.item;
const version = !!options.version ? options.version : item.availableVersions[0];
await this.coreClientProvider.initialized;
const coreClient = await this.coreClient();
const { client, instance } = coreClient;

Expand Down Expand Up @@ -295,6 +299,7 @@ export class BoardsServiceImpl extends CoreClientAware implements BoardsService

async uninstall(options: { item: BoardsPackage, progressId?: string }): Promise<void> {
const { item, progressId } = options;
await this.coreClientProvider.initialized;
const coreClient = await this.coreClient();
const { client, instance } = coreClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import * as jspb from "google-protobuf";
import * as cc_arduino_cli_commands_v1_common_pb from "../../../../../cc/arduino/cli/commands/v1/common_pb";
import * as cc_arduino_cli_commands_v1_port_pb from "../../../../../cc/arduino/cli/commands/v1/port_pb";

export class BoardDetailsRequest extends jspb.Message {

Expand Down Expand Up @@ -79,11 +80,6 @@ export class BoardDetailsResponse extends jspb.Message {
setConfigOptionsList(value: Array<ConfigOption>): BoardDetailsResponse;
addConfigOptions(value?: ConfigOption, index?: number): ConfigOption;

clearIdentificationPrefsList(): void;
getIdentificationPrefsList(): Array<IdentificationPref>;
setIdentificationPrefsList(value: Array<IdentificationPref>): BoardDetailsResponse;
addIdentificationPrefs(value?: IdentificationPref, index?: number): IdentificationPref;

clearProgrammersList(): void;
getProgrammersList(): Array<cc_arduino_cli_commands_v1_common_pb.Programmer>;
setProgrammersList(value: Array<cc_arduino_cli_commands_v1_common_pb.Programmer>): BoardDetailsResponse;
Expand All @@ -92,6 +88,11 @@ export class BoardDetailsResponse extends jspb.Message {
getDebuggingSupported(): boolean;
setDebuggingSupported(value: boolean): BoardDetailsResponse;

clearIdentificationPropertiesList(): void;
getIdentificationPropertiesList(): Array<BoardIdentificationProperties>;
setIdentificationPropertiesList(value: Array<BoardIdentificationProperties>): BoardDetailsResponse;
addIdentificationProperties(value?: BoardIdentificationProperties, index?: number): BoardIdentificationProperties;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardDetailsResponse.AsObject;
Expand All @@ -116,58 +117,32 @@ export namespace BoardDetailsResponse {
platform?: BoardPlatform.AsObject,
toolsDependenciesList: Array<ToolsDependencies.AsObject>,
configOptionsList: Array<ConfigOption.AsObject>,
identificationPrefsList: Array<IdentificationPref.AsObject>,
programmersList: Array<cc_arduino_cli_commands_v1_common_pb.Programmer.AsObject>,
debuggingSupported: boolean,
identificationPropertiesList: Array<BoardIdentificationProperties.AsObject>,
}
}

export class IdentificationPref extends jspb.Message {
export class BoardIdentificationProperties extends jspb.Message {

hasUsbId(): boolean;
clearUsbId(): void;
getUsbId(): USBID | undefined;
setUsbId(value?: USBID): IdentificationPref;
getPropertiesMap(): jspb.Map<string, string>;
clearPropertiesMap(): void;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): IdentificationPref.AsObject;
static toObject(includeInstance: boolean, msg: IdentificationPref): IdentificationPref.AsObject;
toObject(includeInstance?: boolean): BoardIdentificationProperties.AsObject;
static toObject(includeInstance: boolean, msg: BoardIdentificationProperties): BoardIdentificationProperties.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: IdentificationPref, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): IdentificationPref;
static deserializeBinaryFromReader(message: IdentificationPref, reader: jspb.BinaryReader): IdentificationPref;
static serializeBinaryToWriter(message: BoardIdentificationProperties, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): BoardIdentificationProperties;
static deserializeBinaryFromReader(message: BoardIdentificationProperties, reader: jspb.BinaryReader): BoardIdentificationProperties;
}

export namespace IdentificationPref {
export namespace BoardIdentificationProperties {
export type AsObject = {
usbId?: USBID.AsObject,
}
}

export class USBID extends jspb.Message {
getVid(): string;
setVid(value: string): USBID;

getPid(): string;
setPid(value: string): USBID;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): USBID.AsObject;
static toObject(includeInstance: boolean, msg: USBID): USBID.AsObject;
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
static serializeBinaryToWriter(message: USBID, writer: jspb.BinaryWriter): void;
static deserializeBinary(bytes: Uint8Array): USBID;
static deserializeBinaryFromReader(message: USBID, reader: jspb.BinaryReader): USBID;
}

export namespace USBID {
export type AsObject = {
vid: string,
pid: string,
propertiesMap: Array<[string, string]>,
}
}

Expand Down Expand Up @@ -480,6 +455,9 @@ export class BoardListRequest extends jspb.Message {
getInstance(): cc_arduino_cli_commands_v1_common_pb.Instance | undefined;
setInstance(value?: cc_arduino_cli_commands_v1_common_pb.Instance): BoardListRequest;

getTimeout(): number;
setTimeout(value: number): BoardListRequest;


serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): BoardListRequest.AsObject;
Expand All @@ -494,6 +472,7 @@ export class BoardListRequest extends jspb.Message {
export namespace BoardListRequest {
export type AsObject = {
instance?: cc_arduino_cli_commands_v1_common_pb.Instance.AsObject,
timeout: number,
}
}

Expand Down Expand Up @@ -521,22 +500,16 @@ export namespace BoardListResponse {
}

export class DetectedPort extends jspb.Message {
getAddress(): string;
setAddress(value: string): DetectedPort;

getProtocol(): string;
setProtocol(value: string): DetectedPort;
clearMatchingBoardsList(): void;
getMatchingBoardsList(): Array<BoardListItem>;
setMatchingBoardsList(value: Array<BoardListItem>): DetectedPort;
addMatchingBoards(value?: BoardListItem, index?: number): BoardListItem;

getProtocolLabel(): string;
setProtocolLabel(value: string): DetectedPort;

clearBoardsList(): void;
getBoardsList(): Array<BoardListItem>;
setBoardsList(value: Array<BoardListItem>): DetectedPort;
addBoards(value?: BoardListItem, index?: number): BoardListItem;

getSerialNumber(): string;
setSerialNumber(value: string): DetectedPort;
hasPort(): boolean;
clearPort(): void;
getPort(): cc_arduino_cli_commands_v1_port_pb.Port | undefined;
setPort(value?: cc_arduino_cli_commands_v1_port_pb.Port): DetectedPort;


serializeBinary(): Uint8Array;
Expand All @@ -551,11 +524,8 @@ export class DetectedPort extends jspb.Message {

export namespace DetectedPort {
export type AsObject = {
address: string,
protocol: string,
protocolLabel: string,
boardsList: Array<BoardListItem.AsObject>,
serialNumber: string,
matchingBoardsList: Array<BoardListItem.AsObject>,
port?: cc_arduino_cli_commands_v1_port_pb.Port.AsObject,
}
}

Expand Down Expand Up @@ -686,12 +656,6 @@ export class BoardListItem extends jspb.Message {
getIsHidden(): boolean;
setIsHidden(value: boolean): BoardListItem;

getVid(): string;
setVid(value: string): BoardListItem;

getPid(): string;
setPid(value: string): BoardListItem;


hasPlatform(): boolean;
clearPlatform(): void;
Expand All @@ -714,8 +678,6 @@ export namespace BoardListItem {
name: string,
fqbn: string,
isHidden: boolean,
vid: string,
pid: string,
platform?: cc_arduino_cli_commands_v1_common_pb.Platform.AsObject,
}
}
Expand Down
Loading