@@ -358,7 +358,11 @@ protected void size(PreferencesMap prefs) throws RunnerException {
358
358
* @throws RunnerException Only if there's a problem. Only then.
359
359
*/
360
360
public boolean compile (boolean _verbose , boolean _save ) throws RunnerException , PreferencesMapException {
361
- preprocess (prefs .get ("build.path" ));
361
+ File sketchBuildFolder = new File (prefs .get ("build.path" ), "sketch" );
362
+ if (!sketchBuildFolder .exists () && !sketchBuildFolder .mkdirs ()) {
363
+ throw new RunnerException ("Unable to create folder " + sketchBuildFolder );
364
+ }
365
+ preprocess (sketchBuildFolder .getAbsolutePath ());
362
366
363
367
verbose = _verbose || PreferencesData .getBoolean ("build.verbose" );
364
368
saveHex = _save ;
@@ -410,7 +414,7 @@ public boolean compile(boolean _verbose, boolean _save) throws RunnerException,
410
414
411
415
// 1. compile the sketch (already in the buildPath)
412
416
progressListener .progress (20 );
413
- compileSketch (includeFolders );
417
+ compileSketch (includeFolders , sketchBuildFolder );
414
418
sketchIsCompiled = true ;
415
419
416
420
runActions ("hooks.sketch.postbuild" , prefs );
@@ -485,6 +489,9 @@ public boolean compile(boolean _verbose, boolean _save) throws RunnerException,
485
489
}
486
490
487
491
private void adviseDuplicateLibraries () {
492
+ if (importedDuplicateHeaders == null ) {
493
+ return ;
494
+ }
488
495
for (int i =0 ; i < importedDuplicateHeaders .size (); i ++) {
489
496
System .out .println (I18n .format (_ ("Multiple libraries were found for \" {0}\" " ),
490
497
importedDuplicateHeaders .get (i )));
@@ -995,8 +1002,7 @@ static public List<File> findFilesInFolder(File folder, String extension,
995
1002
}
996
1003
997
1004
// 1. compile the sketch (already in the buildPath)
998
- void compileSketch (List <File > includeFolders ) throws RunnerException , PreferencesMapException {
999
- File buildPath = prefs .getFile ("build.path" );
1005
+ void compileSketch (List <File > includeFolders , File buildPath ) throws RunnerException , PreferencesMapException {
1000
1006
objectFiles .addAll (compileFiles (buildPath , buildPath , false , includeFolders ));
1001
1007
}
1002
1008
@@ -1011,7 +1017,12 @@ void compileLibraries(List<File> includeFolders) throws RunnerException, Prefere
1011
1017
private void compileLibrary (UserLibrary lib , List <File > includeFolders )
1012
1018
throws RunnerException , PreferencesMapException {
1013
1019
File libFolder = lib .getSrcFolder ();
1014
- File libBuildFolder = prefs .getFile (("build.path" ), lib .getName ());
1020
+ File librariesFolder = new File (prefs .getFile ("build.path" ), "libraries" );
1021
+ if (!librariesFolder .exists () && !librariesFolder .mkdirs ()) {
1022
+ throw new RunnerException ("Unable to create folder " + librariesFolder );
1023
+ }
1024
+
1025
+ File libBuildFolder = new File (librariesFolder , lib .getName ());
1015
1026
1016
1027
if (lib .useRecursion ()) {
1017
1028
// libBuildFolder == {build.path}/LibName
@@ -1058,7 +1069,10 @@ void compileCore()
1058
1069
1059
1070
File coreFolder = prefs .getFile ("build.core.path" );
1060
1071
File variantFolder = prefs .getFile ("build.variant.path" );
1061
- File buildFolder = prefs .getFile ("build.path" );
1072
+ File buildFolder = new File (prefs .getFile ("build.path" ), "core" );
1073
+ if (!buildFolder .exists () && !buildFolder .mkdirs ()) {
1074
+ throw new RunnerException ("Unable to create folder " + buildFolder );
1075
+ }
1062
1076
1063
1077
List <File > includeFolders = new ArrayList <File >();
1064
1078
includeFolders .add (coreFolder ); // include core path only
@@ -1108,6 +1122,7 @@ void compileCore()
1108
1122
dict .put ("ide_version" , "" + BaseNoGui .REVISION );
1109
1123
dict .put ("archive_file" , afile .getName ());
1110
1124
dict .put ("object_file" , file .getAbsolutePath ());
1125
+ dict .put ("build.path" , buildFolder .getAbsolutePath ());
1111
1126
1112
1127
String [] cmdArray ;
1113
1128
String cmd = prefs .getOrExcept ("recipe.ar.pattern" );
@@ -1144,7 +1159,7 @@ void compileLink()
1144
1159
PreferencesMap dict = new PreferencesMap (prefs );
1145
1160
String flags = dict .get ("compiler.c.elf.flags" ) + optRelax ;
1146
1161
dict .put ("compiler.c.elf.flags" , flags );
1147
- dict .put ("archive_file" , "core.a" );
1162
+ dict .put ("archive_file" , new File ( "core" , "core .a"). getPath () );
1148
1163
dict .put ("object_files" , objectFileList );
1149
1164
dict .put ("ide_version" , "" + BaseNoGui .REVISION );
1150
1165
0 commit comments