Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions arduino-core/src/processing/app/debug/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ public Compiler(SketchData _sketch, String _buildPath, String _primaryClassName)
sketch = _sketch;
prefs = createBuildPreferences(_buildPath, _primaryClassName);

// provide access to the source tree
prefs.put("build.source.path", _sketch.getFolder().getAbsolutePath());

// Start with an empty progress listener
progressListener = new ProgressListener() {
@Override
Expand Down Expand Up @@ -346,6 +349,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE

verbose = _verbose || PreferencesData.getBoolean("build.verbose");
sketchIsCompiled = false;

// Hook runs at Start of Compilation
runActions("hooks.prebuild", prefs);

objectFiles = new ArrayList<File>();

// 0. include paths for core + all libraries
Expand Down Expand Up @@ -413,6 +420,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
}

progressListener.progress(90);

// Hook runs at End of Compilation
runActions("hooks.postbuild", prefs);

return true;
}

Expand Down Expand Up @@ -1034,6 +1045,18 @@ void compileLink()
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);
Expand Down