ATL-806: Fixed always_export_binaries CLI config

Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
Akos Kitta 2021-02-12 09:26:39 +01:00 committed by Akos Kitta
parent f1c80041fe
commit 1280a344a7
9 changed files with 130 additions and 43 deletions

View File

@ -123,7 +123,7 @@
], ],
"arduino": { "arduino": {
"cli": { "cli": {
"version": "0.15.2" "version": "20210212"
} }
} }
} }

View File

@ -68,7 +68,7 @@ export class VerifySketch extends SketchContribution {
}); });
} }
async verifySketch(exportBinaries: boolean = false): Promise<void> { async verifySketch(exportBinaries?: boolean): Promise<void> {
const sketch = await this.sketchServiceClient.currentSketch(); const sketch = await this.sketchServiceClient.currentSketch();
if (!sketch) { if (!sketch) {
return; return;

View File

@ -3,7 +3,7 @@ import { Programmer } from './boards-service';
export const CoreServicePath = '/services/core-service'; export const CoreServicePath = '/services/core-service';
export const CoreService = Symbol('CoreService'); export const CoreService = Symbol('CoreService');
export interface CoreService { export interface CoreService {
compile(options: CoreService.Compile.Options & Readonly<{ exportBinaries: boolean }>): Promise<void>; compile(options: CoreService.Compile.Options & Readonly<{ exportBinaries?: boolean }>): Promise<void>;
upload(options: CoreService.Upload.Options): Promise<void>; upload(options: CoreService.Upload.Options): Promise<void>;
uploadUsingProgrammer(options: CoreService.Upload.Options): Promise<void>; uploadUsingProgrammer(options: CoreService.Upload.Options): Promise<void>;
burnBootloader(options: CoreService.Bootloader.Options): Promise<void>; burnBootloader(options: CoreService.Bootloader.Options): Promise<void>;

View File

@ -1175,7 +1175,7 @@ libraryInstall: {
responseSerialize: serialize_cc_arduino_cli_commands_LibraryInstallResp, responseSerialize: serialize_cc_arduino_cli_commands_LibraryInstallResp,
responseDeserialize: deserialize_cc_arduino_cli_commands_LibraryInstallResp, responseDeserialize: deserialize_cc_arduino_cli_commands_LibraryInstallResp,
}, },
// Install a library from a Zip File // Install a library from a Zip File
zipLibraryInstall: { zipLibraryInstall: {
path: '/cc.arduino.cli.commands.ArduinoCore/ZipLibraryInstall', path: '/cc.arduino.cli.commands.ArduinoCore/ZipLibraryInstall',
requestStream: false, requestStream: false,

View File

@ -512,6 +512,11 @@ export class LoadSketchResp extends jspb.Message {
setAdditionalFilesList(value: Array<string>): LoadSketchResp; setAdditionalFilesList(value: Array<string>): LoadSketchResp;
addAdditionalFiles(value: string, index?: number): string; addAdditionalFiles(value: string, index?: number): string;
clearRootFolderFilesList(): void;
getRootFolderFilesList(): Array<string>;
setRootFolderFilesList(value: Array<string>): LoadSketchResp;
addRootFolderFiles(value: string, index?: number): string;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): LoadSketchResp.AsObject; toObject(includeInstance?: boolean): LoadSketchResp.AsObject;
@ -529,6 +534,7 @@ export namespace LoadSketchResp {
locationPath: string, locationPath: string,
otherSketchFilesList: Array<string>, otherSketchFilesList: Array<string>,
additionalFilesList: Array<string>, additionalFilesList: Array<string>,
rootFolderFilesList: Array<string>,
} }
} }

View File

@ -3639,7 +3639,7 @@ proto.cc.arduino.cli.commands.LoadSketchReq.prototype.setSketchPath = function(v
* @private {!Array<number>} * @private {!Array<number>}
* @const * @const
*/ */
proto.cc.arduino.cli.commands.LoadSketchResp.repeatedFields_ = [3,4]; proto.cc.arduino.cli.commands.LoadSketchResp.repeatedFields_ = [3,4,5];
@ -3675,7 +3675,8 @@ proto.cc.arduino.cli.commands.LoadSketchResp.toObject = function(includeInstance
mainFile: jspb.Message.getFieldWithDefault(msg, 1, ""), mainFile: jspb.Message.getFieldWithDefault(msg, 1, ""),
locationPath: jspb.Message.getFieldWithDefault(msg, 2, ""), locationPath: jspb.Message.getFieldWithDefault(msg, 2, ""),
otherSketchFilesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f, otherSketchFilesList: (f = jspb.Message.getRepeatedField(msg, 3)) == null ? undefined : f,
additionalFilesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f additionalFilesList: (f = jspb.Message.getRepeatedField(msg, 4)) == null ? undefined : f,
rootFolderFilesList: (f = jspb.Message.getRepeatedField(msg, 5)) == null ? undefined : f
}; };
if (includeInstance) { if (includeInstance) {
@ -3728,6 +3729,10 @@ proto.cc.arduino.cli.commands.LoadSketchResp.deserializeBinaryFromReader = funct
var value = /** @type {string} */ (reader.readString()); var value = /** @type {string} */ (reader.readString());
msg.addAdditionalFiles(value); msg.addAdditionalFiles(value);
break; break;
case 5:
var value = /** @type {string} */ (reader.readString());
msg.addRootFolderFiles(value);
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@ -3785,6 +3790,13 @@ proto.cc.arduino.cli.commands.LoadSketchResp.serializeBinaryToWriter = function(
f f
); );
} }
f = message.getRootFolderFilesList();
if (f.length > 0) {
writer.writeRepeatedString(
5,
f
);
}
}; };
@ -3898,6 +3910,43 @@ proto.cc.arduino.cli.commands.LoadSketchResp.prototype.clearAdditionalFilesList
}; };
/**
* repeated string root_folder_files = 5;
* @return {!Array<string>}
*/
proto.cc.arduino.cli.commands.LoadSketchResp.prototype.getRootFolderFilesList = function() {
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 5));
};
/**
* @param {!Array<string>} value
* @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this
*/
proto.cc.arduino.cli.commands.LoadSketchResp.prototype.setRootFolderFilesList = function(value) {
return jspb.Message.setField(this, 5, value || []);
};
/**
* @param {string} value
* @param {number=} opt_index
* @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this
*/
proto.cc.arduino.cli.commands.LoadSketchResp.prototype.addRootFolderFiles = function(value, opt_index) {
return jspb.Message.addToRepeatedField(this, 5, value, opt_index);
};
/**
* Clears the list making it empty but non-null.
* @return {!proto.cc.arduino.cli.commands.LoadSketchResp} returns this
*/
proto.cc.arduino.cli.commands.LoadSketchResp.prototype.clearRootFolderFilesList = function() {
return this.setRootFolderFilesList([]);
};

View File

@ -5,6 +5,7 @@
/* eslint-disable */ /* eslint-disable */
import * as jspb from "google-protobuf"; import * as jspb from "google-protobuf";
import * as google_protobuf_wrappers_pb from "google-protobuf/google/protobuf/wrappers_pb";
import * as commands_common_pb from "../commands/common_pb"; import * as commands_common_pb from "../commands/common_pb";
import * as commands_lib_pb from "../commands/lib_pb"; import * as commands_lib_pb from "../commands/lib_pb";
@ -67,9 +68,6 @@ export class CompileReq extends jspb.Message {
getClean(): boolean; getClean(): boolean;
setClean(value: boolean): CompileReq; setClean(value: boolean): CompileReq;
getExportBinaries(): boolean;
setExportBinaries(value: boolean): CompileReq;
getCreateCompilationDatabaseOnly(): boolean; getCreateCompilationDatabaseOnly(): boolean;
setCreateCompilationDatabaseOnly(value: boolean): CompileReq; setCreateCompilationDatabaseOnly(value: boolean): CompileReq;
@ -78,6 +76,12 @@ export class CompileReq extends jspb.Message {
clearSourceOverrideMap(): void; clearSourceOverrideMap(): void;
hasExportBinaries(): boolean;
clearExportBinaries(): void;
getExportBinaries(): google_protobuf_wrappers_pb.BoolValue | undefined;
setExportBinaries(value?: google_protobuf_wrappers_pb.BoolValue): CompileReq;
serializeBinary(): Uint8Array; serializeBinary(): Uint8Array;
toObject(includeInstance?: boolean): CompileReq.AsObject; toObject(includeInstance?: boolean): CompileReq.AsObject;
static toObject(includeInstance: boolean, msg: CompileReq): CompileReq.AsObject; static toObject(includeInstance: boolean, msg: CompileReq): CompileReq.AsObject;
@ -107,10 +111,10 @@ export namespace CompileReq {
optimizefordebug: boolean, optimizefordebug: boolean,
exportDir: string, exportDir: string,
clean: boolean, clean: boolean,
exportBinaries: boolean,
createCompilationDatabaseOnly: boolean, createCompilationDatabaseOnly: boolean,
sourceOverrideMap: Array<[string, string]>, sourceOverrideMap: Array<[string, string]>,
exportBinaries?: google_protobuf_wrappers_pb.BoolValue.AsObject,
} }
} }

View File

@ -14,6 +14,8 @@ var jspb = require('google-protobuf');
var goog = jspb; var goog = jspb;
var global = Function('return this')(); var global = Function('return this')();
var google_protobuf_wrappers_pb = require('google-protobuf/google/protobuf/wrappers_pb.js');
goog.object.extend(proto, google_protobuf_wrappers_pb);
var commands_common_pb = require('../commands/common_pb.js'); var commands_common_pb = require('../commands/common_pb.js');
goog.object.extend(proto, commands_common_pb); goog.object.extend(proto, commands_common_pb);
var commands_lib_pb = require('../commands/lib_pb.js'); var commands_lib_pb = require('../commands/lib_pb.js');
@ -140,9 +142,9 @@ proto.cc.arduino.cli.commands.CompileReq.toObject = function(includeInstance, ms
optimizefordebug: jspb.Message.getBooleanFieldWithDefault(msg, 16, false), optimizefordebug: jspb.Message.getBooleanFieldWithDefault(msg, 16, false),
exportDir: jspb.Message.getFieldWithDefault(msg, 18, ""), exportDir: jspb.Message.getFieldWithDefault(msg, 18, ""),
clean: jspb.Message.getBooleanFieldWithDefault(msg, 19, false), clean: jspb.Message.getBooleanFieldWithDefault(msg, 19, false),
exportBinaries: jspb.Message.getBooleanFieldWithDefault(msg, 20, false),
createCompilationDatabaseOnly: jspb.Message.getBooleanFieldWithDefault(msg, 21, false), createCompilationDatabaseOnly: jspb.Message.getBooleanFieldWithDefault(msg, 21, false),
sourceOverrideMap: (f = msg.getSourceOverrideMap()) ? f.toObject(includeInstance, undefined) : [] sourceOverrideMap: (f = msg.getSourceOverrideMap()) ? f.toObject(includeInstance, undefined) : [],
exportBinaries: (f = msg.getExportBinaries()) && google_protobuf_wrappers_pb.BoolValue.toObject(includeInstance, f)
}; };
if (includeInstance) { if (includeInstance) {
@ -248,10 +250,6 @@ proto.cc.arduino.cli.commands.CompileReq.deserializeBinaryFromReader = function(
var value = /** @type {boolean} */ (reader.readBool()); var value = /** @type {boolean} */ (reader.readBool());
msg.setClean(value); msg.setClean(value);
break; break;
case 20:
var value = /** @type {boolean} */ (reader.readBool());
msg.setExportBinaries(value);
break;
case 21: case 21:
var value = /** @type {boolean} */ (reader.readBool()); var value = /** @type {boolean} */ (reader.readBool());
msg.setCreateCompilationDatabaseOnly(value); msg.setCreateCompilationDatabaseOnly(value);
@ -262,6 +260,11 @@ proto.cc.arduino.cli.commands.CompileReq.deserializeBinaryFromReader = function(
jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", ""); jspb.Map.deserializeBinary(message, reader, jspb.BinaryReader.prototype.readString, jspb.BinaryReader.prototype.readString, null, "", "");
}); });
break; break;
case 23:
var value = new google_protobuf_wrappers_pb.BoolValue;
reader.readMessage(value,google_protobuf_wrappers_pb.BoolValue.deserializeBinaryFromReader);
msg.setExportBinaries(value);
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@ -411,13 +414,6 @@ proto.cc.arduino.cli.commands.CompileReq.serializeBinaryToWriter = function(mess
f f
); );
} }
f = message.getExportBinaries();
if (f) {
writer.writeBool(
20,
f
);
}
f = message.getCreateCompilationDatabaseOnly(); f = message.getCreateCompilationDatabaseOnly();
if (f) { if (f) {
writer.writeBool( writer.writeBool(
@ -429,6 +425,14 @@ proto.cc.arduino.cli.commands.CompileReq.serializeBinaryToWriter = function(mess
if (f && f.getLength() > 0) { if (f && f.getLength() > 0) {
f.serializeBinary(22, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString); f.serializeBinary(22, writer, jspb.BinaryWriter.prototype.writeString, jspb.BinaryWriter.prototype.writeString);
} }
f = message.getExportBinaries();
if (f != null) {
writer.writeMessage(
23,
f,
google_protobuf_wrappers_pb.BoolValue.serializeBinaryToWriter
);
}
}; };
@ -795,24 +799,6 @@ proto.cc.arduino.cli.commands.CompileReq.prototype.setClean = function(value) {
}; };
/**
* optional bool export_binaries = 20;
* @return {boolean}
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.getExportBinaries = function() {
return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 20, false));
};
/**
* @param {boolean} value
* @return {!proto.cc.arduino.cli.commands.CompileReq} returns this
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.setExportBinaries = function(value) {
return jspb.Message.setProto3BooleanField(this, 20, value);
};
/** /**
* optional bool create_compilation_database_only = 21; * optional bool create_compilation_database_only = 21;
* @return {boolean} * @return {boolean}
@ -853,6 +839,43 @@ proto.cc.arduino.cli.commands.CompileReq.prototype.clearSourceOverrideMap = func
return this;}; return this;};
/**
* optional google.protobuf.BoolValue export_binaries = 23;
* @return {?proto.google.protobuf.BoolValue}
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.getExportBinaries = function() {
return /** @type{?proto.google.protobuf.BoolValue} */ (
jspb.Message.getWrapperField(this, google_protobuf_wrappers_pb.BoolValue, 23));
};
/**
* @param {?proto.google.protobuf.BoolValue|undefined} value
* @return {!proto.cc.arduino.cli.commands.CompileReq} returns this
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.setExportBinaries = function(value) {
return jspb.Message.setWrapperField(this, 23, value);
};
/**
* Clears the message field making it undefined.
* @return {!proto.cc.arduino.cli.commands.CompileReq} returns this
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.clearExportBinaries = function() {
return this.setExportBinaries(undefined);
};
/**
* Returns whether this field is set.
* @return {boolean}
*/
proto.cc.arduino.cli.commands.CompileReq.prototype.hasExportBinaries = function() {
return jspb.Message.getField(this, 23) != null;
};
/** /**
* List of repeated fields within this message type. * List of repeated fields within this message type.

View File

@ -11,6 +11,7 @@ import { NotificationServiceServer } from '../common/protocol';
import { ClientReadableStream } from '@grpc/grpc-js'; import { ClientReadableStream } from '@grpc/grpc-js';
import { ArduinoCoreClient } from './cli-protocol/commands/commands_grpc_pb'; import { ArduinoCoreClient } from './cli-protocol/commands/commands_grpc_pb';
import { firstToUpperCase, firstToLowerCase } from '../common/utils'; import { firstToUpperCase, firstToLowerCase } from '../common/utils';
import { BoolValue } from 'google-protobuf/google/protobuf/wrappers_pb';
@injectable() @injectable()
export class CoreServiceImpl implements CoreService { export class CoreServiceImpl implements CoreService {
@ -24,7 +25,7 @@ export class CoreServiceImpl implements CoreService {
@inject(NotificationServiceServer) @inject(NotificationServiceServer)
protected readonly notificationService: NotificationServiceServer; protected readonly notificationService: NotificationServiceServer;
async compile(options: CoreService.Compile.Options & { exportBinaries: boolean }): Promise<void> { async compile(options: CoreService.Compile.Options & { exportBinaries?: boolean }): Promise<void> {
const { sketchUri, fqbn } = options; const { sketchUri, fqbn } = options;
const sketchPath = FileUri.fsPath(sketchUri); const sketchPath = FileUri.fsPath(sketchUri);
@ -41,7 +42,11 @@ export class CoreServiceImpl implements CoreService {
compilerReq.setPreprocess(false); compilerReq.setPreprocess(false);
compilerReq.setVerbose(options.verbose); compilerReq.setVerbose(options.verbose);
compilerReq.setQuiet(false); compilerReq.setQuiet(false);
compilerReq.setExportBinaries(options.exportBinaries); if (typeof options.exportBinaries === 'boolean') {
const exportBinaries = new BoolValue();
exportBinaries.setValue(options.exportBinaries);
compilerReq.setExportBinaries(exportBinaries);
}
this.mergeSourceOverrides(compilerReq, options); this.mergeSourceOverrides(compilerReq, options);
const result = client.compile(compilerReq); const result = client.compile(compilerReq);