mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-20 14:54:31 +01:00
Convert to action pattern to allow multiple actions
This commit is contained in:
parent
2f65f5fdc1
commit
0644bdc51c
@ -351,8 +351,7 @@ public class Compiler implements MessageConsumer {
|
||||
sketchIsCompiled = false;
|
||||
|
||||
// Hook runs at Start of Compilation
|
||||
if (prefs.containsKey("recipe.hooks.prebuild"))
|
||||
runRecipe("recipe.hooks.prebuild");
|
||||
runActions("hooks.prebuild", prefs);
|
||||
|
||||
objectFiles = new ArrayList<File>();
|
||||
|
||||
@ -422,9 +421,8 @@ public class Compiler implements MessageConsumer {
|
||||
|
||||
progressListener.progress(90);
|
||||
|
||||
// Hook runs at End of Compilation
|
||||
if (prefs.containsKey("recipe.hooks.postbuild"))
|
||||
runRecipe("recipe.hooks.postbuild");
|
||||
// Hook runs at End of Compilation
|
||||
runActions("hooks.postbuild", prefs);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1047,6 +1045,18 @@ public class Compiler implements MessageConsumer {
|
||||
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 {
|
||||
PreferencesMap dict = new PreferencesMap(prefs);
|
||||
dict.put("ide_version", "" + BaseNoGui.REVISION);
|
||||
|
Loading…
x
Reference in New Issue
Block a user