1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-17 22:23:10 +03:00

Library class, round 2

This commit is contained in:
Cristian Maglie
2013-02-13 19:10:30 +01:00
parent 7aeb972e14
commit bddb47ed26
2 changed files with 122 additions and 26 deletions

View File

@ -57,7 +57,8 @@ public class Compiler implements MessageConsumer {
private PreferencesMap prefs;
private boolean verbose;
private boolean sketchIsCompiled;
private String targetArch;
private RunnerException exception;
/**
@ -86,7 +87,8 @@ public class Compiler implements MessageConsumer {
if (prefs.get("build.variant.path").length() != 0)
includePaths.add(prefs.get("build.variant.path"));
for (Library lib : sketch.getImportedLibraries())
includePaths.add(lib.getSrcFolder().getPath());
for (File folder : lib.getSrcFolders(targetArch))
includePaths.add(folder.getPath());
// 1. compile the sketch (already in the buildPath)
sketch.setCompilingProgress(30);
@ -131,7 +133,7 @@ public class Compiler implements MessageConsumer {
}
TargetPlatform targetPlatform = Base.getTargetPlatform();
// Merge all the global preference configuration in order of priority
PreferencesMap p = new PreferencesMap();
p.putAll(Preferences.getMap());
@ -144,7 +146,8 @@ public class Compiler implements MessageConsumer {
p.put("build.path", _buildPath);
p.put("build.project_name", _primaryClassName);
p.put("build.arch", targetPlatform.getName().toUpperCase());
targetArch = targetPlatform.getName();
p.put("build.arch", targetArch.toUpperCase());
if (!p.containsKey("compiler.path"))
p.put("compiler.path", Base.getAvrBasePath());
@ -583,11 +586,12 @@ public class Compiler implements MessageConsumer {
void compileLibraries(List<String> includePaths) throws RunnerException {
File outputPath = new File(prefs.get("build.path"));
for (Library lib : sketch.getImportedLibraries()) {
File libFolder = lib.getSrcFolder();
if (lib.isPre15Lib()) {
compileLibrary(outputPath, libFolder, includePaths);
} else {
recursiveCompileLibrary(outputPath, libFolder, includePaths);
for (File folder : lib.getSrcFolders(targetArch)) {
if (lib.isPre15Lib()) {
compileLibrary(outputPath, folder, includePaths);
} else {
recursiveCompileLibrary(outputPath, folder, includePaths);
}
}
}
}