Skip to content

Commit 9f7feff

Browse files
author
Akos Kitta
committed
chore: use 0.35.0-rc.3 CLI
1 parent 1cfca23 commit 9f7feff

File tree

10 files changed

+218
-13
lines changed

10 files changed

+218
-13
lines changed

Diff for: arduino-ide-extension/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
],
170170
"arduino": {
171171
"arduino-cli": {
172-
"version": "0.35.0-rc.2"
172+
"version": "0.35.0-rc.3"
173173
},
174174
"arduino-fwuploader": {
175175
"version": "2.4.1"

Diff for: arduino-ide-extension/src/browser/boards/boards-data-store.ts

+25-3
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,16 @@ export class BoardsDataStore implements FrontendApplicationContribution {
9999
return BoardsDataStore.Data.EMPTY;
100100
}
101101

102+
const { programmers, defaultProgrammerId, configOptions } = boardDetails;
103+
const selectedProgrammer = findDefaultProgrammer(
104+
programmers,
105+
defaultProgrammerId
106+
);
102107
data = {
103-
configOptions: boardDetails.configOptions,
104-
programmers: boardDetails.programmers,
105-
selectedProgrammer: boardDetails.programmers.find((p) => p.default),
108+
configOptions,
109+
programmers,
110+
selectedProgrammer,
111+
defaultProgrammerId,
106112
};
107113
await this.storageService.setData(key, data);
108114
return data;
@@ -210,11 +216,13 @@ export namespace BoardsDataStore {
210216
readonly configOptions: ConfigOption[];
211217
readonly programmers: Programmer[];
212218
readonly selectedProgrammer?: Programmer;
219+
readonly defaultProgrammerId: string | undefined;
213220
}
214221
export namespace Data {
215222
export const EMPTY: Data = {
216223
configOptions: [],
217224
programmers: [],
225+
defaultProgrammerId: undefined,
218226
};
219227
export function is(arg: unknown): arg is Data {
220228
return (
@@ -236,3 +244,17 @@ export function isEmptyData(data: BoardsDataStore.Data): boolean {
236244
Boolean(!data.selectedProgrammer)
237245
);
238246
}
247+
248+
export function findDefaultProgrammer(
249+
programmers: readonly Programmer[],
250+
defaultProgrammerId: string | undefined | BoardsDataStore.Data
251+
): Programmer | undefined {
252+
if (!defaultProgrammerId) {
253+
return undefined;
254+
}
255+
const id =
256+
typeof defaultProgrammerId === 'string'
257+
? defaultProgrammerId
258+
: defaultProgrammerId.defaultProgrammerId;
259+
return programmers.find((p) => p.id === id);
260+
}

Diff for: arduino-ide-extension/src/browser/contributions/auto-select-programmer.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import {
55
Programmer,
66
isBoardIdentifierChangeEvent,
77
} from '../../common/protocol';
8-
import { BoardsDataStore, isEmptyData } from '../boards/boards-data-store';
8+
import {
9+
BoardsDataStore,
10+
findDefaultProgrammer,
11+
isEmptyData,
12+
} from '../boards/boards-data-store';
913
import { BoardsServiceProvider } from '../boards/boards-service-provider';
1014
import { Contribution } from './contribution';
1115

@@ -75,7 +79,7 @@ export async function ensureProgrammerIsSelected(
7579
);
7680
return true;
7781
}
78-
let programmer = data.programmers.find((p) => p.default);
82+
let programmer = findDefaultProgrammer(data.programmers, data);
7983
if (programmer) {
8084
// select the programmer if the default info is available
8185
const result = await selectProgrammer({
@@ -97,7 +101,7 @@ export async function ensureProgrammerIsSelected(
97101
console.debug(`Skipping. ${fqbn} does not have programmers.`);
98102
return false;
99103
}
100-
programmer = reloadedData.programmers.find((p) => p.default);
104+
programmer = findDefaultProgrammer(reloadedData.programmers, reloadedData);
101105
if (!programmer) {
102106
console.debug(
103107
`Skipping. Could not find a default programmer for ${fqbn}. Programmers were: `

Diff for: arduino-ide-extension/src/common/protocol/boards-service.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ export interface BoardDetails {
334334
readonly VID: string;
335335
readonly PID: string;
336336
readonly buildProperties: string[];
337+
readonly defaultProgrammerId: string | undefined;
337338
}
338339

339340
export interface Tool {
@@ -406,7 +407,6 @@ export interface Programmer {
406407
readonly name: string;
407408
readonly platform: string;
408409
readonly id: string;
409-
readonly default?: boolean;
410410
}
411411
export namespace Programmer {
412412
export function equals(
@@ -435,9 +435,7 @@ export function isProgrammer(arg: unknown): arg is Programmer {
435435
(<Programmer>arg).name !== undefined &&
436436
typeof (<Programmer>arg).name === 'string' &&
437437
(<Programmer>arg).platform !== undefined &&
438-
typeof (<Programmer>arg).platform === 'string' &&
439-
((<Programmer>arg).default === undefined ||
440-
typeof (<Programmer>arg).default === 'boolean')
438+
typeof (<Programmer>arg).platform === 'string'
441439
);
442440
}
443441

Diff for: arduino-ide-extension/src/node/boards-service-impl.ts

+4
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ export class BoardsServiceImpl
146146
platform: p.getPlatform(),
147147
}
148148
);
149+
const defaultProgrammerId = detailsResp.getDefaultProgrammerId();
149150

150151
let VID = 'N/A';
151152
let PID = 'N/A';
@@ -168,6 +169,9 @@ export class BoardsServiceImpl
168169
VID,
169170
PID,
170171
buildProperties,
172+
defaultProgrammerId: defaultProgrammerId
173+
? defaultProgrammerId
174+
: undefined,
171175
};
172176
}
173177

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.d.ts

+3
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ export class BoardDetailsResponse extends jspb.Message {
8484
getBuildPropertiesList(): Array<string>;
8585
setBuildPropertiesList(value: Array<string>): BoardDetailsResponse;
8686
addBuildProperties(value: string, index?: number): string;
87+
getDefaultProgrammerId(): string;
88+
setDefaultProgrammerId(value: string): BoardDetailsResponse;
8789

8890
serializeBinary(): Uint8Array;
8991
toObject(includeInstance?: boolean): BoardDetailsResponse.AsObject;
@@ -112,6 +114,7 @@ export namespace BoardDetailsResponse {
112114
debuggingSupported: boolean,
113115
identificationPropertiesList: Array<BoardIdentificationProperties.AsObject>,
114116
buildPropertiesList: Array<string>,
117+
defaultProgrammerId: string,
115118
}
116119
}
117120

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/board_pb.js

+31-1
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.toObject = function(includ
733733
debuggingSupported: jspb.Message.getBooleanFieldWithDefault(msg, 14, false),
734734
identificationPropertiesList: jspb.Message.toObjectList(msg.getIdentificationPropertiesList(),
735735
proto.cc.arduino.cli.commands.v1.BoardIdentificationProperties.toObject, includeInstance),
736-
buildPropertiesList: (f = jspb.Message.getRepeatedField(msg, 16)) == null ? undefined : f
736+
buildPropertiesList: (f = jspb.Message.getRepeatedField(msg, 16)) == null ? undefined : f,
737+
defaultProgrammerId: jspb.Message.getFieldWithDefault(msg, 17, "")
737738
};
738739

739740
if (includeInstance) {
@@ -836,6 +837,10 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.deserializeBinaryFromReade
836837
var value = /** @type {string} */ (reader.readString());
837838
msg.addBuildProperties(value);
838839
break;
840+
case 17:
841+
var value = /** @type {string} */ (reader.readString());
842+
msg.setDefaultProgrammerId(value);
843+
break;
839844
default:
840845
reader.skipField();
841846
break;
@@ -976,6 +981,13 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.serializeBinaryToWriter =
976981
f
977982
);
978983
}
984+
f = message.getDefaultProgrammerId();
985+
if (f.length > 0) {
986+
writer.writeString(
987+
17,
988+
f
989+
);
990+
}
979991
};
980992

981993

@@ -1386,6 +1398,24 @@ proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.clearBuildProper
13861398
};
13871399

13881400

1401+
/**
1402+
* optional string default_programmer_id = 17;
1403+
* @return {string}
1404+
*/
1405+
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.getDefaultProgrammerId = function() {
1406+
return /** @type {string} */ (jspb.Message.getFieldWithDefault(this, 17, ""));
1407+
};
1408+
1409+
1410+
/**
1411+
* @param {string} value
1412+
* @return {!proto.cc.arduino.cli.commands.v1.BoardDetailsResponse} returns this
1413+
*/
1414+
proto.cc.arduino.cli.commands.v1.BoardDetailsResponse.prototype.setDefaultProgrammerId = function(value) {
1415+
return jspb.Message.setProto3StringField(this, 17, value);
1416+
};
1417+
1418+
13891419

13901420

13911421

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.d.ts

+17
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,23 @@ export namespace Programmer {
195195
}
196196
}
197197

198+
export class MissingProgrammerError extends jspb.Message {
199+
200+
serializeBinary(): Uint8Array;
201+
toObject(includeInstance?: boolean): MissingProgrammerError.AsObject;
202+
static toObject(includeInstance: boolean, msg: MissingProgrammerError): MissingProgrammerError.AsObject;
203+
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
204+
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
205+
static serializeBinaryToWriter(message: MissingProgrammerError, writer: jspb.BinaryWriter): void;
206+
static deserializeBinary(bytes: Uint8Array): MissingProgrammerError;
207+
static deserializeBinaryFromReader(message: MissingProgrammerError, reader: jspb.BinaryReader): MissingProgrammerError;
208+
}
209+
210+
export namespace MissingProgrammerError {
211+
export type AsObject = {
212+
}
213+
}
214+
198215
export class Platform extends jspb.Message {
199216
getId(): string;
200217
setId(value: string): Platform;

Diff for: arduino-ide-extension/src/node/cli-protocol/cc/arduino/cli/commands/v1/common_pb.js

+123
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.DownloadProgressUpdate', nul
3030
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.HelpResources', null, global);
3131
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.InstalledPlatformReference', null, global);
3232
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Instance', null, global);
33+
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.MissingProgrammerError', null, global);
3334
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Platform', null, global);
3435
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Profile', null, global);
3536
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.Programmer', null, global);
@@ -181,6 +182,27 @@ if (goog.DEBUG && !COMPILED) {
181182
*/
182183
proto.cc.arduino.cli.commands.v1.Programmer.displayName = 'proto.cc.arduino.cli.commands.v1.Programmer';
183184
}
185+
/**
186+
* Generated by JsPbCodeGenerator.
187+
* @param {Array=} opt_data Optional initial data array, typically from a
188+
* server response, or constructed directly in Javascript. The array is used
189+
* in place and becomes part of the constructed object. It is not cloned.
190+
* If no data is provided, the constructed object will be empty, but still
191+
* valid.
192+
* @extends {jspb.Message}
193+
* @constructor
194+
*/
195+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError = function(opt_data) {
196+
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
197+
};
198+
goog.inherits(proto.cc.arduino.cli.commands.v1.MissingProgrammerError, jspb.Message);
199+
if (goog.DEBUG && !COMPILED) {
200+
/**
201+
* @public
202+
* @override
203+
*/
204+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.displayName = 'proto.cc.arduino.cli.commands.v1.MissingProgrammerError';
205+
}
184206
/**
185207
* Generated by JsPbCodeGenerator.
186208
* @param {Array=} opt_data Optional initial data array, typically from a
@@ -1587,6 +1609,107 @@ proto.cc.arduino.cli.commands.v1.Programmer.prototype.setName = function(value)
15871609

15881610

15891611

1612+
1613+
1614+
if (jspb.Message.GENERATE_TO_OBJECT) {
1615+
/**
1616+
* Creates an object representation of this proto.
1617+
* Field names that are reserved in JavaScript and will be renamed to pb_name.
1618+
* Optional fields that are not set will be set to undefined.
1619+
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
1620+
* For the list of reserved names please see:
1621+
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
1622+
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
1623+
* JSPB instance for transitional soy proto support:
1624+
* http://goto/soy-param-migration
1625+
* @return {!Object}
1626+
*/
1627+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.prototype.toObject = function(opt_includeInstance) {
1628+
return proto.cc.arduino.cli.commands.v1.MissingProgrammerError.toObject(opt_includeInstance, this);
1629+
};
1630+
1631+
1632+
/**
1633+
* Static version of the {@see toObject} method.
1634+
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
1635+
* the JSPB instance for transitional soy proto support:
1636+
* http://goto/soy-param-migration
1637+
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} msg The msg instance to transform.
1638+
* @return {!Object}
1639+
* @suppress {unusedLocalVariables} f is only used for nested messages
1640+
*/
1641+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.toObject = function(includeInstance, msg) {
1642+
var f, obj = {
1643+
1644+
};
1645+
1646+
if (includeInstance) {
1647+
obj.$jspbMessageInstance = msg;
1648+
}
1649+
return obj;
1650+
};
1651+
}
1652+
1653+
1654+
/**
1655+
* Deserializes binary data (in protobuf wire format).
1656+
* @param {jspb.ByteSource} bytes The bytes to deserialize.
1657+
* @return {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError}
1658+
*/
1659+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinary = function(bytes) {
1660+
var reader = new jspb.BinaryReader(bytes);
1661+
var msg = new proto.cc.arduino.cli.commands.v1.MissingProgrammerError;
1662+
return proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinaryFromReader(msg, reader);
1663+
};
1664+
1665+
1666+
/**
1667+
* Deserializes binary data (in protobuf wire format) from the
1668+
* given reader into the given message object.
1669+
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} msg The message object to deserialize into.
1670+
* @param {!jspb.BinaryReader} reader The BinaryReader to use.
1671+
* @return {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError}
1672+
*/
1673+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.deserializeBinaryFromReader = function(msg, reader) {
1674+
while (reader.nextField()) {
1675+
if (reader.isEndGroup()) {
1676+
break;
1677+
}
1678+
var field = reader.getFieldNumber();
1679+
switch (field) {
1680+
default:
1681+
reader.skipField();
1682+
break;
1683+
}
1684+
}
1685+
return msg;
1686+
};
1687+
1688+
1689+
/**
1690+
* Serializes the message to binary data (in protobuf wire format).
1691+
* @return {!Uint8Array}
1692+
*/
1693+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.prototype.serializeBinary = function() {
1694+
var writer = new jspb.BinaryWriter();
1695+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.serializeBinaryToWriter(this, writer);
1696+
return writer.getResultBuffer();
1697+
};
1698+
1699+
1700+
/**
1701+
* Serializes the given message to binary data (in protobuf wire
1702+
* format), writing to the given BinaryWriter.
1703+
* @param {!proto.cc.arduino.cli.commands.v1.MissingProgrammerError} message
1704+
* @param {!jspb.BinaryWriter} writer
1705+
* @suppress {unusedLocalVariables} f is only used for nested messages
1706+
*/
1707+
proto.cc.arduino.cli.commands.v1.MissingProgrammerError.serializeBinaryToWriter = function(message, writer) {
1708+
var f = undefined;
1709+
};
1710+
1711+
1712+
15901713
/**
15911714
* List of repeated fields within this message type.
15921715
* @private {!Array<number>}

0 commit comments

Comments
 (0)