Skip to content

Commit 1db02e9

Browse files
author
Alberto Iannaccone
committed
use noOverwrite when install built-in libraries and platform
1 parent 29f7816 commit 1db02e9

File tree

10 files changed

+86
-4
lines changed

10 files changed

+86
-4
lines changed

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,11 @@
156156
],
157157
"arduino": {
158158
"cli": {
159-
"version": "0.24.0"
159+
"version": {
160+
"owner": "arduino",
161+
"repo": "arduino-cli",
162+
"commitish": "ffe4232b359fcfa87238d68acf1c3b64a1621f14"
163+
}
160164
},
161165
"fwuploader": {
162166
"version": "2.2.0"

Diff for: arduino-ide-extension/src/browser/contributions/init-libs-platforms.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,16 @@ export class InitLibsPlatforms extends Contribution {
3131
)[0];
3232

3333
if (avrPackage) {
34-
await this.boardsService.install({ item: avrPackage });
34+
await this.boardsService.install({
35+
item: avrPackage,
36+
noOverwrite: true, // We don't want to automatically replace custom platforms the user might already have in place
37+
});
3538
}
3639
if (builtInLibrary) {
3740
await this.libraryService.install({
3841
item: builtInLibrary,
3942
installDependencies: true,
43+
noOverwrite: true, // We don't want to automatically replace custom libraries the user might already have in place
4044
});
4145
}
4246
}

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

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export interface Installable<T extends ArduinoComponent> {
1717
item: T;
1818
progressId?: string;
1919
version?: Installable.Version;
20+
noOverwrite?: boolean;
2021
}): Promise<void>;
2122

2223
/**

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

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export interface LibraryService
1616
progressId?: string;
1717
version?: Installable.Version;
1818
installDependencies?: boolean;
19+
noOverwrite?: boolean;
1920
}): Promise<void>;
2021
installZip(options: {
2122
zipUri: string;

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

+2
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ export class BoardsServiceImpl
399399
item: BoardsPackage;
400400
progressId?: string;
401401
version?: Installable.Version;
402+
noOverwrite?: boolean;
402403
}): Promise<void> {
403404
const item = options.item;
404405
const version = !!options.version
@@ -415,6 +416,7 @@ export class BoardsServiceImpl
415416
req.setArchitecture(architecture);
416417
req.setPlatformPackage(platform);
417418
req.setVersion(version);
419+
req.setNoOverwrite(Boolean(options.noOverwrite));
418420

419421
console.info('>>> Starting boards package installation...', item);
420422

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

+4
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ export class PlatformInstallRequest extends jspb.Message {
2626
getSkipPostInstall(): boolean;
2727
setSkipPostInstall(value: boolean): PlatformInstallRequest;
2828

29+
getNoOverwrite(): boolean;
30+
setNoOverwrite(value: boolean): PlatformInstallRequest;
31+
2932

3033
serializeBinary(): Uint8Array;
3134
toObject(includeInstance?: boolean): PlatformInstallRequest.AsObject;
@@ -44,6 +47,7 @@ export namespace PlatformInstallRequest {
4447
architecture: string,
4548
version: string,
4649
skipPostInstall: boolean,
50+
noOverwrite: boolean,
4751
}
4852
}
4953

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

+31-1
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.toObject = function(incl
339339
platformPackage: jspb.Message.getFieldWithDefault(msg, 2, ""),
340340
architecture: jspb.Message.getFieldWithDefault(msg, 3, ""),
341341
version: jspb.Message.getFieldWithDefault(msg, 4, ""),
342-
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
342+
skipPostInstall: jspb.Message.getBooleanFieldWithDefault(msg, 5, false),
343+
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 6, false)
343344
};
344345

345346
if (includeInstance) {
@@ -397,6 +398,10 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.deserializeBinaryFromRea
397398
var value = /** @type {boolean} */ (reader.readBool());
398399
msg.setSkipPostInstall(value);
399400
break;
401+
case 6:
402+
var value = /** @type {boolean} */ (reader.readBool());
403+
msg.setNoOverwrite(value);
404+
break;
400405
default:
401406
reader.skipField();
402407
break;
@@ -462,6 +467,13 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.serializeBinaryToWriter
462467
f
463468
);
464469
}
470+
f = message.getNoOverwrite();
471+
if (f) {
472+
writer.writeBool(
473+
6,
474+
f
475+
);
476+
}
465477
};
466478

467479

@@ -574,6 +586,24 @@ proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setSkipPostIns
574586
};
575587

576588

589+
/**
590+
* optional bool no_overwrite = 6;
591+
* @return {boolean}
592+
*/
593+
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.getNoOverwrite = function() {
594+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 6, false));
595+
};
596+
597+
598+
/**
599+
* @param {boolean} value
600+
* @return {!proto.cc.arduino.cli.commands.v1.PlatformInstallRequest} returns this
601+
*/
602+
proto.cc.arduino.cli.commands.v1.PlatformInstallRequest.prototype.setNoOverwrite = function(value) {
603+
return jspb.Message.setProto3BooleanField(this, 6, value);
604+
};
605+
606+
577607

578608

579609

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

+4
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ export class LibraryInstallRequest extends jspb.Message {
7979
getNoDeps(): boolean;
8080
setNoDeps(value: boolean): LibraryInstallRequest;
8181

82+
getNoOverwrite(): boolean;
83+
setNoOverwrite(value: boolean): LibraryInstallRequest;
84+
8285

8386
serializeBinary(): Uint8Array;
8487
toObject(includeInstance?: boolean): LibraryInstallRequest.AsObject;
@@ -96,6 +99,7 @@ export namespace LibraryInstallRequest {
9699
name: string,
97100
version: string,
98101
noDeps: boolean,
102+
noOverwrite: boolean,
99103
}
100104
}
101105

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

+31-1
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.toObject = function(inclu
967967
instance: (f = msg.getInstance()) && cc_arduino_cli_commands_v1_common_pb.Instance.toObject(includeInstance, f),
968968
name: jspb.Message.getFieldWithDefault(msg, 2, ""),
969969
version: jspb.Message.getFieldWithDefault(msg, 3, ""),
970-
noDeps: jspb.Message.getBooleanFieldWithDefault(msg, 4, false)
970+
noDeps: jspb.Message.getBooleanFieldWithDefault(msg, 4, false),
971+
noOverwrite: jspb.Message.getBooleanFieldWithDefault(msg, 5, false)
971972
};
972973

973974
if (includeInstance) {
@@ -1021,6 +1022,10 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.deserializeBinaryFromRead
10211022
var value = /** @type {boolean} */ (reader.readBool());
10221023
msg.setNoDeps(value);
10231024
break;
1025+
case 5:
1026+
var value = /** @type {boolean} */ (reader.readBool());
1027+
msg.setNoOverwrite(value);
1028+
break;
10241029
default:
10251030
reader.skipField();
10261031
break;
@@ -1079,6 +1084,13 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.serializeBinaryToWriter =
10791084
f
10801085
);
10811086
}
1087+
f = message.getNoOverwrite();
1088+
if (f) {
1089+
writer.writeBool(
1090+
5,
1091+
f
1092+
);
1093+
}
10821094
};
10831095

10841096

@@ -1173,6 +1185,24 @@ proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.setNoDeps = fun
11731185
};
11741186

11751187

1188+
/**
1189+
* optional bool no_overwrite = 5;
1190+
* @return {boolean}
1191+
*/
1192+
proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.getNoOverwrite = function() {
1193+
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 5, false));
1194+
};
1195+
1196+
1197+
/**
1198+
* @param {boolean} value
1199+
* @return {!proto.cc.arduino.cli.commands.v1.LibraryInstallRequest} returns this
1200+
*/
1201+
proto.cc.arduino.cli.commands.v1.LibraryInstallRequest.prototype.setNoOverwrite = function(value) {
1202+
return jspb.Message.setProto3BooleanField(this, 5, value);
1203+
};
1204+
1205+
11761206

11771207

11781208

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

+2
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ export class LibraryServiceImpl
255255
progressId?: string;
256256
version?: Installable.Version;
257257
installDependencies?: boolean;
258+
noOverwrite?: boolean;
258259
}): Promise<void> {
259260
const item = options.item;
260261
const version = !!options.version
@@ -269,6 +270,7 @@ export class LibraryServiceImpl
269270
req.setName(item.name);
270271
req.setVersion(version);
271272
req.setNoDeps(!options.installDependencies);
273+
req.setNoOverwrite(Boolean(options.noOverwrite));
272274

273275
console.info('>>> Starting library package installation...', item);
274276

0 commit comments

Comments
 (0)