From 0b89cc4a3b21037d316a314ee3246a957acea5a3 Mon Sep 17 00:00:00 2001 From: Akos Kitta Date: Thu, 21 Jan 2021 15:52:48 +0100 Subject: [PATCH] Updated to the HEAD CLI. Signed-off-by: Akos Kitta --- arduino-ide-extension/package.json | 5 +- .../scripts/generate-protocol.js | 2 +- .../cli-protocol/commands/compile_pb.d.ts | 10 +++ .../node/cli-protocol/commands/compile_pb.js | 65 ++++++++++++++++++- 4 files changed, 79 insertions(+), 3 deletions(-) diff --git a/arduino-ide-extension/package.json b/arduino-ide-extension/package.json index 2f22a4c8..61681a37 100644 --- a/arduino-ide-extension/package.json +++ b/arduino-ide-extension/package.json @@ -120,7 +120,10 @@ ], "arduino": { "cli": { - "version": "0.14.0" + "version": { + "owner": "arduino", + "repo": "arduino-cli" + } } } } diff --git a/arduino-ide-extension/scripts/generate-protocol.js b/arduino-ide-extension/scripts/generate-protocol.js index 4293966b..76ddafdd 100644 --- a/arduino-ide-extension/scripts/generate-protocol.js +++ b/arduino-ide-extension/scripts/generate-protocol.js @@ -72,7 +72,7 @@ shell.exit(1); } const version = JSON.parse(jsonVersion).VersionString; - if (version) { + if (version && version !== '0.0.0-git') { // 0.0.0-git is the version of the CLI when built manually and not downloaded as a releases/nightly. shell.echo(`>>> Checking out version: ${version}...`); if (shell.exec(`git -C ${repository} checkout ${version} -b ${version}`).code !== 0) { shell.exit(1); diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.d.ts b/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.d.ts index 35b9b479..18049ba1 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.d.ts +++ b/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.d.ts @@ -70,6 +70,13 @@ export class CompileReq extends jspb.Message { getExportBinaries(): boolean; setExportBinaries(value: boolean): CompileReq; + getCreateCompilationDatabaseOnly(): boolean; + setCreateCompilationDatabaseOnly(value: boolean): CompileReq; + + + getSourceOverrideMap(): jspb.Map; + clearSourceOverrideMap(): void; + serializeBinary(): Uint8Array; toObject(includeInstance?: boolean): CompileReq.AsObject; @@ -101,6 +108,9 @@ export namespace CompileReq { exportDir: string, clean: boolean, exportBinaries: boolean, + createCompilationDatabaseOnly: boolean, + + sourceOverrideMap: Array<[string, string]>, } } diff --git a/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.js b/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.js index 10267d01..0248cb64 100644 --- a/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.js +++ b/arduino-ide-extension/src/node/cli-protocol/commands/compile_pb.js @@ -140,7 +140,9 @@ proto.cc.arduino.cli.commands.CompileReq.toObject = function(includeInstance, ms optimizefordebug: jspb.Message.getBooleanFieldWithDefault(msg, 16, false), exportDir: jspb.Message.getFieldWithDefault(msg, 18, ""), clean: jspb.Message.getBooleanFieldWithDefault(msg, 19, false), - exportBinaries: jspb.Message.getBooleanFieldWithDefault(msg, 20, false) + exportBinaries: jspb.Message.getBooleanFieldWithDefault(msg, 20, false), + createCompilationDatabaseOnly: jspb.Message.getBooleanFieldWithDefault(msg, 21, false), + sourceOverrideMap: (f = msg.getSourceOverrideMap()) ? f.toObject(includeInstance, undefined) : [] }; if (includeInstance) { @@ -250,6 +252,16 @@ proto.cc.arduino.cli.commands.CompileReq.deserializeBinaryFromReader = function( var value = /** @type {boolean} */ (reader.readBool()); msg.setExportBinaries(value); break; + case 21: + var value = /** @type {boolean} */ (reader.readBool()); + msg.setCreateCompilationDatabaseOnly(value); + break; + case 22: + var value = msg.getSourceOverrideMap(); + reader.readMessage(value, function(message, reader) { + jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); + }); + break; default: reader.skipField(); break; @@ -406,6 +418,17 @@ proto.cc.arduino.cli.commands.CompileReq.serializeBinaryToWriter = function(mess f ); } + f = message.getCreateCompilationDatabaseOnly(); + if (f) { + writer.writeBool( + 21, + f + ); + } + f = message.getSourceOverrideMap(true); + if (f && f.getLength() > 0) { + f.serializeBinary(22, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); + } }; @@ -790,6 +813,46 @@ proto.cc.arduino.cli.commands.CompileReq.prototype.setExportBinaries = function( }; +/** + * optional bool create_compilation_database_only = 21; + * @return {boolean} + */ +proto.cc.arduino.cli.commands.CompileReq.prototype.getCreateCompilationDatabaseOnly = function() { + return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 21, false)); +}; + + +/** + * @param {boolean} value + * @return {!proto.cc.arduino.cli.commands.CompileReq} returns this + */ +proto.cc.arduino.cli.commands.CompileReq.prototype.setCreateCompilationDatabaseOnly = function(value) { + return jspb.Message.setProto3BooleanField(this, 21, value); +}; + + +/** + * map source_override = 22; + * @param {boolean=} opt_noLazyCreate Do not create the map if + * empty, instead returning `undefined` + * @return {!jspb.Map} + */ +proto.cc.arduino.cli.commands.CompileReq.prototype.getSourceOverrideMap = function(opt_noLazyCreate) { + return /** @type {!jspb.Map} */ ( + jspb.Message.getMapField(this, 22, opt_noLazyCreate, + null)); +}; + + +/** + * Clears values from the map. The map will be non-null. + * @return {!proto.cc.arduino.cli.commands.CompileReq} returns this + */ +proto.cc.arduino.cli.commands.CompileReq.prototype.clearSourceOverrideMap = function() { + this.getSourceOverrideMap().clear(); + return this;}; + + /** * List of repeated fields within this message type.