@@ -142,36 +142,49 @@ public String toString() {
142
142
* @param obj
143
143
* @return true if equal otherwise false
144
144
*/
145
- public boolean equals (BoardDescriptor obj ) {
146
- if (!this .getUploadPort ().equals (obj .getUploadPort ())) {
145
+ public boolean equals (BoardDescriptor otherBoardDescriptor ) {
146
+ if (!this .getUploadPort ().equals (otherBoardDescriptor .getUploadPort ())) {
147
147
return false ;
148
148
}
149
- if (!this .getProgrammer ().equals (obj .getProgrammer ())) {
149
+ if (!this .getProgrammer ().equals (otherBoardDescriptor .getProgrammer ())) {
150
150
return false ;
151
151
}
152
- if (!this .getBoardID ().equals (obj .getBoardID ())) {
153
- return false ;
154
- }
155
- if (!this .getReferencingBoardsFile ().equals (obj .getReferencingBoardsFile ())) {
156
- return false ;
152
+ return !needsSettingDirty (otherBoardDescriptor );
153
+ }
154
+
155
+ /**
156
+ * compare 2 board descriptors and return true if replacing one board descriptor
157
+ * with the other implies that a rebuild is needed
158
+ *
159
+ * @param otherBoardDescriptor
160
+ * @return
161
+ */
162
+ public boolean needsSettingDirty (BoardDescriptor otherBoardDescriptor ) {
163
+
164
+
165
+ if (!this .getBoardID ().equals (otherBoardDescriptor .getBoardID ())) {
166
+ return true ;
157
167
}
158
- if (!this .getOptions ().equals (obj . getOptions ())) {
159
- return false ;
168
+ if (!this .getReferencingBoardsFile ().equals (otherBoardDescriptor . getReferencingBoardsFile ())) {
169
+ return true ;
160
170
}
161
- if (!this .getProjectName ().equals (obj . getProjectName ())) {
162
- return false ;
171
+ if (!this .getOptions ().equals (otherBoardDescriptor . getOptions ())) {
172
+ return true ;
163
173
}
164
- if (!this .getMyOSName ().equals (obj . getMyOSName ())) {
165
- return false ;
174
+ if (!this .getProjectName ().equals (otherBoardDescriptor . getProjectName ())) {
175
+ return true ;
166
176
}
167
- if (!this .getMyWorkEclipseLocation ().equals (obj . getMyWorkEclipseLocation ())) {
168
- return false ;
177
+ if (!this .getMyOSName ().equals (otherBoardDescriptor . getMyOSName ())) {
178
+ return true ;
169
179
}
170
- if (!this .getMyWorkSpaceLocation ().equals (obj . getMyWorkSpaceLocation ())) {
171
- return false ;
180
+ if (!this .getMyWorkEclipseLocation ().equals (otherBoardDescriptor . getMyWorkEclipseLocation ())) {
181
+ return true ;
172
182
}
183
+ if (!this .getMyWorkSpaceLocation ().equals (otherBoardDescriptor .getMyWorkSpaceLocation ())) {
173
184
return true ;
174
185
}
186
+ return false ;
187
+ }
175
188
176
189
/*
177
190
* Create a sketchProject. This class does not really create a sketch object.
@@ -537,25 +550,34 @@ public IProject createProject(String projectName, URI projectURI,
537
550
}
538
551
539
552
public void save (ICConfigurationDescription confdesc ) throws Exception {
540
- saveConfiguration (confdesc , null );
553
+ boolean needsSettingDirty = saveConfiguration (confdesc , null );
554
+
541
555
if (confdesc != null ) {
542
556
IProject project = confdesc .getProjectDescription ().getProject ();
543
557
544
558
Helpers .setTheEnvironmentVariables (project , confdesc , (InternalBoardDescriptor ) this );
545
559
546
560
Helpers .addArduinoCodeToProject (this , project , confdesc );
547
561
548
- Helpers .removeInvalidIncludeFolders (confdesc );
549
- Helpers .setDirtyFlag (project , confdesc );
562
+ needsSettingDirty = needsSettingDirty || Helpers .removeInvalidIncludeFolders (confdesc );
563
+ if (needsSettingDirty ) {
564
+ Helpers .setDirtyFlag (project , confdesc );
565
+ } else {
566
+ Common .log (new Status (IStatus .INFO , io .sloeber .core .Activator .getId (),
567
+ "Ignoring update; clean may be required: " + project .getName ()));
568
+ }
550
569
}
551
570
}
552
571
553
572
public void saveConfiguration () {
554
573
saveConfiguration (null , null );
555
574
}
556
575
557
- public void saveConfiguration (ICConfigurationDescription confDesc , IContributedEnvironment contribEnvIn ) {
576
+ public boolean saveConfiguration (ICConfigurationDescription confDesc , IContributedEnvironment contribEnvIn ) {
577
+ boolean needsSettingDirty = false ;
558
578
if (confDesc != null ) {
579
+ BoardDescriptor curBoardDesCriptor = makeBoardDescriptor (confDesc );
580
+ needsSettingDirty = curBoardDesCriptor .needsSettingDirty (this );
559
581
IContributedEnvironment contribEnv = contribEnvIn ;
560
582
if (contribEnv == null ) {
561
583
IEnvironmentVariableManager envManager = CCorePlugin .getDefault ().getBuildEnvironmentManager ();
@@ -595,6 +617,7 @@ public void saveConfiguration(ICConfigurationDescription confDesc, IContributedE
595
617
myStorageNode .put (KEY_LAST_USED_UPLOAD_PORT , this .myUploadPort );
596
618
myStorageNode .put (KEY_LAST_USED_UPLOAD_PROTOCOL , this .myProgrammer );
597
619
myStorageNode .put (KEY_LAST_USED_BOARD_MENU_OPTIONS , KeyValue .makeString (this .myOptions ));
620
+ return needsSettingDirty ;
598
621
}
599
622
600
623
public String getPackage () {
0 commit comments