@@ -106,7 +106,7 @@ public void issue555() {
106
106
}
107
107
SloeberProject arduinoProject = SloeberProject .getSloeberProject (theTestProject , false );
108
108
ICProjectDescription cProjectDescription = CCorePlugin .getDefault ().getProjectDescription (theTestProject );
109
- arduinoProject .setBoardDescription (cProjectDescription .getActiveConfiguration (), teensyBoardid , true );
109
+ arduinoProject .setBoardDescription (cProjectDescription .getActiveConfiguration (). getName () , teensyBoardid , true );
110
110
111
111
Shared .waitForAllJobsToFinish ();
112
112
try {
@@ -328,6 +328,42 @@ public void are_defines_before_includes_taken_into_account() throws Exception {
328
328
329
329
}
330
330
331
+ /**
332
+ * Does Sloeber still compile after a configuration renamen
333
+ *
334
+ * @throws Exception
335
+ */
336
+ @ Test
337
+ public void rename_Configuration () throws Exception {
338
+ BoardDescription unoBoardid = Arduino .uno ().getBoardDescriptor ();
339
+
340
+ IProject theTestProject = null ;
341
+ String projectName = "rename_Configuration" ;
342
+
343
+ CodeDescription codeDescriptor = CodeDescription .createDefaultIno ();
344
+
345
+ NullProgressMonitor monitor = new NullProgressMonitor ();
346
+ theTestProject = SloeberProject .createArduinoProject (projectName , null , unoBoardid , codeDescriptor ,
347
+ new CompileDescription (), new NullProgressMonitor ());
348
+
349
+ Shared .waitForAllJobsToFinish (); // for the indexer
350
+ theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
351
+ if (Shared .hasBuildErrors (theTestProject )) {
352
+ fail ("Failed to compile the project before config rename" );
353
+ }
354
+
355
+ CCorePlugin cCorePlugin = CCorePlugin .getDefault ();
356
+ ICProjectDescription prjCDesc = cCorePlugin .getProjectDescription (theTestProject );
357
+ ICConfigurationDescription activeConfig = prjCDesc .getActiveConfiguration ();
358
+ activeConfig .setName ("renamedConfig" );
359
+ cCorePlugin .setProjectDescription (theTestProject , prjCDesc );
360
+
361
+ Shared .waitForAllJobsToFinish (); // for the indexer
362
+ theTestProject .build (IncrementalProjectBuilder .FULL_BUILD , monitor );
363
+ if (Shared .hasBuildErrors (theTestProject )) {
364
+ fail ("Failed to compile the project after config rename" );
365
+ }
366
+ }
331
367
/**
332
368
* open and close a project should keep the compileDescription and
333
369
* BoardDescriotion
@@ -351,8 +387,8 @@ public void openAndClosePreservesSettings() throws Exception {
351
387
SloeberProject sloeberDesc = SloeberProject .getSloeberProject (theTestProject , false );
352
388
ICProjectDescription projDesc = CoreModel .getDefault ().getProjectDescription (theTestProject );
353
389
ICConfigurationDescription confDesc = projDesc .getActiveConfiguration ();
354
- BoardDescription createdBoardDesc = sloeberDesc .getBoardDescription (confDesc , false );
355
- CompileDescription createdCompileDesc = sloeberDesc .getCompileDescription (confDesc , false );
390
+ BoardDescription createdBoardDesc = sloeberDesc .getBoardDescription (confDesc . getName () , false );
391
+ CompileDescription createdCompileDesc = sloeberDesc .getCompileDescription (confDesc . getName () , false );
356
392
357
393
// close and reopen the project
358
394
theTestProject .close (null );
@@ -366,8 +402,8 @@ public void openAndClosePreservesSettings() throws Exception {
366
402
sloeberDesc = SloeberProject .getSloeberProject (theTestProject , false );
367
403
projDesc = CoreModel .getDefault ().getProjectDescription (theTestProject );
368
404
confDesc = projDesc .getActiveConfiguration ();
369
- BoardDescription reopenedBoardDesc = sloeberDesc .getBoardDescription (confDesc , false );
370
- CompileDescription reopenedCompileDesc = sloeberDesc .getCompileDescription (confDesc , false );
405
+ BoardDescription reopenedBoardDesc = sloeberDesc .getBoardDescription (confDesc . getName () , false );
406
+ CompileDescription reopenedCompileDesc = sloeberDesc .getCompileDescription (confDesc . getName () , false );
371
407
372
408
// check the data is equal
373
409
boolean createBoardsDiff = !unoBoardid .equals (createdBoardDesc );
@@ -451,14 +487,16 @@ public void openAndCloseUsesSavedSettings() throws Exception {
451
487
SloeberProject proj1SloeberDesc = SloeberProject .getSloeberProject (proj1 , false );
452
488
ICProjectDescription proj1Desc = CoreModel .getDefault ().getProjectDescription (proj1 );
453
489
ICConfigurationDescription proj1ConfDesc = proj1Desc .getActiveConfiguration ();
454
- BoardDescription proj1CreatedBoardDesc = proj1SloeberDesc .getBoardDescription (proj1ConfDesc , false );
455
- CompileDescription proj1CreatedCompileDesc = proj1SloeberDesc .getCompileDescription (proj1ConfDesc , false );
490
+ BoardDescription proj1CreatedBoardDesc = proj1SloeberDesc .getBoardDescription (proj1ConfDesc .getName (), false );
491
+ CompileDescription proj1CreatedCompileDesc = proj1SloeberDesc .getCompileDescription (proj1ConfDesc .getName (),
492
+ false );
456
493
457
494
SloeberProject proj2SloeberDesc = SloeberProject .getSloeberProject (proj2 , false );
458
495
ICProjectDescription proj2Desc = CoreModel .getDefault ().getProjectDescription (proj2 );
459
496
ICConfigurationDescription proj2ConfDesc = proj2Desc .getActiveConfiguration ();
460
- BoardDescription proj2CreatedBoardDesc = proj2SloeberDesc .getBoardDescription (proj2ConfDesc , false );
461
- CompileDescription proj2CreatedCompileDesc = proj2SloeberDesc .getCompileDescription (proj2ConfDesc , false );
497
+ BoardDescription proj2CreatedBoardDesc = proj2SloeberDesc .getBoardDescription (proj2ConfDesc .getName (), false );
498
+ CompileDescription proj2CreatedCompileDesc = proj2SloeberDesc .getCompileDescription (proj2ConfDesc .getName (),
499
+ false );
462
500
463
501
// get the filenames to copy
464
502
IFile file = proj1 .getFile ("sloeber.cfg" ); //$NON-NLS-1$
@@ -485,8 +523,9 @@ public void openAndCloseUsesSavedSettings() throws Exception {
485
523
proj2SloeberDesc = SloeberProject .getSloeberProject (proj2 , false );
486
524
proj2Desc = CoreModel .getDefault ().getProjectDescription (proj2 );
487
525
proj2ConfDesc = proj2Desc .getActiveConfiguration ();
488
- BoardDescription proj2OpenedBoardDesc = proj2SloeberDesc .getBoardDescription (proj2ConfDesc , false );
489
- CompileDescription proj2OpenedCompileDesc = proj2SloeberDesc .getCompileDescription (proj2ConfDesc , false );
526
+ BoardDescription proj2OpenedBoardDesc = proj2SloeberDesc .getBoardDescription (proj2ConfDesc .getName (), false );
527
+ CompileDescription proj2OpenedCompileDesc = proj2SloeberDesc .getCompileDescription (proj2ConfDesc .getName (),
528
+ false );
490
529
491
530
// check the setup was done correctly
492
531
if (!proj1BoardDesc .equals (proj1CreatedBoardDesc )) {
0 commit comments