mirror of https://github.com/noisymime/Arduino.git
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;
|
sketchIsCompiled = false;
|
||||||
|
|
||||||
// Hook runs at Start of Compilation
|
// Hook runs at Start of Compilation
|
||||||
if (prefs.containsKey("recipe.hooks.prebuild"))
|
runActions("hooks.prebuild", prefs);
|
||||||
runRecipe("recipe.hooks.prebuild");
|
|
||||||
|
|
||||||
objectFiles = new ArrayList<File>();
|
objectFiles = new ArrayList<File>();
|
||||||
|
|
||||||
|
@ -422,9 +421,8 @@ public class Compiler implements MessageConsumer {
|
||||||
|
|
||||||
progressListener.progress(90);
|
progressListener.progress(90);
|
||||||
|
|
||||||
// Hook runs at End of Compilation
|
// Hook runs at End of Compilation
|
||||||
if (prefs.containsKey("recipe.hooks.postbuild"))
|
runActions("hooks.postbuild", prefs);
|
||||||
runRecipe("recipe.hooks.postbuild");
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1047,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…
Reference in New Issue