Skip to content

Commit fb588a4

Browse files
author
Akos Kitta
committed
Install the Arduino_BuiltIn to built-in location
Closes #1055. Signed-off-by: Akos Kitta <[email protected]>
1 parent 5cb9166 commit fb588a4

File tree

6 files changed

+74
-9
lines changed

6 files changed

+74
-9
lines changed

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@
161161
"arduino": {
162162
"cli": {
163163
"version": {
164-
"owner": "arduino",
164+
"owner": "cmaglie",
165165
"repo": "arduino-cli",
166-
"commitish": "05d1446"
166+
"commitish": "byebye_bundles"
167167
}
168168
},
169169
"fwuploader": {

Diff for: arduino-ide-extension/src/browser/contributions/first-startup-installer.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { LocalStorageService } from '@theia/core/lib/browser';
22
import { inject, injectable } from '@theia/core/shared/inversify';
3-
import { BoardsService, LibraryService } from '../../common/protocol';
3+
import {
4+
BoardsService,
5+
LibraryLocation,
6+
LibraryService,
7+
} from '../../common/protocol';
48
import { Contribution } from './contribution';
59

610
@injectable()
@@ -57,6 +61,7 @@ export class FirstStartupInstaller extends Contribution {
5761
item: builtInLibrary,
5862
installDependencies: true,
5963
noOverwrite: true, // We don't want to automatically replace custom libraries the user might already have in place
64+
installLocation: LibraryLocation.BUILTIN,
6065
});
6166
} catch (e) {
6267
// There's no error code, I need to parse the error message: https://github.com/arduino/arduino-cli/commit/2ea3608453b17b1157f8a1dc892af2e13e40f4f0#diff-1de7569144d4e260f8dde0e0d00a4e2a218c57966d583da1687a70d518986649R95

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export interface LibraryService
2828
version?: Installable.Version;
2929
installDependencies?: boolean;
3030
noOverwrite?: boolean;
31+
installLocation?: LibraryLocation.BUILTIN | LibraryLocation.USER;
3132
}): Promise<void>;
3233
installZip(options: {
3334
zipUri: string;
@@ -141,7 +142,7 @@ export enum LibraryLocation {
141142
/**
142143
* In the `libraries` subdirectory of the Arduino IDE installation.
143144
*/
144-
IDE_BUILTIN = 0,
145+
BUILTIN = 0,
145146

146147
/**
147148
* In the `libraries` subdirectory of the user directory (sketchbook).

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

+10-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export class LibraryInstallRequest extends jspb.Message {
8282
getNoOverwrite(): boolean;
8383
setNoOverwrite(value: boolean): LibraryInstallRequest;
8484

85+
getInstallLocation(): LibraryInstallLocation;
86+
setInstallLocation(value: LibraryInstallLocation): LibraryInstallRequest;
87+
8588

8689
serializeBinary(): Uint8Array;
8790
toObject(includeInstance?: boolean): LibraryInstallRequest.AsObject;
@@ -100,6 +103,7 @@ export namespace LibraryInstallRequest {
100103
version: string,
101104
noDeps: boolean,
102105
noOverwrite: boolean,
106+
installLocation: LibraryInstallLocation,
103107
}
104108
}
105109

@@ -962,6 +966,11 @@ export namespace GitLibraryInstallResponse {
962966
}
963967
}
964968

969+
export enum LibraryInstallLocation {
970+
LIBRARY_INSTALL_LOCATION_USER = 0,
971+
LIBRARY_INSTALL_LOCATION_BUILTIN = 1,
972+
}
973+
965974
export enum LibrarySearchStatus {
966975
LIBRARY_SEARCH_STATUS_FAILED = 0,
967976
LIBRARY_SEARCH_STATUS_SUCCESS = 1,
@@ -973,7 +982,7 @@ export enum LibraryLayout {
973982
}
974983

975984
export enum LibraryLocation {
976-
LIBRARY_LOCATION_IDE_BUILTIN = 0,
985+
LIBRARY_LOCATION_BUILTIN = 0,
977986
LIBRARY_LOCATION_USER = 1,
978987
LIBRARY_LOCATION_PLATFORM_BUILTIN = 2,
979988
LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN = 3,

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

+41-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryDependency', null, gl
2626
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryDependencyStatus', null, global);
2727
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryDownloadRequest', null, global);
2828
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryDownloadResponse', null, global);
29+
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryInstallLocation', null, global);
2930
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryInstallRequest', null, global);
3031
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryInstallResponse', null, global);
3132
goog.exportSymbol('proto.cc.arduino.cli.commands.v1.LibraryLayout', null, global);
@@ -1012,7 +1013,8 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.toObject = function(inclu
10121013
name: jspb.Message.getFieldWithDefault(msg, 2, ""),
10131014
version: jspb.Message.getFieldWithDefault(msg, 3, ""),
10141015
noDeps: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
1015-
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
1016+
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
1017+
installLocation: jspb.Message.getFieldWithDefault(msg, 6, 0)
10161018
};
10171019

10181020
if (includeInstance) {
@@ -1070,6 +1072,10 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.deserializeBinaryFromRead
10701072
var value = /** @type {boolean} */ (reader.readBool());
10711073
msg.setNoOverwrite(value);
10721074
break;
1075+
case 6:
1076+
var value = /** @type {!proto.cc.arduino.cli.commands.v1.LibraryInstallLocation} */ (reader.readEnum());
1077+
msg.setInstallLocation(value);
1078+
break;
10731079
default:
10741080
reader.skipField();
10751081
break;
@@ -1135,6 +1141,13 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.serializeBinaryToWriter =
11351141
f
11361142
);
11371143
}
1144+
f = message.getInstallLocation();
1145+
if (f !== 0.0) {
1146+
writer.writeEnum(
1147+
6,
1148+
f
1149+
);
1150+
}
11381151
};
11391152

11401153

@@ -1247,6 +1260,24 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.setNoOverwrite
12471260
};
12481261

12491262

1263+
/**
1264+
* optional LibraryInstallLocation install_location = 6;
1265+
* @return {!proto.cc.arduino.cli.commands.v1.LibraryInstallLocation}
1266+
*/
1267+
proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.getInstallLocation = function() {
1268+
return /** @type {!proto.cc.arduino.cli.commands.v1.LibraryInstallLocation} */ (jspb.Message.getFieldWithDefault(this, 6, 0));
1269+
};
1270+
1271+
1272+
/**
1273+
* @param {!proto.cc.arduino.cli.commands.v1.LibraryInstallLocation} value
1274+
* @return {!proto.cc.arduino.cli.commands.v1.LibraryInstallRequest} returns this
1275+
*/
1276+
proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.setInstallLocation = function(value) {
1277+
return jspb.Message.setProto3EnumField(this, 6, value);
1278+
};
1279+
1280+
12501281

12511282

12521283

@@ -7057,6 +7088,14 @@ proto.cc.arduino.cli.commands.v1.GitLibraryInstallResponse.prototype.hasTaskProg
70577088
};
70587089

70597090

7091+
/**
7092+
* @enum {number}
7093+
*/
7094+
proto.cc.arduino.cli.commands.v1.LibraryInstallLocation = {
7095+
LIBRARY_INSTALL_LOCATION_USER: 0,
7096+
LIBRARY_INSTALL_LOCATION_BUILTIN: 1
7097+
};
7098+
70607099
/**
70617100
* @enum {number}
70627101
*/
@@ -7077,7 +7116,7 @@ proto.cc.arduino.cli.commands.v1.LibraryLayout = {
70777116
* @enum {number}
70787117
*/
70797118
proto.cc.arduino.cli.commands.v1.LibraryLocation = {
7080-
LIBRARY_LOCATION_IDE_BUILTIN: 0,
7119+
LIBRARY_LOCATION_BUILTIN: 0,
70817120
LIBRARY_LOCATION_USER: 1,
70827121
LIBRARY_LOCATION_PLATFORM_BUILTIN: 2,
70837122
LIBRARY_LOCATION_REFERENCED_PLATFORM_BUILTIN: 3,

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

+13-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
ZipLibraryInstallRequest,
2222
LibrarySearchRequest,
2323
LibrarySearchResponse,
24+
LibraryInstallLocation,
2425
} from './cli-protocol/cc/arduino/cli/commands/v1/lib_pb';
2526
import { Installable } from '../common/protocol/installable';
2627
import { ILogger, notEmpty } from '@theia/core';
@@ -231,8 +232,8 @@ export class LibraryServiceImpl
231232

232233
private mapLocation(location: GrpcLibraryLocation): LibraryLocation {
233234
switch (location) {
234-
case GrpcLibraryLocation.LIBRARY_LOCATION_IDE_BUILTIN:
235-
return LibraryLocation.IDE_BUILTIN;
235+
case GrpcLibraryLocation.LIBRARY_LOCATION_BUILTIN:
236+
return LibraryLocation.BUILTIN;
236237
case GrpcLibraryLocation.LIBRARY_LOCATION_USER:
237238
return LibraryLocation.USER;
238239
case GrpcLibraryLocation.LIBRARY_LOCATION_PLATFORM_BUILTIN:
@@ -290,6 +291,7 @@ export class LibraryServiceImpl
290291
version?: Installable.Version;
291292
installDependencies?: boolean;
292293
noOverwrite?: boolean;
294+
installLocation?: LibraryLocation.BUILTIN | LibraryLocation.USER;
293295
}): Promise<void> {
294296
const item = options.item;
295297
const version = !!options.version
@@ -304,6 +306,15 @@ export class LibraryServiceImpl
304306
req.setVersion(version);
305307
req.setNoDeps(!options.installDependencies);
306308
req.setNoOverwrite(Boolean(options.noOverwrite));
309+
if (options.installLocation === LibraryLocation.BUILTIN) {
310+
req.setInstallLocation(
311+
LibraryInstallLocation.LIBRARY_INSTALL_LOCATION_BUILTIN
312+
);
313+
} else if (options.installLocation === LibraryLocation.USER) {
314+
req.setInstallLocation(
315+
LibraryInstallLocation.LIBRARY_INSTALL_LOCATION_USER
316+
);
317+
}
307318

308319
console.info('>>> Starting library package installation...', item);
309320

0 commit comments

Comments
 (0)