@@ -183,6 +183,9 @@ public Compiler(SketchData _sketch, String _buildPath, String _primaryClassName)
183
183
sketch = _sketch ;
184
184
prefs = createBuildPreferences (_buildPath , _primaryClassName );
185
185
186
+ // provide access to the source tree
187
+ prefs .put ("build.source.path" , _sketch .getFolder ().getAbsolutePath ());
188
+
186
189
// Start with an empty progress listener
187
190
progressListener = new ProgressListener () {
188
191
@ Override
@@ -346,6 +349,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
346
349
347
350
verbose = _verbose || PreferencesData .getBoolean ("build.verbose" );
348
351
sketchIsCompiled = false ;
352
+
353
+ // Hook runs at Start of Compilation
354
+ runActions ("hooks.prebuild" , prefs );
355
+
349
356
objectFiles = new ArrayList <File >();
350
357
351
358
// 0. include paths for core + all libraries
@@ -413,6 +420,10 @@ public boolean compile(boolean _verbose) throws RunnerException, PreferencesMapE
413
420
}
414
421
415
422
progressListener .progress (90 );
423
+
424
+ // Hook runs at End of Compilation
425
+ runActions ("hooks.postbuild" , prefs );
426
+
416
427
return true ;
417
428
}
418
429
@@ -1034,6 +1045,18 @@ void compileLink()
1034
1045
execAsynchronously (cmdArray );
1035
1046
}
1036
1047
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
+
1037
1060
void runRecipe (String recipe ) throws RunnerException , PreferencesMapException {
1038
1061
PreferencesMap dict = new PreferencesMap (prefs );
1039
1062
dict .put ("ide_version" , "" + BaseNoGui .REVISION );
0 commit comments