mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-19 08:52:15 +01:00
Merge branch 'import-library-meta' of https://github.com/cmaglie/Arduino
This commit is contained in:
commit
7fa975df4f
@ -917,20 +917,20 @@ public class Sketch {
|
||||
}
|
||||
|
||||
|
||||
public void importLibrary(UserLibrary lib) throws IOException {
|
||||
importLibrary(lib.getSrcFolder());
|
||||
}
|
||||
|
||||
/**
|
||||
* Add import statements to the current tab for all of packages inside
|
||||
* the specified jar file.
|
||||
* Add import statements to the current tab for the specified library
|
||||
*/
|
||||
private void importLibrary(File jarPath) throws IOException {
|
||||
public void importLibrary(UserLibrary lib) throws IOException {
|
||||
// make sure the user didn't hide the sketch folder
|
||||
ensureExistence();
|
||||
|
||||
String list[] = Base.headerListFromIncludePath(jarPath);
|
||||
if (list == null || list.length == 0) {
|
||||
List<String> list = lib.getIncludes();
|
||||
if (list == null) {
|
||||
File srcFolder = lib.getSrcFolder();
|
||||
String[] headers = Base.headerListFromIncludePath(srcFolder);
|
||||
list = Arrays.asList(headers);
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,6 +56,7 @@ public class UserLibrary extends ContributedLibrary {
|
||||
private List<String> types;
|
||||
private List<String> declaredTypes;
|
||||
private boolean onGoingDevelopment;
|
||||
private List<String> includes;
|
||||
|
||||
public static UserLibrary create(File libFolder) throws IOException {
|
||||
// Parse metadata
|
||||
@ -131,6 +132,13 @@ public class UserLibrary extends ContributedLibrary {
|
||||
typesList.add(type.trim());
|
||||
}
|
||||
|
||||
List<String> includes = null;
|
||||
if (properties.containsKey("includes")) {
|
||||
includes = new ArrayList<>();
|
||||
for (String i : properties.get("includes").split(","))
|
||||
includes.add(i.trim());
|
||||
}
|
||||
|
||||
UserLibrary res = new UserLibrary();
|
||||
res.setInstalledFolder(libFolder);
|
||||
res.setInstalled(true);
|
||||
@ -147,6 +155,7 @@ public class UserLibrary extends ContributedLibrary {
|
||||
res.layout = layout;
|
||||
res.declaredTypes = typesList;
|
||||
res.onGoingDevelopment = Files.exists(Paths.get(libFolder.getAbsolutePath(), Constants.LIBRARY_DEVELOPMENT_FLAG_FILE));
|
||||
res.includes = includes;
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -247,6 +256,10 @@ public class UserLibrary extends ContributedLibrary {
|
||||
return onGoingDevelopment;
|
||||
}
|
||||
|
||||
public List<String> getIncludes() {
|
||||
return includes;
|
||||
}
|
||||
|
||||
protected enum LibraryLayout {
|
||||
FLAT, RECURSIVE
|
||||
}
|
||||
@ -278,6 +291,8 @@ public class UserLibrary extends ContributedLibrary {
|
||||
res += " (paragraph=" + paragraph + ")\n";
|
||||
res += " (url=" + website + ")\n";
|
||||
res += " (architectures=" + architectures + ")\n";
|
||||
if (includes != null)
|
||||
res += " (includes=" + includes + ")\n";
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,10 @@ ARDUINO 1.6.10
|
||||
[ide]
|
||||
* A lot of bugfixes to builder:
|
||||
https://github.com/arduino/arduino-builder/issues?q=milestone%3A1.3.19+is%3Aclosed
|
||||
* Libraries can now define the property "includes" in the library.properties to
|
||||
tell the IDE which `#include <...>` lines should be added to the sketch when
|
||||
the "Include library" command is used. See:
|
||||
https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification#libraryproperties-file-format
|
||||
|
||||
[core]
|
||||
* fixed a small bug that caused a compile error on some 3rd party derivatives
|
||||
|
Loading…
x
Reference in New Issue
Block a user