mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Merge pull request #2738 from Wackerbarth/Issue_2732
Pre- & Post- Build Hooks
This commit is contained in:
commit
5468a91dfd
@ -183,6 +183,9 @@ public class Compiler implements MessageConsumer {
|
|||||||
sketch = _sketch;
|
sketch = _sketch;
|
||||||
prefs = createBuildPreferences(_buildPath, _primaryClassName);
|
prefs = createBuildPreferences(_buildPath, _primaryClassName);
|
||||||
|
|
||||||
|
// provide access to the source tree
|
||||||
|
prefs.put("build.source.path", _sketch.getFolder().getAbsolutePath());
|
||||||
|
|
||||||
// Start with an empty progress listener
|
// Start with an empty progress listener
|
||||||
progressListener = new ProgressListener() {
|
progressListener = new ProgressListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -346,6 +349,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
|
|
||||||
verbose = _verbose || PreferencesData.getBoolean("build.verbose");
|
verbose = _verbose || PreferencesData.getBoolean("build.verbose");
|
||||||
sketchIsCompiled = false;
|
sketchIsCompiled = false;
|
||||||
|
|
||||||
|
// Hook runs at Start of Compilation
|
||||||
|
runActions("hooks.prebuild", prefs);
|
||||||
|
|
||||||
objectFiles = new ArrayList<File>();
|
objectFiles = new ArrayList<File>();
|
||||||
|
|
||||||
// 0. include paths for core + all libraries
|
// 0. include paths for core + all libraries
|
||||||
@ -413,6 +420,10 @@ public class Compiler implements MessageConsumer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
progressListener.progress(90);
|
progressListener.progress(90);
|
||||||
|
|
||||||
|
// Hook runs at End of Compilation
|
||||||
|
runActions("hooks.postbuild", prefs);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1034,6 +1045,18 @@ public class Compiler implements MessageConsumer {
|
|||||||
execAsynchronously(cmdArray);
|
execAsynchronously(cmdArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void runActions(String recipeClass, PreferencesMap prefs) throws RunnerException, PreferencesMapException {
|
||||||
|
List<String> patterns = new ArrayList<String>();
|
||||||
|
for (String key : prefs.keySet()) {
|
||||||
|
if (key.startsWith("recipe."+recipeClass) && key.endsWith(".pattern"))
|
||||||
|
patterns.add(key);
|
||||||
|
}
|
||||||
|
Collections.sort(patterns);
|
||||||
|
for (String recipe : patterns) {
|
||||||
|
runRecipe(recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void runRecipe(String recipe) throws RunnerException, PreferencesMapException {
|
void runRecipe(String recipe) throws RunnerException, PreferencesMapException {
|
||||||
PreferencesMap dict = new PreferencesMap(prefs);
|
PreferencesMap dict = new PreferencesMap(prefs);
|
||||||
dict.put("ide_version", "" + BaseNoGui.REVISION);
|
dict.put("ide_version", "" + BaseNoGui.REVISION);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user