mirror of
https://github.com/arduino/Arduino.git
synced 2025-03-14 11:29:26 +01:00
Merge branch 'lib-1.5-newformat' into ide-1.5.x
This commit is contained in:
commit
a657582b2a
@ -37,7 +37,9 @@ import processing.app.helpers.Maps;
|
|||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.filefilters.OnlyDirs;
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
import processing.app.helpers.filefilters.OnlyFilesWithExtension;
|
||||||
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.tools.MapWithSubkeys;
|
import processing.app.javax.swing.filechooser.FileNameExtensionFilter;import processing.app.packages.Library;
|
||||||
|
import processing.app.packages.LibraryList;
|
||||||
|
import processing.app.tools.MapWithSubkeys;
|
||||||
import processing.app.tools.ZipDeflater;
|
import processing.app.tools.ZipDeflater;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
@ -89,10 +91,10 @@ public class Base {
|
|||||||
static private List<File> librariesFolders;
|
static private List<File> librariesFolders;
|
||||||
|
|
||||||
// maps library name to their library folder
|
// maps library name to their library folder
|
||||||
static private Map<String, File> libraries;
|
static private LibraryList libraries;
|
||||||
|
|
||||||
// maps #included files to their library folder
|
// maps #included files to their library folder
|
||||||
static Map<String, File> importToLibraryTable;
|
static Map<String, Library> importToLibraryTable;
|
||||||
|
|
||||||
// classpath for all known libraries for p5
|
// classpath for all known libraries for p5
|
||||||
// (both those in the p5/libs folder and those with lib subfolders
|
// (both those in the p5/libs folder and those with lib subfolders
|
||||||
@ -1041,26 +1043,18 @@ public class Base {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> getIDELibs() {
|
public LibraryList getIDELibs() {
|
||||||
if (libraries == null)
|
if (libraries == null)
|
||||||
return new HashMap<String, File>();
|
return new LibraryList();
|
||||||
Map<String, File> ideLibs = new HashMap<String, File>(libraries);
|
LibraryList res = new LibraryList(libraries);
|
||||||
for (String lib : libraries.keySet()) {
|
res.removeAll(getUserLibs());
|
||||||
if (FileUtils.isSubDirectory(getSketchbookFolder(), libraries.get(lib)))
|
return res;
|
||||||
ideLibs.remove(lib);
|
|
||||||
}
|
|
||||||
return ideLibs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> getUserLibs() {
|
public LibraryList getUserLibs() {
|
||||||
if (libraries == null)
|
if (libraries == null)
|
||||||
return new HashMap<String, File>();
|
return new LibraryList();
|
||||||
Map<String, File> userLibs = new HashMap<String, File>(libraries);
|
return libraries.filterLibrariesInSubfolder(getSketchbookFolder());
|
||||||
for (String lib : libraries.keySet()) {
|
|
||||||
if (!FileUtils.isSubDirectory(getSketchbookFolder(), libraries.get(lib)))
|
|
||||||
userLibs.remove(lib);
|
|
||||||
}
|
|
||||||
return userLibs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rebuildImportMenu(JMenu importMenu, final Editor editor) {
|
public void rebuildImportMenu(JMenu importMenu, final Editor editor) {
|
||||||
@ -1080,8 +1074,8 @@ public class Base {
|
|||||||
// Split between user supplied libraries and IDE libraries
|
// Split between user supplied libraries and IDE libraries
|
||||||
TargetPlatform targetPlatform = getTargetPlatform();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
if (targetPlatform != null) {
|
if (targetPlatform != null) {
|
||||||
Map<String, File> ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
Map<String, File> userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
try {
|
try {
|
||||||
// Find the current target. Get the platform, and then select the
|
// Find the current target. Get the platform, and then select the
|
||||||
// correct name and core path.
|
// correct name and core path.
|
||||||
@ -1121,44 +1115,33 @@ public class Base {
|
|||||||
if (found) menu.addSeparator();
|
if (found) menu.addSeparator();
|
||||||
|
|
||||||
// Add examples from libraries
|
// Add examples from libraries
|
||||||
Map<String, File> ideLibs = getIDELibs();
|
LibraryList ideLibs = getIDELibs();
|
||||||
List<String> names = new ArrayList<String>(ideLibs.keySet());
|
ideLibs.sort();
|
||||||
Collections.sort(names, String.CASE_INSENSITIVE_ORDER);
|
for (Library lib : ideLibs)
|
||||||
for (String name : names) {
|
addSketchesSubmenu(menu, lib, false);
|
||||||
File folder = ideLibs.get(name);
|
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
|
||||||
// Allows "fat" libraries to have examples in the root folder
|
|
||||||
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
|
||||||
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, File> userLibs = getUserLibs();
|
LibraryList userLibs = getUserLibs();
|
||||||
if (userLibs.size()>0) {
|
if (userLibs.size()>0) {
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
names = new ArrayList<String>(userLibs.keySet());
|
userLibs.sort();
|
||||||
Collections.sort(names, String.CASE_INSENSITIVE_ORDER);
|
for (Library lib : userLibs)
|
||||||
for (String name : names) {
|
addSketchesSubmenu(menu, lib, false);
|
||||||
File folder = userLibs.get(name);
|
|
||||||
addSketchesSubmenu(menu, name, folder, false);
|
|
||||||
// Allows "fat" libraries to have examples in the root folder
|
|
||||||
if (folder.getName().equals(Base.getTargetPlatform().getName()))
|
|
||||||
addSketchesSubmenu(menu, name, folder.getParentFile(), false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> scanLibraries(List<File> folders) {
|
public LibraryList scanLibraries(List<File> folders) throws IOException {
|
||||||
Map<String, File> res = new HashMap<String, File>();
|
LibraryList res = new LibraryList();
|
||||||
for (File folder : folders)
|
for (File folder : folders)
|
||||||
res.putAll(scanLibraries(folder));
|
res.addOrReplaceAll(scanLibraries(folder));
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, File> scanLibraries(File folder) {
|
public LibraryList scanLibraries(File folder) throws IOException {
|
||||||
Map<String, File> res = new HashMap<String, File>();
|
LibraryList res = new LibraryList();
|
||||||
|
|
||||||
String list[] = folder.list(new OnlyDirs());
|
String list[] = folder.list(new OnlyDirs());
|
||||||
// if a bad folder or something like that, this might come back null
|
// if a bad folder or something like that, this might come back null
|
||||||
if (list == null)
|
if (list == null)
|
||||||
@ -1175,41 +1158,14 @@ public class Base {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
subfolder = scanFatLibrary(subfolder);
|
Library lib = Library.create(subfolder);
|
||||||
|
|
||||||
// (also replace previously found libs with the same name)
|
// (also replace previously found libs with the same name)
|
||||||
if (subfolder != null)
|
if (lib != null)
|
||||||
res.put(libName, subfolder);
|
res.addOrReplace(lib);
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Scans inside a "FAT" (multi-platform) library folder to see if it contains
|
|
||||||
* a version suitable for the actual selected architecture. If a suitable
|
|
||||||
* version is found the folder containing that version is returned, otherwise
|
|
||||||
* <b>null</b> is returned.<br />
|
|
||||||
* <br />
|
|
||||||
* If a non-"FAT" library is detected, we assume that the library is suitable
|
|
||||||
* for the current architecture and the libFolder parameter is returned.<br />
|
|
||||||
*
|
|
||||||
* @param libFolder
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public File scanFatLibrary(File libFolder) {
|
|
||||||
// A library is considered "fat" if it contains a file called
|
|
||||||
// "library.properties"
|
|
||||||
File libraryPropFile = new File(libFolder, "library.properties");
|
|
||||||
if (!libraryPropFile.exists() || !libraryPropFile.isFile())
|
|
||||||
return libFolder;
|
|
||||||
|
|
||||||
// Search for a subfolder for actual architecture, return null if not found
|
|
||||||
File archSubfolder = new File(libFolder, Base.getTargetPlatform().getName());
|
|
||||||
if (!archSubfolder.exists() || !archSubfolder.isDirectory())
|
|
||||||
return null;
|
|
||||||
return archSubfolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onBoardOrPortChange() {
|
public void onBoardOrPortChange() {
|
||||||
TargetPlatform targetPlatform = getTargetPlatform();
|
TargetPlatform targetPlatform = getTargetPlatform();
|
||||||
if (targetPlatform == null)
|
if (targetPlatform == null)
|
||||||
@ -1228,18 +1184,25 @@ public class Base {
|
|||||||
// Scan for libraries in each library folder.
|
// Scan for libraries in each library folder.
|
||||||
// Libraries located in the latest folders on the list can override
|
// Libraries located in the latest folders on the list can override
|
||||||
// other libraries with the same name.
|
// other libraries with the same name.
|
||||||
libraries = scanLibraries(librariesFolders);
|
try {
|
||||||
|
libraries = scanLibraries(librariesFolders);
|
||||||
|
} catch (IOException e) {
|
||||||
|
showWarning(_("Error"), _("Error reading preferences"), e);
|
||||||
|
}
|
||||||
|
String currentArch = Base.getTargetPlatform().getName();
|
||||||
|
libraries = libraries.filterByArchitecture(currentArch);
|
||||||
|
|
||||||
// Populate importToLibraryTable
|
// Populate importToLibraryTable
|
||||||
importToLibraryTable = new HashMap<String, File>();
|
importToLibraryTable = new HashMap<String, Library>();
|
||||||
for (File subfolder : libraries.values()) {
|
for (Library lib : libraries) {
|
||||||
try {
|
try {
|
||||||
String packages[] = headerListFromIncludePath(subfolder);
|
String headers[] = headerListFromIncludePath(lib.getSrcFolder());
|
||||||
for (String pkg : packages) {
|
for (String header : headers) {
|
||||||
importToLibraryTable.put(pkg, subfolder);
|
importToLibraryTable.put(header, lib);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", subfolder), e);
|
showWarning(_("Error"), I18n
|
||||||
|
.format("Unable to list header files in {0}", lib.getSrcFolder()), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1517,6 +1480,13 @@ public class Base {
|
|||||||
return ifound; // actually ignored, but..
|
return ifound; // actually ignored, but..
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean addSketchesSubmenu(JMenu menu, Library lib,
|
||||||
|
boolean replaceExisting)
|
||||||
|
throws IOException {
|
||||||
|
return addSketchesSubmenu(menu, lib.getName(), lib.getFolder(),
|
||||||
|
replaceExisting);
|
||||||
|
}
|
||||||
|
|
||||||
private boolean addSketchesSubmenu(JMenu menu, String name, File folder,
|
private boolean addSketchesSubmenu(JMenu menu, String name, File folder,
|
||||||
final boolean replaceExisting) throws IOException {
|
final boolean replaceExisting) throws IOException {
|
||||||
|
|
||||||
@ -1583,29 +1553,28 @@ public class Base {
|
|||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addLibraries(JMenu menu, Map<String, File> libs) throws IOException {
|
protected void addLibraries(JMenu menu, LibraryList libs) throws IOException {
|
||||||
|
|
||||||
List<String> list = new ArrayList<String>(libs.keySet());
|
LibraryList list = new LibraryList(libs);
|
||||||
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
|
list.sort();
|
||||||
|
|
||||||
ActionListener listener = new ActionListener() {
|
for (Library lib : list) {
|
||||||
public void actionPerformed(ActionEvent event) {
|
@SuppressWarnings("serial")
|
||||||
String jarPath = event.getActionCommand();
|
AbstractAction action = new AbstractAction(lib.getName()) {
|
||||||
try {
|
public void actionPerformed(ActionEvent event) {
|
||||||
activeEditor.getSketch().importLibrary(jarPath);
|
Library l = (Library) getValue("library");
|
||||||
} catch (IOException e) {
|
try {
|
||||||
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", jarPath), e);
|
activeEditor.getSketch().importLibrary(l);
|
||||||
|
} catch (IOException e) {
|
||||||
|
showWarning(_("Error"), I18n.format("Unable to list header files in {0}", l.getSrcFolder()), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
action.putValue("library", lib);
|
||||||
|
|
||||||
for (String name : list) {
|
|
||||||
File folder = libs.get(name);
|
|
||||||
|
|
||||||
// Add new element at the bottom
|
// Add new element at the bottom
|
||||||
JMenuItem item = new JMenuItem(name);
|
JMenuItem item = new JMenuItem(action);
|
||||||
item.addActionListener(listener);
|
item.putClientProperty("library", lib);
|
||||||
item.setActionCommand(folder.getAbsolutePath());
|
|
||||||
menu.add(item);
|
menu.add(item);
|
||||||
|
|
||||||
// XXX: DAM: should recurse here so that library folders can be nested
|
// XXX: DAM: should recurse here so that library folders can be nested
|
||||||
@ -1877,7 +1846,7 @@ public class Base {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static public Map<String, File> getLibraries() {
|
static public LibraryList getLibraries() {
|
||||||
return libraries;
|
return libraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,8 @@ import processing.app.debug.RunnerException;
|
|||||||
import processing.app.debug.Sizer;
|
import processing.app.debug.Sizer;
|
||||||
import processing.app.debug.Uploader;
|
import processing.app.debug.Uploader;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
|
import processing.app.packages.Library;
|
||||||
|
import processing.app.packages.LibraryList;
|
||||||
import processing.app.preproc.*;
|
import processing.app.preproc.*;
|
||||||
import processing.core.*;
|
import processing.core.*;
|
||||||
import static processing.app.I18n._;
|
import static processing.app.I18n._;
|
||||||
@ -87,16 +89,10 @@ public class Sketch {
|
|||||||
/** Class path determined during build. */
|
/** Class path determined during build. */
|
||||||
private String classPath;
|
private String classPath;
|
||||||
|
|
||||||
/**
|
|
||||||
* This is *not* the "Processing" libraries path, this is the Java libraries
|
|
||||||
* path, as in java.library.path=BlahBlah, which identifies search paths for
|
|
||||||
* DLLs or JNILIBs.
|
|
||||||
*/
|
|
||||||
private String libraryPath;
|
|
||||||
/**
|
/**
|
||||||
* List of library folders.
|
* List of library folders.
|
||||||
*/
|
*/
|
||||||
private ArrayList<File> importedLibraries;
|
private LibraryList importedLibraries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* path is location of the main .pde file, because this is also
|
* path is location of the main .pde file, because this is also
|
||||||
@ -1120,15 +1116,19 @@ public class Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void importLibrary(Library lib) throws IOException {
|
||||||
|
importLibrary(lib.getSrcFolder());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add import statements to the current tab for all of packages inside
|
* Add import statements to the current tab for all of packages inside
|
||||||
* the specified jar file.
|
* the specified jar file.
|
||||||
*/
|
*/
|
||||||
public void importLibrary(String jarPath) throws IOException {
|
public void importLibrary(File jarPath) throws IOException {
|
||||||
// make sure the user didn't hide the sketch folder
|
// make sure the user didn't hide the sketch folder
|
||||||
ensureExistence();
|
ensureExistence();
|
||||||
|
|
||||||
String list[] = Base.headerListFromIncludePath(new File(jarPath));
|
String list[] = Base.headerListFromIncludePath(jarPath);
|
||||||
|
|
||||||
// import statements into the main sketch file (code[0])
|
// import statements into the main sketch file (code[0])
|
||||||
// if the current code is a .java file, insert into current
|
// if the current code is a .java file, insert into current
|
||||||
@ -1421,18 +1421,14 @@ public class Sketch {
|
|||||||
|
|
||||||
// grab the imports from the code just preproc'd
|
// grab the imports from the code just preproc'd
|
||||||
|
|
||||||
importedLibraries = new ArrayList<File>();
|
importedLibraries = new LibraryList();
|
||||||
//Remember to clear library path before building it.
|
|
||||||
libraryPath = "";
|
|
||||||
for (String item : preprocessor.getExtraImports()) {
|
for (String item : preprocessor.getExtraImports()) {
|
||||||
|
|
||||||
File libFolder = (File) Base.importToLibraryTable.get(item);
|
Library lib = Base.importToLibraryTable.get(item);
|
||||||
//If needed can Debug libraryPath here
|
//If needed can Debug libraryPath here
|
||||||
|
|
||||||
if (libFolder != null && !importedLibraries.contains(libFolder)) {
|
if (lib != null && !importedLibraries.contains(lib)) {
|
||||||
importedLibraries.add(libFolder);
|
importedLibraries.add(lib);
|
||||||
//classPath += Compiler.contentsToClassPath(libFolder);
|
|
||||||
libraryPath += File.pathSeparator + libFolder.getAbsolutePath();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1462,7 +1458,7 @@ public class Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public ArrayList<File> getImportedLibraries() {
|
public LibraryList getImportedLibraries() {
|
||||||
return importedLibraries;
|
return importedLibraries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1887,11 +1883,6 @@ public class Sketch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getLibraryPath() {
|
|
||||||
return libraryPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public SketchCode[] getCode() {
|
public SketchCode[] getCode() {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,8 @@ import processing.app.Sketch;
|
|||||||
import processing.app.SketchCode;
|
import processing.app.SketchCode;
|
||||||
import processing.app.helpers.PreferencesMap;
|
import processing.app.helpers.PreferencesMap;
|
||||||
import processing.app.helpers.StringReplacer;
|
import processing.app.helpers.StringReplacer;
|
||||||
|
import processing.app.helpers.filefilters.OnlyDirs;
|
||||||
|
import processing.app.packages.Library;
|
||||||
import processing.core.PApplet;
|
import processing.core.PApplet;
|
||||||
|
|
||||||
public class Compiler implements MessageConsumer {
|
public class Compiler implements MessageConsumer {
|
||||||
@ -55,7 +57,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
private PreferencesMap prefs;
|
private PreferencesMap prefs;
|
||||||
private boolean verbose;
|
private boolean verbose;
|
||||||
private boolean sketchIsCompiled;
|
private boolean sketchIsCompiled;
|
||||||
|
private String targetArch;
|
||||||
|
|
||||||
private RunnerException exception;
|
private RunnerException exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -83,8 +86,9 @@ public class Compiler implements MessageConsumer {
|
|||||||
includePaths.add(prefs.get("build.core.path"));
|
includePaths.add(prefs.get("build.core.path"));
|
||||||
if (prefs.get("build.variant.path").length() != 0)
|
if (prefs.get("build.variant.path").length() != 0)
|
||||||
includePaths.add(prefs.get("build.variant.path"));
|
includePaths.add(prefs.get("build.variant.path"));
|
||||||
for (File file : sketch.getImportedLibraries())
|
for (Library lib : sketch.getImportedLibraries())
|
||||||
includePaths.add(file.getPath());
|
for (File folder : lib.getSrcFolders(targetArch))
|
||||||
|
includePaths.add(folder.getPath());
|
||||||
|
|
||||||
// 1. compile the sketch (already in the buildPath)
|
// 1. compile the sketch (already in the buildPath)
|
||||||
sketch.setCompilingProgress(30);
|
sketch.setCompilingProgress(30);
|
||||||
@ -129,7 +133,7 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
TargetPlatform targetPlatform = Base.getTargetPlatform();
|
||||||
|
|
||||||
// Merge all the global preference configuration in order of priority
|
// Merge all the global preference configuration in order of priority
|
||||||
PreferencesMap p = new PreferencesMap();
|
PreferencesMap p = new PreferencesMap();
|
||||||
p.putAll(Preferences.getMap());
|
p.putAll(Preferences.getMap());
|
||||||
@ -142,6 +146,8 @@ public class Compiler implements MessageConsumer {
|
|||||||
|
|
||||||
p.put("build.path", _buildPath);
|
p.put("build.path", _buildPath);
|
||||||
p.put("build.project_name", _primaryClassName);
|
p.put("build.project_name", _primaryClassName);
|
||||||
|
targetArch = targetPlatform.getName();
|
||||||
|
p.put("build.arch", targetArch.toUpperCase());
|
||||||
|
|
||||||
if (!p.containsKey("compiler.path"))
|
if (!p.containsKey("compiler.path"))
|
||||||
p.put("compiler.path", Base.getAvrBasePath());
|
p.put("compiler.path", Base.getAvrBasePath());
|
||||||
@ -578,26 +584,49 @@ public class Compiler implements MessageConsumer {
|
|||||||
// 2. compile the libraries, outputting .o files to:
|
// 2. compile the libraries, outputting .o files to:
|
||||||
// <buildPath>/<library>/
|
// <buildPath>/<library>/
|
||||||
void compileLibraries(List<String> includePaths) throws RunnerException {
|
void compileLibraries(List<String> includePaths) throws RunnerException {
|
||||||
|
File outputPath = new File(prefs.get("build.path"));
|
||||||
for (File libraryFolder : sketch.getImportedLibraries()) {
|
for (Library lib : sketch.getImportedLibraries()) {
|
||||||
String outputPath = prefs.get("build.path");
|
for (File folder : lib.getSrcFolders(targetArch)) {
|
||||||
File outputFolder = new File(outputPath, libraryFolder.getName());
|
if (lib.isPre15Lib()) {
|
||||||
File utilityFolder = new File(libraryFolder, "utility");
|
compileLibrary(outputPath, folder, includePaths);
|
||||||
createFolder(outputFolder);
|
} else {
|
||||||
// this library can use includes in its utility/ folder
|
recursiveCompileLibrary(outputPath, folder, includePaths);
|
||||||
includePaths.add(utilityFolder.getAbsolutePath());
|
}
|
||||||
|
}
|
||||||
objectFiles.addAll(compileFiles(outputFolder.getAbsolutePath(),
|
|
||||||
libraryFolder, false, includePaths));
|
|
||||||
outputFolder = new File(outputFolder, "utility");
|
|
||||||
createFolder(outputFolder);
|
|
||||||
objectFiles.addAll(compileFiles(outputFolder.getAbsolutePath(),
|
|
||||||
utilityFolder, false, includePaths));
|
|
||||||
// other libraries should not see this library's utility/ folder
|
|
||||||
includePaths.remove(includePaths.size() - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void recursiveCompileLibrary(File outputPath, File libraryFolder, List<String> includePaths) throws RunnerException {
|
||||||
|
File newOutputPath = compileFilesInFolder(outputPath, libraryFolder, includePaths);
|
||||||
|
for (File subFolder : libraryFolder.listFiles(new OnlyDirs())) {
|
||||||
|
recursiveCompileLibrary(newOutputPath, subFolder, includePaths);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private File compileFilesInFolder(File outputPath, File libraryFolder, List<String> includePaths) throws RunnerException {
|
||||||
|
File outputFolder = new File(outputPath, libraryFolder.getName());
|
||||||
|
createFolder(outputFolder);
|
||||||
|
objectFiles.addAll(compileFiles(outputFolder.getAbsolutePath(), libraryFolder, false, includePaths));
|
||||||
|
return outputFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void compileLibrary(File outputPath, File libraryFolder, List<String> includePaths) throws RunnerException {
|
||||||
|
File outputFolder = new File(outputPath, libraryFolder.getName());
|
||||||
|
File utilityFolder = new File(libraryFolder, "utility");
|
||||||
|
createFolder(outputFolder);
|
||||||
|
// this library can use includes in its utility/ folder
|
||||||
|
includePaths.add(utilityFolder.getAbsolutePath());
|
||||||
|
|
||||||
|
objectFiles.addAll(compileFiles(outputFolder.getAbsolutePath(),
|
||||||
|
libraryFolder, false, includePaths));
|
||||||
|
outputFolder = new File(outputFolder, "utility");
|
||||||
|
createFolder(outputFolder);
|
||||||
|
objectFiles.addAll(compileFiles(outputFolder.getAbsolutePath(),
|
||||||
|
utilityFolder, false, includePaths));
|
||||||
|
// other libraries should not see this library's utility/ folder
|
||||||
|
includePaths.remove(includePaths.size() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
// 3. compile the core, outputting .o files to <buildPath> and then
|
// 3. compile the core, outputting .o files to <buildPath> and then
|
||||||
// collecting them into the core.a library file.
|
// collecting them into the core.a library file.
|
||||||
void compileCore()
|
void compileCore()
|
||||||
|
21
app/src/processing/app/helpers/StringMatchers.java
Normal file
21
app/src/processing/app/helpers/StringMatchers.java
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
package processing.app.helpers;
|
||||||
|
|
||||||
|
public class StringMatchers {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to match <b>input</b> with <b>pattern</b>. The pattern can use the
|
||||||
|
* "*" and "?" globs to match any-char-sequence and any-char respectively.
|
||||||
|
*
|
||||||
|
* @param input
|
||||||
|
* The string to be checked
|
||||||
|
* @param pattern
|
||||||
|
* The pattern to match
|
||||||
|
* @return <b>true</b> if the <b>input</b> matches the <b>pattern</b>,
|
||||||
|
* <b>false</b> otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean wildcardMatch(String input, String pattern) {
|
||||||
|
String regex = pattern.replace("?", ".?").replace("*", ".*?");
|
||||||
|
return input.matches(regex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
230
app/src/processing/app/packages/Library.java
Normal file
230
app/src/processing/app/packages/Library.java
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
package processing.app.packages;
|
||||||
|
|
||||||
|
import processing.app.helpers.PreferencesMap;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static processing.app.helpers.StringMatchers.wildcardMatch;
|
||||||
|
|
||||||
|
public class Library {
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String version;
|
||||||
|
private String author;
|
||||||
|
private String email;
|
||||||
|
private String url;
|
||||||
|
private String sentence;
|
||||||
|
private String paragraph;
|
||||||
|
private List<String> coreDependencies;
|
||||||
|
private List<String> dependencies;
|
||||||
|
private File folder, srcFolder, archFolder;
|
||||||
|
private List<String> architectures;
|
||||||
|
private boolean pre15Lib;
|
||||||
|
|
||||||
|
private static final List<String> MANDATORY_PROPERTIES = Arrays
|
||||||
|
.asList(new String[] { "architectures", "author", "core-dependencies",
|
||||||
|
"dependencies", "email", "name", "paragraph", "sentence", "url",
|
||||||
|
"version" });
|
||||||
|
private static final List<String> OPTIONAL_FOLDERS = Arrays
|
||||||
|
.asList(new String[] { "arch", "examples", "extras", "src" });
|
||||||
|
private static final List<String> OPTIONAL_FILES = Arrays
|
||||||
|
.asList(new String[] { "keywords.txt", "library.properties" });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scans inside a folder and create a Library object out of it. Automatically
|
||||||
|
* detects pre-1.5 libraries. Automatically fills metadata from
|
||||||
|
* library.properties file if found.
|
||||||
|
*
|
||||||
|
* @param libFolder
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
static public Library create(File libFolder) throws IOException {
|
||||||
|
// A library is considered "new" if it contains a file called
|
||||||
|
// "library.properties"
|
||||||
|
File check = new File(libFolder, "library.properties");
|
||||||
|
if (!check.exists() || !check.isFile())
|
||||||
|
return createPre15Library(libFolder);
|
||||||
|
else
|
||||||
|
return createLibrary(libFolder);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Library createLibrary(File libFolder) throws IOException {
|
||||||
|
// Parse metadata
|
||||||
|
File propertiesFile = new File(libFolder, "library.properties");
|
||||||
|
PreferencesMap properties = new PreferencesMap();
|
||||||
|
properties.load(propertiesFile);
|
||||||
|
|
||||||
|
// Library sanity checks
|
||||||
|
// ---------------------
|
||||||
|
|
||||||
|
// 1. Check mandatory properties
|
||||||
|
for (String p : MANDATORY_PROPERTIES)
|
||||||
|
if (!properties.containsKey(p))
|
||||||
|
throw new IOException("Missing '" + p + "' from library");
|
||||||
|
|
||||||
|
// 2. Check mandatory folders
|
||||||
|
File srcFolder = new File(libFolder, "src");
|
||||||
|
if (!srcFolder.exists() || !srcFolder.isDirectory())
|
||||||
|
throw new IOException("Missing 'src' folder");
|
||||||
|
|
||||||
|
// 3. check if root folder contains prohibited stuff
|
||||||
|
for (File file : libFolder.listFiles()) {
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
if (!OPTIONAL_FOLDERS.contains(file.getName()))
|
||||||
|
throw new IOException("Invalid folder '" + file.getName() + "'.");
|
||||||
|
} else {
|
||||||
|
if (!OPTIONAL_FILES.contains(file.getName()))
|
||||||
|
throw new IOException("Invalid file '" + file.getName() + "'.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Extract metadata info
|
||||||
|
List<String> archs = new ArrayList<String>();
|
||||||
|
for (String arch : properties.get("architectures").split(","))
|
||||||
|
archs.add(arch.trim());
|
||||||
|
|
||||||
|
List<String> coreDeps = new ArrayList<String>();
|
||||||
|
for (String dep : properties.get("core-dependencies").split(","))
|
||||||
|
coreDeps.add(dep.trim());
|
||||||
|
|
||||||
|
List<String> dependencies = new ArrayList<String>();
|
||||||
|
for (String dependency : properties.get("dependencies").split(",")) {
|
||||||
|
dependency = dependency.trim();
|
||||||
|
if (!dependency.equals("")) {
|
||||||
|
dependencies.add(dependency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Library res = new Library();
|
||||||
|
res.folder = libFolder;
|
||||||
|
res.srcFolder = srcFolder;
|
||||||
|
res.archFolder = new File(libFolder, "arch");
|
||||||
|
res.name = properties.get("name").trim();
|
||||||
|
res.author = properties.get("author").trim();
|
||||||
|
res.email = properties.get("email").trim();
|
||||||
|
res.sentence = properties.get("sentence").trim();
|
||||||
|
res.paragraph = properties.get("paragraph").trim();
|
||||||
|
res.url = properties.get("url").trim();
|
||||||
|
res.architectures = archs;
|
||||||
|
res.coreDependencies = coreDeps;
|
||||||
|
res.dependencies = dependencies;
|
||||||
|
res.version = properties.get("version").trim();
|
||||||
|
res.pre15Lib = false;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Library createPre15Library(File libFolder) {
|
||||||
|
// construct an old style library
|
||||||
|
Library res = new Library();
|
||||||
|
res.folder = libFolder;
|
||||||
|
res.srcFolder = libFolder;
|
||||||
|
res.name = libFolder.getName();
|
||||||
|
res.architectures = Arrays.asList(new String[]{"*"});
|
||||||
|
res.pre15Lib = true;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<File> getSrcFolders(String reqArch) {
|
||||||
|
if (!supportsArchitecture(reqArch))
|
||||||
|
return null;
|
||||||
|
List<File> res = new ArrayList<File>();
|
||||||
|
res.add(srcFolder);
|
||||||
|
File archSpecificFolder = new File(archFolder, reqArch);
|
||||||
|
if (archSpecificFolder.exists() && archSpecificFolder.isDirectory()) {
|
||||||
|
res.add(archSpecificFolder);
|
||||||
|
} else {
|
||||||
|
// If specific architecture folder is not found try with "default"
|
||||||
|
archSpecificFolder = new File(archFolder, "default");
|
||||||
|
if (archSpecificFolder.exists() && archSpecificFolder.isDirectory())
|
||||||
|
res.add(archSpecificFolder);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean supportsArchitecture(String reqArch) {
|
||||||
|
for (String arch : architectures)
|
||||||
|
if (wildcardMatch(reqArch, arch))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final Comparator<Library> CASE_INSENSITIVE_ORDER = new Comparator<Library>() {
|
||||||
|
@Override
|
||||||
|
public int compare(Library o1, Library o2) {
|
||||||
|
return o1.getName().compareToIgnoreCase(o2.getName());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public File getSrcFolder() {
|
||||||
|
return srcFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPre15Lib() {
|
||||||
|
return pre15Lib;
|
||||||
|
}
|
||||||
|
|
||||||
|
public File getFolder() {
|
||||||
|
return folder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getArchitectures() {
|
||||||
|
return architectures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuthor() {
|
||||||
|
return author;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getCoreDependencies() {
|
||||||
|
return coreDependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDependencies() {
|
||||||
|
return dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEmail() {
|
||||||
|
return email;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getParagraph() {
|
||||||
|
return paragraph;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSentence() {
|
||||||
|
return sentence;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVersion() {
|
||||||
|
return version;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String res = "Library:";
|
||||||
|
res += " (name=" + name + ")";
|
||||||
|
res += " (architectures=" + architectures + ")";
|
||||||
|
res += " (author=" + author + ")";
|
||||||
|
res += " (core-dependencies=" + coreDependencies + ")";
|
||||||
|
res += " (dependencies=" + dependencies + ")";
|
||||||
|
res += " (email=" + email + ")";
|
||||||
|
res += " (paragraph=" + paragraph + ")";
|
||||||
|
res += " (sentence=" + sentence + ")";
|
||||||
|
res += " (url=" + url + ")";
|
||||||
|
res += " (version=" + version + ")";
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
70
app/src/processing/app/packages/LibraryList.java
Normal file
70
app/src/processing/app/packages/LibraryList.java
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
package processing.app.packages;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
import processing.app.helpers.FileUtils;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class LibraryList extends ArrayList<Library> {
|
||||||
|
|
||||||
|
public LibraryList(LibraryList libs) {
|
||||||
|
super(libs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryList() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Library getByName(String name) {
|
||||||
|
for (Library l : this)
|
||||||
|
if (l.getName().equals(name))
|
||||||
|
return l;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrReplace(Library lib) {
|
||||||
|
Library l = getByName(lib.getName());
|
||||||
|
if (l != null)
|
||||||
|
remove(l);
|
||||||
|
add(lib);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addOrReplaceAll(Collection<? extends Library> c) {
|
||||||
|
for (Library l : c)
|
||||||
|
addOrReplace(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sort() {
|
||||||
|
Collections.sort(this, Library.CASE_INSENSITIVE_ORDER);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Library search(String name, String arch) {
|
||||||
|
for (Library lib : this) {
|
||||||
|
if (!lib.getName().equals(name))
|
||||||
|
continue;
|
||||||
|
if (!lib.supportsArchitecture(arch))
|
||||||
|
continue;
|
||||||
|
return lib;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryList filterByArchitecture(String reqArch) {
|
||||||
|
LibraryList res = new LibraryList();
|
||||||
|
for (Library lib : this)
|
||||||
|
if (lib.supportsArchitecture(reqArch))
|
||||||
|
res.add(lib);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LibraryList filterLibrariesInSubfolder(File subFolder) {
|
||||||
|
LibraryList res = new LibraryList();
|
||||||
|
for (Library lib : this)
|
||||||
|
if (FileUtils.isSubDirectory(subFolder, lib.getFolder()))
|
||||||
|
res.add(lib);
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,7 @@
|
|||||||
package processing.app.syntax;
|
package processing.app.syntax;
|
||||||
|
|
||||||
import processing.app.*;
|
import processing.app.*;
|
||||||
|
import processing.app.packages.Library;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -59,8 +60,8 @@ public class PdeKeywords extends CTokenMarker {
|
|||||||
keywordColoring = new KeywordMap(false);
|
keywordColoring = new KeywordMap(false);
|
||||||
keywordToReference = new Hashtable();
|
keywordToReference = new Hashtable();
|
||||||
getKeywords(Base.getLibStream("keywords.txt"));
|
getKeywords(Base.getLibStream("keywords.txt"));
|
||||||
for (File lib : Base.getLibraries().values()) {
|
for (Library lib : Base.getLibraries()) {
|
||||||
File keywords = new File(lib, "keywords.txt");
|
File keywords = new File(lib.getFolder(), "keywords.txt");
|
||||||
if (keywords.exists()) getKeywords(new FileInputStream(keywords));
|
if (keywords.exists()) getKeywords(new FileInputStream(keywords));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -4,6 +4,8 @@ ARDUINO 1.5.3 BETA
|
|||||||
[ide]
|
[ide]
|
||||||
* Removed useless baud rates from serial monitor
|
* Removed useless baud rates from serial monitor
|
||||||
* Fixed some minor IDE UI bugs (Shigeru Kanemoto)
|
* Fixed some minor IDE UI bugs (Shigeru Kanemoto)
|
||||||
|
* Added support for new 1.5 Library format (https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5:-Library-specification)
|
||||||
|
* Pass board type from boards.txt (https://github.com/arduino/Arduino/issues/308)
|
||||||
|
|
||||||
[arduino core]
|
[arduino core]
|
||||||
* sam: Fixed delayMicrosecond() when interrupts are disabled
|
* sam: Fixed delayMicrosecond() when interrupts are disabled
|
||||||
|
@ -20,6 +20,7 @@ uno.bootloader.file=optiboot/optiboot_atmega328.hex
|
|||||||
|
|
||||||
uno.build.mcu=atmega328p
|
uno.build.mcu=atmega328p
|
||||||
uno.build.f_cpu=16000000L
|
uno.build.f_cpu=16000000L
|
||||||
|
uno.build.board=ARDUINO_UNO
|
||||||
uno.build.core=arduino
|
uno.build.core=arduino
|
||||||
uno.build.variant=standard
|
uno.build.variant=standard
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ atmega328diecimila.bootloader.unlock_bits=0x3F
|
|||||||
atmega328diecimila.bootloader.lock_bits=0x0F
|
atmega328diecimila.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
atmega328diecimila.build.f_cpu=16000000L
|
atmega328diecimila.build.f_cpu=16000000L
|
||||||
|
atmega328diecimila.build.board=ARDUINO_DUEMILANOVE
|
||||||
atmega328diecimila.build.core=arduino
|
atmega328diecimila.build.core=arduino
|
||||||
atmega328diecimila.build.variant=standard
|
atmega328diecimila.build.variant=standard
|
||||||
|
|
||||||
@ -75,6 +77,7 @@ nano.bootloader.unlock_bits=0x3F
|
|||||||
nano.bootloader.lock_bits=0x0F
|
nano.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
nano.build.f_cpu=16000000L
|
nano.build.f_cpu=16000000L
|
||||||
|
nano.build.board=ARDUINO_NANO
|
||||||
nano.build.core=arduino
|
nano.build.core=arduino
|
||||||
nano.build.variant=eightanaloginputs
|
nano.build.variant=eightanaloginputs
|
||||||
|
|
||||||
@ -124,6 +127,7 @@ mega2560.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
mega2560.build.mcu=atmega2560
|
mega2560.build.mcu=atmega2560
|
||||||
mega2560.build.f_cpu=16000000L
|
mega2560.build.f_cpu=16000000L
|
||||||
|
mega2560.build.board=ARDUINO_MEGA2560
|
||||||
mega2560.build.core=arduino
|
mega2560.build.core=arduino
|
||||||
mega2560.build.variant=mega
|
mega2560.build.variant=mega
|
||||||
|
|
||||||
@ -147,6 +151,7 @@ mega.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
mega.build.mcu=atmega1280
|
mega.build.mcu=atmega1280
|
||||||
mega.build.f_cpu=16000000L
|
mega.build.f_cpu=16000000L
|
||||||
|
mega.build.board=ARDUINO_MEGA
|
||||||
mega.build.core=arduino
|
mega.build.core=arduino
|
||||||
mega.build.variant=mega
|
mega.build.variant=mega
|
||||||
|
|
||||||
@ -173,6 +178,7 @@ leonardo.build.mcu=atmega32u4
|
|||||||
leonardo.build.f_cpu=16000000L
|
leonardo.build.f_cpu=16000000L
|
||||||
leonardo.build.vid=0x2341
|
leonardo.build.vid=0x2341
|
||||||
leonardo.build.pid=0x8036
|
leonardo.build.pid=0x8036
|
||||||
|
leonardo.build.board=ARDUINO_LEONARDO
|
||||||
leonardo.build.core=arduino
|
leonardo.build.core=arduino
|
||||||
leonardo.build.variant=leonardo
|
leonardo.build.variant=leonardo
|
||||||
leonardo.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
leonardo.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
||||||
@ -200,6 +206,7 @@ micro.build.mcu=atmega32u4
|
|||||||
micro.build.f_cpu=16000000L
|
micro.build.f_cpu=16000000L
|
||||||
micro.build.vid=0x2341
|
micro.build.vid=0x2341
|
||||||
micro.build.pid=0x8037
|
micro.build.pid=0x8037
|
||||||
|
micro.build.board=ARDUINO_MICRO
|
||||||
micro.build.core=arduino
|
micro.build.core=arduino
|
||||||
micro.build.variant=micro
|
micro.build.variant=micro
|
||||||
micro.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
micro.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
||||||
@ -227,6 +234,7 @@ esplora.build.mcu=atmega32u4
|
|||||||
esplora.build.f_cpu=16000000L
|
esplora.build.f_cpu=16000000L
|
||||||
esplora.build.vid=0x2341
|
esplora.build.vid=0x2341
|
||||||
esplora.build.pid=0x803c
|
esplora.build.pid=0x803c
|
||||||
|
esplora.build.board=ARDUINO_ESPLORA
|
||||||
esplora.build.core=arduino
|
esplora.build.core=arduino
|
||||||
esplora.build.variant=leonardo
|
esplora.build.variant=leonardo
|
||||||
esplora.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
esplora.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
||||||
@ -244,6 +252,7 @@ mini.bootloader.unlock_bits=0x3F
|
|||||||
mini.bootloader.lock_bits=0x0F
|
mini.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
mini.build.f_cpu=16000000L
|
mini.build.f_cpu=16000000L
|
||||||
|
mini.build.board=ARDUINO_MINI
|
||||||
mini.build.core=arduino
|
mini.build.core=arduino
|
||||||
mini.build.variant=eightanaloginputs
|
mini.build.variant=eightanaloginputs
|
||||||
|
|
||||||
@ -291,6 +300,7 @@ ethernet.bootloader.lock_bits=0x0F
|
|||||||
ethernet.build.variant=standard
|
ethernet.build.variant=standard
|
||||||
ethernet.build.mcu=atmega328p
|
ethernet.build.mcu=atmega328p
|
||||||
ethernet.build.f_cpu=16000000L
|
ethernet.build.f_cpu=16000000L
|
||||||
|
ethernet.build.board=ARDUINO_ETHERNET
|
||||||
ethernet.build.core=arduino
|
ethernet.build.core=arduino
|
||||||
|
|
||||||
##############################################################
|
##############################################################
|
||||||
@ -312,6 +322,7 @@ fio.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
fio.build.mcu=atmega328p
|
fio.build.mcu=atmega328p
|
||||||
fio.build.f_cpu=8000000L
|
fio.build.f_cpu=8000000L
|
||||||
|
fio.build.board=ARDUINO_FIO
|
||||||
fio.build.core=arduino
|
fio.build.core=arduino
|
||||||
fio.build.variant=eightanaloginputs
|
fio.build.variant=eightanaloginputs
|
||||||
|
|
||||||
@ -330,6 +341,7 @@ bt.bootloader.unlock_bits=0x3F
|
|||||||
bt.bootloader.lock_bits=0x0F
|
bt.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
bt.build.f_cpu=16000000L
|
bt.build.f_cpu=16000000L
|
||||||
|
bt.build.board=ARDUINO_BT
|
||||||
bt.build.core=arduino
|
bt.build.core=arduino
|
||||||
bt.build.variant=eightanaloginputs
|
bt.build.variant=eightanaloginputs
|
||||||
|
|
||||||
@ -377,6 +389,7 @@ LilyPadUSB.build.mcu=atmega32u4
|
|||||||
LilyPadUSB.build.f_cpu=8000000L
|
LilyPadUSB.build.f_cpu=8000000L
|
||||||
LilyPadUSB.build.vid=0x1B4F
|
LilyPadUSB.build.vid=0x1B4F
|
||||||
LilyPadUSB.build.pid=0x9208
|
LilyPadUSB.build.pid=0x9208
|
||||||
|
LilyPadUSB.build.board=ARDUINO_LILYPAD_USB
|
||||||
LilyPadUSB.build.core=arduino
|
LilyPadUSB.build.core=arduino
|
||||||
LilyPadUSB.build.variant=leonardo
|
LilyPadUSB.build.variant=leonardo
|
||||||
LilyPadUSB.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
LilyPadUSB.build.extra_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid}
|
||||||
@ -393,6 +406,7 @@ lilypad.bootloader.unlock_bits=0x3F
|
|||||||
lilypad.bootloader.lock_bits=0x0F
|
lilypad.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
lilypad.build.f_cpu=8000000L
|
lilypad.build.f_cpu=8000000L
|
||||||
|
lilypad.build.board=ARDUINO_LILYPAD
|
||||||
lilypad.build.core=arduino
|
lilypad.build.core=arduino
|
||||||
lilypad.build.variant=standard
|
lilypad.build.variant=standard
|
||||||
|
|
||||||
@ -433,6 +447,7 @@ pro.bootloader.tool=avrdude
|
|||||||
pro.bootloader.unlock_bits=0x3F
|
pro.bootloader.unlock_bits=0x3F
|
||||||
pro.bootloader.lock_bits=0x0F
|
pro.bootloader.lock_bits=0x0F
|
||||||
|
|
||||||
|
pro.build.board=ARDUINO_PRO
|
||||||
pro.build.core=arduino
|
pro.build.core=arduino
|
||||||
pro.build.variant=standard
|
pro.build.variant=standard
|
||||||
|
|
||||||
@ -506,6 +521,7 @@ atmegang.bootloader.lock_bits=0x0F
|
|||||||
|
|
||||||
atmegang.build.mcu=atmegang
|
atmegang.build.mcu=atmegang
|
||||||
atmegang.build.f_cpu=16000000L
|
atmegang.build.f_cpu=16000000L
|
||||||
|
atmegang.build.board=ARDUINO_NG
|
||||||
atmegang.build.core=arduino
|
atmegang.build.core=arduino
|
||||||
atmegang.build.variant=standard
|
atmegang.build.variant=standard
|
||||||
|
|
||||||
|
@ -27,10 +27,10 @@ build.extra_flags=
|
|||||||
# --------------------
|
# --------------------
|
||||||
|
|
||||||
## Compile c files
|
## Compile c files
|
||||||
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
## Compile c++ files
|
## Compile c++ files
|
||||||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
## Create archives
|
## Create archives
|
||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
||||||
|
@ -8,6 +8,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false
|
|||||||
arduino_due_x_dbg.upload.native_usb=false
|
arduino_due_x_dbg.upload.native_usb=false
|
||||||
arduino_due_x_dbg.build.mcu=cortex-m3
|
arduino_due_x_dbg.build.mcu=cortex-m3
|
||||||
arduino_due_x_dbg.build.f_cpu=84000000L
|
arduino_due_x_dbg.build.f_cpu=84000000L
|
||||||
|
arduino_due_x_dbg.build.board=ARDUINO_DUE
|
||||||
arduino_due_x_dbg.build.core=arduino
|
arduino_due_x_dbg.build.core=arduino
|
||||||
arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
|
arduino_due_x_dbg.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
|
||||||
arduino_due_x_dbg.build.ldscript=linker_scripts/gcc/flash.ld
|
arduino_due_x_dbg.build.ldscript=linker_scripts/gcc/flash.ld
|
||||||
@ -25,6 +26,7 @@ arduino_due_x.upload.wait_for_upload_port=true
|
|||||||
arduino_due_x.upload.native_usb=true
|
arduino_due_x.upload.native_usb=true
|
||||||
arduino_due_x.build.mcu=cortex-m3
|
arduino_due_x.build.mcu=cortex-m3
|
||||||
arduino_due_x.build.f_cpu=84000000L
|
arduino_due_x.build.f_cpu=84000000L
|
||||||
|
arduino_due_x.build.board=ARDUINO_DUE
|
||||||
arduino_due_x.build.core=arduino
|
arduino_due_x.build.core=arduino
|
||||||
arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
|
arduino_due_x.build.extra_flags=-D__SAM3X8E__ -mthumb -DUSB_PID={build.pid} -DUSB_VID={build.vid} -DUSBCON
|
||||||
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld
|
arduino_due_x.build.ldscript=linker_scripts/gcc/flash.ld
|
||||||
|
@ -30,10 +30,10 @@ compiler.libsam.c.flags="-I{build.system.path}/libsam" "-I{build.system.path}/CM
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
|
|
||||||
## Compile c files
|
## Compile c files
|
||||||
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
recipe.c.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.c.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
## Compile c++ files
|
## Compile c++ files
|
||||||
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -mcpu={build.mcu} -DF_CPU={build.f_cpu} -D{software}={runtime.ide.version} -D{build.board} -DARDUINO_ARCH_{build.arch} {build.extra_flags} {compiler.libsam.c.flags} {includes} "{source_file}" -o "{object_file}"
|
||||||
|
|
||||||
## Create archives
|
## Create archives
|
||||||
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} "{build.path}/{archive_file}" "{object_file}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user