Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Final Fix for bug 44020

Sorry Doug,
Simple problem, once I figured it out. Details in the change log. 

Hope I'm not too late.

Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/ChangeLog,v
retrieving revision 1.12
diff -u -r1.12 ChangeLog
--- ChangeLog	1 Oct 2003 23:56:36 -0000	1.12
+++ ChangeLog	2 Oct 2003 02:02:15 -0000
@@ -1,4 +1,19 @@
 2003-10-01 Sean Evoy
+	Final fix for bugs 44020.
+	The problem lay with the way that new projects were being created when the 
+	root configuration of the project had tool references overriding options. 
+	What the new configuration should have been doing is making a personal copy 
+	of the tool reference and its options. Instead, they were all sharing the 
+	parents. Seems simple enough now that I found it.
+	 
+	OptionReference provides a method to retreive its option (so new 
+	OptionReferences can be cloned).
+	* src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+	
+	Configuration now behaves correctly when it is created from another configuration.
+	* src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+
+2003-10-01 Sean Evoy
 	Fix for bugs 43490 (trivial), 44020, and 43980.
 	Added a new field to the schema for a tool. The attribute manages a list of 
 	project natures that the tool should be filtered against in the build model 
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java,v
retrieving revision 1.4
diff -u -r1.4 Configuration.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java	1 Oct 2003 23:56:36 -0000	1.4
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java	2 Oct 2003 02:02:15 -0000
@@ -66,8 +66,54 @@
 		this.target = target;
 		this.parent = parent;
 		
+		// Check that the tool and the project match
+		IProject project = (IProject) target.getOwner();
+		
 		// Get the tool references from the parent
-		getLocalToolReferences().addAll(((Configuration)parent).getLocalToolReferences());
+		List parentToolRefs = ((Configuration)parent).getLocalToolReferences();
+		Iterator iter = parentToolRefs.listIterator();
+		while (iter.hasNext()) {
+			ToolReference toolRef = (ToolReference)iter.next();
+
+			// Make a new ToolReference based on the tool in the ref
+			ToolReference newRef = new ToolReference(this, toolRef.getTool());
+			List optRefs = toolRef.getLocalOptionRefs();
+			Iterator optIter = optRefs.listIterator();
+			while (optIter.hasNext()) {
+				OptionReference optRef = (OptionReference)optIter.next();
+				IOption opt = optRef.getOption();
+				try {
+					switch (opt.getValueType()) {
+						case IOption.BOOLEAN:
+							new OptionReference(newRef, opt).setValue(optRef.getBooleanValue());
+							break;
+						case IOption.STRING:
+							new OptionReference(newRef, opt).setValue(optRef.getStringValue());
+							break;
+						case IOption.ENUMERATED:
+							new OptionReference(newRef, opt).setValue(optRef.getSelectedEnum());
+							break;
+						case IOption.STRING_LIST :
+							new OptionReference(newRef, opt).setValue(optRef.getStringListValue());
+							break;
+						case IOption.INCLUDE_PATH :
+							new OptionReference(newRef, opt).setValue(optRef.getIncludePaths());
+							break;
+						case IOption.PREPROCESSOR_SYMBOLS :
+							new OptionReference(newRef, opt).setValue(optRef.getDefinedSymbols());
+							break;
+						case IOption.LIBRARIES :
+						new OptionReference(newRef, opt).setValue(optRef.getLibraries());
+							break;
+						case IOption.OBJECTS :
+						new OptionReference(newRef, opt).setValue(optRef.getUserObjects());
+							break;
+					}
+				} catch (BuildException e) {
+					continue;
+				}
+			}
+		}
 		
 		target.addConfiguration(this);
 	}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java,v
retrieving revision 1.4
diff -u -r1.4 OptionReference.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java	1 Oct 2003 23:56:36 -0000	1.4
+++ src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java	2 Oct 2003 02:02:16 -0000
@@ -319,6 +319,10 @@
 			   (String[])builtIns.toArray(new String[builtIns.size()]);
 	}
 
+	public IOption getOption() {
+		return option;
+	}
+	
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.IOption#getDefaultEnumValue()
 	 */

Back to the top