mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Now rebuilding libraries when switching microcontrollers. Thanks Nick.
This commit is contained in:
parent
58bed2dc5d
commit
6fa233b9ee
@ -819,6 +819,16 @@ public class Editor extends JFrame
|
||||
burnBootloaderItem.setEnabled(bootloadingEnabled);
|
||||
if (burnBootloaderParallelItem != null)
|
||||
burnBootloaderParallelItem.setEnabled(bootloadingEnabled);
|
||||
|
||||
try {
|
||||
LibraryManager libraryManager = new LibraryManager();
|
||||
libraryManager.rebuildAllBuilt();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (RunnerException e) {
|
||||
message("Error rebuilding libraries...");
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
LibraryManager.java - Library System for Wiring
|
||||
Copyright (c) 2006 Nicholas Zambetti. All right reserved.
|
||||
Copyright (c) 2006-07 Nicholas Zambetti. All right reserved.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
@ -119,6 +119,33 @@ public class LibraryManager {
|
||||
}
|
||||
return Collections.unmodifiableList(buildableLibraries);
|
||||
}
|
||||
|
||||
/*
|
||||
* Rebuilds built libraries
|
||||
* @return Number of libraries built as int, -1 & exception on error
|
||||
*/
|
||||
public int rebuildAllBuilt() throws RunnerException {
|
||||
Collection builtLibraries = getBuiltLibraries();
|
||||
Library library;
|
||||
Iterator libIterator = builtLibraries.iterator();
|
||||
int countBuilt = 0;
|
||||
while(libIterator.hasNext()){
|
||||
library = (Library)libIterator.next();
|
||||
//System.out.println("Building library \"" + library.getName() + "\"");
|
||||
try {
|
||||
if(library.build()){
|
||||
++countBuilt;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
}catch (RunnerException re) {
|
||||
throw new RunnerException(re.getMessage());
|
||||
} catch (Exception ex) {
|
||||
throw new RunnerException(ex.toString());
|
||||
}
|
||||
}
|
||||
return countBuilt;
|
||||
}
|
||||
|
||||
/*
|
||||
* Gathers paths to object files
|
||||
|
Loading…
Reference in New Issue
Block a user