@@ -95,7 +95,7 @@ public static void installAdditionalBoards() throws Exception {
95
95
* @throws CoreException
96
96
*/
97
97
@ Test
98
- public void issue555 () throws CoreException {
98
+ public void issue555 () throws Exception {
99
99
BoardDescription unoBoardid = Arduino .uno ().getBoardDescriptor ();
100
100
BoardDescription teensyBoardid = Teensy .Teensy3_1 ().getBoardDescriptor ();
101
101
@@ -105,7 +105,7 @@ public void issue555() throws CoreException {
105
105
NullProgressMonitor monitor = new NullProgressMonitor ();
106
106
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
107
107
new CompileDescription (), monitor );
108
-
108
+ Shared . waitForIndexer ( theTestProject );
109
109
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
110
110
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
111
111
@@ -142,6 +142,7 @@ public void issue687() throws Exception {
142
142
CodeDescription codeDescriptor = CodeDescription .createCustomTemplate (templateFolder );
143
143
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
144
144
new CompileDescription (), new NullProgressMonitor ());
145
+ Shared .waitForIndexer (theTestProject );
145
146
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , new NullProgressMonitor ());
146
147
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
147
148
}
@@ -156,6 +157,7 @@ public void create_CPP_based_Sloeber_Project() throws Exception {
156
157
CodeDescription codeDescriptor = CodeDescription .createDefaultCPP ();
157
158
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
158
159
new CompileDescription (), new NullProgressMonitor ());
160
+ Shared .waitForIndexer (theTestProject );
159
161
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , new NullProgressMonitor ());
160
162
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
161
163
@@ -171,6 +173,7 @@ public void createDefaultInoProject() throws Exception {
171
173
CodeDescription codeDescriptor = CodeDescription .createDefaultIno ();
172
174
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
173
175
new CompileDescription (), new NullProgressMonitor ());
176
+ Shared .waitForIndexer (theTestProject );
174
177
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , new NullProgressMonitor ());
175
178
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
176
179
}
@@ -218,6 +221,7 @@ public void are_jantjes_options_taken_into_account() throws Exception {
218
221
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
219
222
compileOptions , new NullProgressMonitor ());
220
223
224
+ Shared .waitForIndexer (theTestProject );
221
225
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
222
226
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
223
227
}
@@ -241,6 +245,7 @@ public void is_extern_C_taken_into_account() throws Exception {
241
245
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
242
246
new CompileDescription (), new NullProgressMonitor ());
243
247
248
+ Shared .waitForIndexer (theTestProject );
244
249
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
245
250
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
246
251
}
@@ -264,6 +269,7 @@ public void are_defines_before_includes_taken_into_account() throws Exception {
264
269
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
265
270
new CompileDescription (), new NullProgressMonitor ());
266
271
272
+ Shared .waitForIndexer (theTestProject );
267
273
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
268
274
Assert .assertNull (Shared .hasBuildErrors (theTestProject ));
269
275
@@ -287,6 +293,7 @@ public void rename_Configuration() throws Exception {
287
293
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
288
294
new CompileDescription (), new NullProgressMonitor ());
289
295
296
+ Shared .waitForIndexer (theTestProject );
290
297
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
291
298
Assert .assertNull ("Failed to compile the project before config rename" , Shared .hasBuildErrors (theTestProject ));
292
299
@@ -360,6 +367,7 @@ public void openAndClosePreservesSettings(String projectName, CodeDescription co
360
367
theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
361
368
inCompileDescription , new NullProgressMonitor ());
362
369
370
+ Shared .waitForIndexer (theTestProject );
363
371
// also do a build
364
372
theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , null );
365
373
Assert .assertNull ("Failed to compile the project before close: " + projectName ,
@@ -378,6 +386,7 @@ public void openAndClosePreservesSettings(String projectName, CodeDescription co
378
386
// just wait a while
379
387
Thread .sleep (1000 );
380
388
theTestProject .open (null );
389
+ Shared .waitForIndexer (theTestProject );
381
390
382
391
// read the data we want to test
383
392
sloeberConf = ISloeberConfiguration .getActiveConfig (theTestProject );
@@ -458,7 +467,7 @@ public void openModAndCloseUsesSavedSettings() throws Exception {
458
467
459
468
// reopen the project
460
469
proj2 .open (null );
461
- Thread . sleep ( 1000 );
470
+ Shared . waitForIndexer ( proj2 );
462
471
463
472
// reread project 2
464
473
ISloeberConfiguration sloebercfg2 = ISloeberConfiguration .getActiveConfig (proj2 );
@@ -505,14 +514,15 @@ public void createProjectWithURI() throws Exception {
505
514
IPath projectFolder = workspace .getRoot ().getLocation ().removeLastSegments (1 ).append (codeFolderName );
506
515
URI uri = projectFolder .toFile ().toURI ();
507
516
// workspace.getRoot().getFolder(Path.fromOSString(codeFolderName)).getLocationURI();
508
- IProject proj = SloeberProject .createArduinoProject (proj1Name , uri , proj1BoardDesc , codeDesc , proj1CompileDesc ,
517
+ IProject theTestProject = SloeberProject .createArduinoProject (proj1Name , uri , proj1BoardDesc , codeDesc , proj1CompileDesc ,
509
518
otherDesc , new NullProgressMonitor ());
510
519
511
- proj .build (IncrementalProjectBuilder .FULL_BUILD , null );
512
- Assert .assertNull ("Failed to compile the project: " + Shared .hasBuildErrors (proj ), Shared .hasBuildErrors (proj ));
520
+ Shared .waitForIndexer (theTestProject );
521
+ theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , null );
522
+ Assert .assertNull ("Failed to compile the project: " + Shared .hasBuildErrors (theTestProject ), Shared .hasBuildErrors (theTestProject ));
513
523
String fileLocation = projectFolder .append ("src" ).append (proj1Name + ".cpp" ).toString ();
514
524
515
- IFile cppFile = proj .getFolder ("src" ).getFile (proj1Name + ".cpp" );
525
+ IFile cppFile = theTestProject .getFolder ("src" ).getFile (proj1Name + ".cpp" );
516
526
Assert .assertTrue ("File not in correct location" , cppFile .exists ());
517
527
Assert .assertEquals ("File not in correct location" , cppFile .getLocation ().toString (), fileLocation );
518
528
@@ -586,21 +596,23 @@ public static Stream<Arguments> testDifferentSourceFoldersData() throws Exceptio
586
596
@ ParameterizedTest
587
597
@ MethodSource ("testDifferentSourceFoldersData" )
588
598
public void testDifferentSourceFolders (String projectName , CodeDescription codeDescriptor , MCUBoard board ,
589
- OtherDescription otherDesc , CompileDescription proj1CompileDesc ) throws CoreException {
599
+ OtherDescription otherDesc , CompileDescription proj1CompileDesc ) throws Exception {
590
600
591
601
BoardDescription proj1BoardDesc = board .getBoardDescriptor ();
592
- IProject project = SloeberProject .createArduinoProject (projectName , null , proj1BoardDesc , codeDescriptor ,
602
+ IProject theTestProject = SloeberProject .createArduinoProject (projectName , null , proj1BoardDesc , codeDescriptor ,
593
603
proj1CompileDesc , otherDesc , new NullProgressMonitor ());
594
604
595
- project .build (IncrementalProjectBuilder .FULL_BUILD , null );
596
- assertNull ("Failed to compile " + projectName , Shared .hasBuildErrors (project ));
605
+
606
+ Shared .waitForIndexer (theTestProject );
607
+ theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , null );
608
+ assertNull ("Failed to compile " + projectName , Shared .hasBuildErrors (theTestProject ));
597
609
598
610
String srcFolder = codeDescriptor .getCodeFolder ();
599
611
IFile cppFile = null ;
600
612
if (srcFolder == null ) {
601
- cppFile = project .getFile (projectName + ".cpp" );
613
+ cppFile = theTestProject .getFile (projectName + ".cpp" );
602
614
} else {
603
- cppFile = project .getFolder (srcFolder ).getFile (projectName + ".cpp" );
615
+ cppFile = theTestProject .getFolder (srcFolder ).getFile (projectName + ".cpp" );
604
616
}
605
617
assertTrue ("Source File not in right location " + projectName , cppFile .exists ());
606
618
}
0 commit comments