1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-01-30 19:52:13 +01:00

Merge remote-tracking branch 'ide-1.5.x-core.a-rebuild' into ide-1.5.x

This commit is contained in:
Cristian Maglie 2014-11-02 11:20:37 +01:00
commit b4f2af4f9d
2 changed files with 55 additions and 18 deletions

View File

@ -718,13 +718,48 @@ public class Compiler implements MessageConsumer {
if (variantFolder != null) if (variantFolder != null)
includeFolders.add(variantFolder); includeFolders.add(variantFolder);
if (variantFolder != null)
objectFiles.addAll(compileFiles(buildFolder, variantFolder, true,
includeFolders));
File afile = new File(buildFolder, "core.a");
List<File> coreObjectFiles = compileFiles(buildFolder, coreFolder, true, List<File> coreObjectFiles = compileFiles(buildFolder, coreFolder, true,
includeFolders); includeFolders);
// See if the .a file is already uptodate
if (afile.exists()) {
boolean changed = false;
for (File file : coreObjectFiles) {
if (file.lastModified() > afile.lastModified()) {
changed = true;
break;
}
}
// If none of the object files is newer than the .a file, don't
// bother rebuilding the .a file. There is a small corner case
// here: If a source file was removed, but no other source file
// was modified, this will not rebuild core.a even when it
// should. It's hard to fix and not a realistic case, so it
// shouldn't be a problem.
if (!changed) {
if (verbose)
System.out.println(I18n.format(_("Using previously compiled file: {0}"), afile.getPath()));
return;
}
}
// Delete the .a file, to prevent any previous code from lingering
afile.delete();
try {
for (File file : coreObjectFiles) { for (File file : coreObjectFiles) {
PreferencesMap dict = new PreferencesMap(prefs); PreferencesMap dict = new PreferencesMap(prefs);
dict.put("ide_version", "" + Base.REVISION); dict.put("ide_version", "" + Base.REVISION);
dict.put("archive_file", "core.a"); dict.put("archive_file", afile.getName());
dict.put("object_file", file.getAbsolutePath()); dict.put("object_file", file.getAbsolutePath());
String[] cmdArray; String[] cmdArray;
@ -736,10 +771,10 @@ public class Compiler implements MessageConsumer {
} }
execAsynchronously(cmdArray); execAsynchronously(cmdArray);
} }
} catch (RunnerException e) {
if (variantFolder != null) afile.delete();
objectFiles.addAll(compileFiles(buildFolder, variantFolder, true, throw e;
includeFolders)); }
} }
// 4. link it all together into the .elf file // 4. link it all together into the .elf file

View File

@ -2,6 +2,8 @@
ARDUINO 1.5.9 ARDUINO 1.5.9
[ide] [ide]
* Sketch build process: fixed full rebuild on windows even if not needed
* Sketch build process: core.a rebuild only if needed (Matthijs Kooijman)
* Updated AStyle formatter to v2.04: http://astyle.sourceforge.net/notes.html * Updated AStyle formatter to v2.04: http://astyle.sourceforge.net/notes.html
[core] [core]