mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-11-14 20:59:27 +00:00
ATL-78: Implemented include library.
Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
@@ -726,6 +726,11 @@ export class Library extends jspb.Message {
|
||||
setExamplesList(value: Array<string>): Library;
|
||||
addExamples(value: string, index?: number): string;
|
||||
|
||||
clearProvidesIncludesList(): void;
|
||||
getProvidesIncludesList(): Array<string>;
|
||||
setProvidesIncludesList(value: Array<string>): Library;
|
||||
addProvidesIncludes(value: string, index?: number): string;
|
||||
|
||||
|
||||
serializeBinary(): Uint8Array;
|
||||
toObject(includeInstance?: boolean): Library.AsObject;
|
||||
@@ -764,6 +769,7 @@ export namespace Library {
|
||||
location: LibraryLocation,
|
||||
layout: LibraryLayout,
|
||||
examplesList: Array<string>,
|
||||
providesIncludesList: Array<string>,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4762,7 +4762,7 @@ proto.cc.arduino.cli.commands.InstalledLibrary.prototype.hasRelease = function()
|
||||
* @private {!Array<number>}
|
||||
* @const
|
||||
*/
|
||||
proto.cc.arduino.cli.commands.Library.repeatedFields_ = [8,9,26];
|
||||
proto.cc.arduino.cli.commands.Library.repeatedFields_ = [8,9,26,27];
|
||||
|
||||
|
||||
|
||||
@@ -4818,7 +4818,8 @@ proto.cc.arduino.cli.commands.Library.toObject = function(includeInstance, msg)
|
||||
propertiesMap: (f = msg.getPropertiesMap()) ? f.toObject(includeInstance, undefined) : [],
|
||||
location: jspb.Message.getFieldWithDefault(msg, 24, 0),
|
||||
layout: jspb.Message.getFieldWithDefault(msg, 25, 0),
|
||||
examplesList: (f = jspb.Message.getRepeatedField(msg, 26)) == null ? undefined : f
|
||||
examplesList: (f = jspb.Message.getRepeatedField(msg, 26)) == null ? undefined : f,
|
||||
providesIncludesList: (f = jspb.Message.getRepeatedField(msg, 27)) == null ? undefined : f
|
||||
};
|
||||
|
||||
if (includeInstance) {
|
||||
@@ -4953,6 +4954,10 @@ proto.cc.arduino.cli.commands.Library.deserializeBinaryFromReader = function(msg
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.addExamples(value);
|
||||
break;
|
||||
case 27:
|
||||
var value = /** @type {string} */ (reader.readString());
|
||||
msg.addProvidesIncludes(value);
|
||||
break;
|
||||
default:
|
||||
reader.skipField();
|
||||
break;
|
||||
@@ -5147,6 +5152,13 @@ proto.cc.arduino.cli.commands.Library.serializeBinaryToWriter = function(message
|
||||
f
|
||||
);
|
||||
}
|
||||
f = message.getProvidesIncludesList();
|
||||
if (f.length > 0) {
|
||||
writer.writeRepeatedString(
|
||||
27,
|
||||
f
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -5643,6 +5655,43 @@ proto.cc.arduino.cli.commands.Library.prototype.clearExamplesList = function() {
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* repeated string provides_includes = 27;
|
||||
* @return {!Array<string>}
|
||||
*/
|
||||
proto.cc.arduino.cli.commands.Library.prototype.getProvidesIncludesList = function() {
|
||||
return /** @type {!Array<string>} */ (jspb.Message.getRepeatedField(this, 27));
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {!Array<string>} value
|
||||
* @return {!proto.cc.arduino.cli.commands.Library} returns this
|
||||
*/
|
||||
proto.cc.arduino.cli.commands.Library.prototype.setProvidesIncludesList = function(value) {
|
||||
return jspb.Message.setField(this, 27, value || []);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number=} opt_index
|
||||
* @return {!proto.cc.arduino.cli.commands.Library} returns this
|
||||
*/
|
||||
proto.cc.arduino.cli.commands.Library.prototype.addProvidesIncludes = function(value, opt_index) {
|
||||
return jspb.Message.addToRepeatedField(this, 27, value, opt_index);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Clears the list making it empty but non-null.
|
||||
* @return {!proto.cc.arduino.cli.commands.Library} returns this
|
||||
*/
|
||||
proto.cc.arduino.cli.commands.Library.prototype.clearProvidesIncludesList = function() {
|
||||
return this.setProvidesIncludesList([]);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @enum {number}
|
||||
*/
|
||||
|
||||
@@ -11,7 +11,8 @@ import {
|
||||
LibraryInstallReq,
|
||||
LibraryInstallResp,
|
||||
LibraryUninstallReq,
|
||||
LibraryUninstallResp
|
||||
LibraryUninstallResp,
|
||||
Library
|
||||
} from './cli-protocol/commands/lib_pb';
|
||||
import { ToolOutputServiceServer } from '../common/protocol/tool-output-service';
|
||||
import { Installable } from '../common/protocol/installable';
|
||||
@@ -87,7 +88,7 @@ export class LibraryServiceServerImpl implements LibraryServiceServer {
|
||||
installable: true,
|
||||
installedVersion,
|
||||
}, item.getLatest()!, availableVersions)
|
||||
})
|
||||
});
|
||||
|
||||
return items;
|
||||
}
|
||||
@@ -109,9 +110,8 @@ export class LibraryServiceServerImpl implements LibraryServiceServer {
|
||||
|
||||
const resp = await new Promise<LibraryListResp>((resolve, reject) => client.libraryList(req, ((error, resp) => !!error ? reject(error) : resolve(resp))));
|
||||
return resp.getInstalledLibraryList().map(item => {
|
||||
const release = item.getRelease();
|
||||
const library = item.getLibrary();
|
||||
if (!release || !library) {
|
||||
if (!library) {
|
||||
return undefined;
|
||||
}
|
||||
const installedVersion = library.getVersion();
|
||||
@@ -123,11 +123,11 @@ export class LibraryServiceServerImpl implements LibraryServiceServer {
|
||||
description: library.getSentence(),
|
||||
summary: library.getParagraph(),
|
||||
moreInfoLink: library.getWebsite(),
|
||||
includes: release.getProvidesIncludesList(),
|
||||
includes: library.getProvidesIncludesList(),
|
||||
location: library.getLocation(),
|
||||
installDirUri: FileUri.create(library.getInstallDir()).toString(),
|
||||
exampleUris: library.getExamplesList().map(fsPath => FileUri.create(fsPath).toString())
|
||||
}, release, [library.getVersion()]);
|
||||
}, library, [library.getVersion()]);
|
||||
}).filter(notEmpty);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ export class LibraryServiceServerImpl implements LibraryServiceServer {
|
||||
|
||||
}
|
||||
|
||||
function toLibrary(pkg: Partial<LibraryPackage>, release: LibraryRelease, availableVersions: string[]): LibraryPackage {
|
||||
function toLibrary(pkg: Partial<LibraryPackage>, lib: LibraryRelease | Library, availableVersions: string[]): LibraryPackage {
|
||||
return {
|
||||
name: '',
|
||||
label: '',
|
||||
@@ -221,11 +221,11 @@ function toLibrary(pkg: Partial<LibraryPackage>, release: LibraryRelease, availa
|
||||
location: 0,
|
||||
...pkg,
|
||||
|
||||
author: release.getAuthor(),
|
||||
author: lib.getAuthor(),
|
||||
availableVersions,
|
||||
includes: release.getProvidesIncludesList(),
|
||||
description: release.getSentence(),
|
||||
moreInfoLink: release.getWebsite(),
|
||||
summary: release.getParagraph()
|
||||
includes: lib.getProvidesIncludesList(),
|
||||
description: lib.getSentence(),
|
||||
moreInfoLink: lib.getWebsite(),
|
||||
summary: lib.getParagraph()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user