@@ -183,6 +183,9 @@ public Compiler(SketchData _sketch, String _buildPath, String _primaryClassName)
183183 sketch = _sketch ;
184184 prefs = createBuildPreferences (_buildPath , _primaryClassName );
185185
186+ // provide access to the source tree
187+ prefs .put ("build.source.path" , _sketch .getFolder ().getAbsolutePath ());
188+
186189 // Start with an empty progress listener
187190 progressListener = new ProgressListener () {
188191 @ Override
@@ -346,6 +349,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
346349
347350 verbose = _verbose || PreferencesData .getBoolean ("build.verbose" );
348351 sketchIsCompiled = false ;
352+
353+ // Hook runs at Start of Compilation
354+ runActions ("hooks.prebuild" , prefs );
355+
349356 objectFiles = new ArrayList <File >();
350357
351358 // 0. include paths for core + all libraries
@@ -413,6 +420,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
413420 }
414421
415422 progressListener .progress (90 );
423+
424+ // Hook runs at End of Compilation
425+ runActions ("hooks.postbuild" , prefs );
426+
416427 return true ;
417428 }
418429
@@ -1034,6 +1045,18 @@ void compileLink()
10341045 execAsynchronously (cmdArray );
10351046 }
10361047
1048+ void runActions (String recipeClass , PreferencesMap prefs ) throws RunnerException , PreferencesMapException {
1049+ List <String > patterns = new ArrayList <String >();
1050+ for (String key : prefs .keySet ()) {
1051+ if (key .startsWith ("recipe." +recipeClass ) && key .endsWith (".pattern" ))
1052+ patterns .add (key );
1053+ }
1054+ Collections .sort (patterns );
1055+ for (String recipe : patterns ) {
1056+ runRecipe (recipe );
1057+ }
1058+ }
1059+
10371060 void runRecipe (String recipe ) throws RunnerException , PreferencesMapException {
10381061 PreferencesMap dict = new PreferencesMap (prefs );
10391062 dict .put ("ide_version" , "" + BaseNoGui .REVISION );
0 commit comments