Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Evoy2004-12-13 11:41:55 -0500
committerSean Evoy2004-12-13 11:41:55 -0500
commita8c899210dee469a2d2b7685c970519b197861dc (patch)
tree5b5f7ea61cd620b90e0b9caef875a29bf5d5b4c2
parenta2acf6e032df2bd7ffaed8ea6ff5f18172721090 (diff)
downloadorg.eclipse.cdt-a8c899210dee469a2d2b7685c970519b197861dc.tar.gz
org.eclipse.cdt-a8c899210dee469a2d2b7685c970519b197861dc.tar.xz
org.eclipse.cdt-a8c899210dee469a2d2b7685c970519b197861dc.zip
Commit for Leo Treggiari -- Bug 80820 Two prob lems for converting 1.2 projects using 3rd party tool integrations
If there is no match for an option in the project being converted, ignore the option and continue converting the configuration Patch tool lookup in converters to handle the case where the location of the definition fools the manifest reader and effectively hides the tool
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zipbin1862 -> 1844 bytes
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zipbin40872 -> 9016 bytes
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java105
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java94
5 files changed, 98 insertions, 109 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip
index 8a12bbf688..f1a0046625 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/1.2/test12.zip
Binary files differ
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip
index 46411a915f..e783c848ce 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/resources/oldTypeProjects/2.0/test20.zip
Binary files differ
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java
index e56e8d6120..914c5f8e16 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedProjectUpdateTests.java
@@ -52,8 +52,10 @@ public class ManagedProjectUpdateTests extends TestCase {
private IProject[] createVersionProjects(String version){
File file = getVersionProjectsDir(version);
- if(file == null)
+ if(file == null) {
+ fail("Test project directory " + file.getName() + " is missing.");
return null;
+ }
File projectZips[] = file.listFiles(new FileFilter(){
public boolean accept(File pathname){
@@ -80,8 +82,10 @@ public class ManagedProjectUpdateTests extends TestCase {
catch(Exception e){
}
}
- if(projectList.size() == 0)
+ if(projectList.size() == 0) {
+ fail("No projects found in test project directory " + file.getName() + ". The .zip file may be missing or corrupt.");
return null;
+ }
return (IProject[])projectList.toArray(new IProject[projectList.size()]);
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java
index 0b79a64b2c..b1f1775737 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject12.java
@@ -218,6 +218,7 @@ class UpdateManagedProject12 {
convertToolRef(toolChain, (Element) toolRefNodes.item(refIndex), monitor);
}
catch(CoreException e){
+ // TODO: Need error dialog!
newProject.removeConfiguration(newConfigId);
throw e;
}
@@ -233,7 +234,7 @@ class UpdateManagedProject12 {
String optId = null;
String[] idTokens = oldId.split(REGEXP_SEPARATOR);
Vector oldIdVector = new Vector(Arrays.asList(idTokens));
- if (isBuiltInOption(oldIdVector)) {
+ if (isBuiltInOption(oldIdVector)) {
// New ID will be in form gnu.[c|c++|both].[compiler|link|lib].option.{1.2_component}
Vector newIdVector = new Vector(idTokens.length + 2);
@@ -314,7 +315,6 @@ class UpdateManagedProject12 {
// ignore this exception too
}
-
// Construct the new ID
optId = new String();
for (int rebuildIndex = 0; rebuildIndex < newIdVector.size(); ++ rebuildIndex) {
@@ -350,8 +350,7 @@ class UpdateManagedProject12 {
return curOption.getId();
}
- throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
- ConverterMessages.getFormattedString("UpdateManagedProject12.3",optId), null)); //$NON-NLS-1$
+ return optId;
}
protected static void convertOptionRef(IToolChain toolChain, ITool tool, Element optRef)
@@ -362,51 +361,47 @@ class UpdateManagedProject12 {
optId = getNewOptionId(toolChain, tool, optId);
// Get the option from the new tool
IOption newOpt = tool.getOptionById(optId);
- if (newOpt == null) {
- throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
- ConverterMessages.getFormattedString("UpdateManagedProject12.4",optId), null)); //$NON-NLS-1$
- }
-
- IConfiguration configuration = toolChain.getParent();
-
- try {
- switch (newOpt.getValueType()) {
- case IOption.BOOLEAN:
- Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
- configuration.setOption(tool, newOpt, bool.booleanValue());
- break;
- case IOption.STRING:
- case IOption.ENUMERATED:
- // This is going to be the human readable form of the enumerated value
- String name = (String) optRef.getAttribute(IOption.DEFAULT_VALUE);
- // Convert it to the ID
- String idValue = newOpt.getEnumeratedId(name);
- configuration.setOption(tool, newOpt, idValue != null ? idValue : name);
- break;
- case IOption.STRING_LIST:
- case IOption.INCLUDE_PATH:
- case IOption.PREPROCESSOR_SYMBOLS:
- case IOption.LIBRARIES:
- case IOption.OBJECTS:
- Vector values = new Vector();
- NodeList nodes = optRef.getElementsByTagName(IOption.LIST_VALUE);
- for (int i = 0; i < nodes.getLength(); ++i) {
- Node node = nodes.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
- if (!isBuiltIn.booleanValue()) {
- values.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ if (newOpt != null) { // Ignore options that don't have a match
+ IConfiguration configuration = toolChain.getParent();
+
+ try {
+ switch (newOpt.getValueType()) {
+ case IOption.BOOLEAN:
+ Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
+ configuration.setOption(tool, newOpt, bool.booleanValue());
+ break;
+ case IOption.STRING:
+ case IOption.ENUMERATED:
+ // This is going to be the human readable form of the enumerated value
+ String name = (String) optRef.getAttribute(IOption.DEFAULT_VALUE);
+ // Convert it to the ID
+ String idValue = newOpt.getEnumeratedId(name);
+ configuration.setOption(tool, newOpt, idValue != null ? idValue : name);
+ break;
+ case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
+ case IOption.OBJECTS:
+ Vector values = new Vector();
+ NodeList nodes = optRef.getElementsByTagName(IOption.LIST_VALUE);
+ for (int i = 0; i < nodes.getLength(); ++i) {
+ Node node = nodes.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (!isBuiltIn.booleanValue()) {
+ values.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ }
}
}
- }
- configuration.setOption(tool, newOpt, (String[])values.toArray(new String[values.size()]));
- break;
+ configuration.setOption(tool, newOpt, (String[])values.toArray(new String[values.size()]));
+ break;
+ }
+ } catch (BuildException e) {
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject12.5",e.getMessage()), e)); //$NON-NLS-1$
}
- } catch (BuildException e) {
- throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
- ConverterMessages.getFormattedString("UpdateManagedProject12.5",e.getMessage()), e)); //$NON-NLS-1$
- }
-
+ }
}
/* (non-Javadoc)
@@ -582,17 +577,15 @@ class UpdateManagedProject12 {
ITool parent = curTool.getSuperClass();
String curToolId = curTool.getId();
+ while (parent != null) {
+ String parentId = parent.getId();
+ if(parentId.equals(toolId))
+ break;
+ parent = parent.getSuperClass();
+ }
if(parent == null)
continue;
-
- parent = parent.getSuperClass();
- if(parent == null)
- continue;
-
- String parentId = parent.getId();
- if(!parentId.equals(toolId))
- continue;
-
+
try{
Integer.decode(curToolId.substring(curToolId.lastIndexOf('.')+1)); //$NON-NLS-1$
}
@@ -611,9 +604,7 @@ class UpdateManagedProject12 {
protected static void convertToolRef(IToolChain toolChain, Element oldToolRef, IProgressMonitor monitor)
throws CoreException {
String toolId = oldToolRef.getAttribute(IToolReference.ID);
-
toolId = getNewToolId(toolChain, toolId);
-
IConfiguration configuration = toolChain.getParent();
// Get the new tool out of the configuration
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
index a709537b4e..2655667202 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
@@ -286,17 +286,15 @@ class UpdateManagedProject20 {
ITool parent = curTool.getSuperClass();
String curToolId = curTool.getId();
- if(parent == null)
- continue;
-
- parent = parent.getSuperClass();
+ while (parent != null) {
+ String parentId = parent.getId();
+ if(parentId.equals(toolId))
+ break;
+ parent = parent.getSuperClass();
+ }
if(parent == null)
continue;
- String parentId = parent.getId();
- if(!parentId.equals(toolId))
- continue;
-
try{
Integer.decode(curToolId.substring(curToolId.lastIndexOf('.')+1)); //$NON-NLS-1$
}
@@ -374,56 +372,52 @@ class UpdateManagedProject20 {
if(option == null)
option = tool.getOptionById(optId);
- if(option == null){
- throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
- ConverterMessages.getFormattedString("UpdateManagedProject20.7",optId), null)); //$NON-NLS-1$
- }
-
- try{
- int type = option.getValueType();
-
- switch(type){
- case IOption.BOOLEAN:{
- if(optRef.hasAttribute(IOption.DEFAULT_VALUE)){
- Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
- configuration.setOption(tool,option,bool.booleanValue());
+ if (option != null) { // Ignore options that don't have a match
+ try{
+ int type = option.getValueType();
+
+ switch(type){
+ case IOption.BOOLEAN:{
+ if(optRef.hasAttribute(IOption.DEFAULT_VALUE)){
+ Boolean bool = new Boolean(optRef.getAttribute(IOption.DEFAULT_VALUE));
+ configuration.setOption(tool,option,bool.booleanValue());
+ }
+ break;
}
- break;
- }
- case IOption.ENUMERATED:
- case IOption.STRING:{
- if(optRef.hasAttribute(IOption.DEFAULT_VALUE))
- configuration.setOption(tool,option,optRef.getAttribute(IOption.DEFAULT_VALUE));
- break;
- }
- case IOption.STRING_LIST:
- case IOption.INCLUDE_PATH:
- case IOption.PREPROCESSOR_SYMBOLS:
- case IOption.LIBRARIES:
- case IOption.OBJECTS:{
- Vector values = new Vector();
- NodeList nodes = optRef.getElementsByTagName(IOption.LIST_VALUE);
- for (int j = 0; j < nodes.getLength(); ++j) {
- Node node = nodes.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
- if (!isBuiltIn.booleanValue()) {
- values.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ case IOption.ENUMERATED:
+ case IOption.STRING:{
+ if(optRef.hasAttribute(IOption.DEFAULT_VALUE))
+ configuration.setOption(tool,option,optRef.getAttribute(IOption.DEFAULT_VALUE));
+ break;
+ }
+ case IOption.STRING_LIST:
+ case IOption.INCLUDE_PATH:
+ case IOption.PREPROCESSOR_SYMBOLS:
+ case IOption.LIBRARIES:
+ case IOption.OBJECTS:{
+ Vector values = new Vector();
+ NodeList nodes = optRef.getElementsByTagName(IOption.LIST_VALUE);
+ for (int j = 0; j < nodes.getLength(); ++j) {
+ Node node = nodes.item(j);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Boolean isBuiltIn = new Boolean(((Element)node).getAttribute(IOption.LIST_ITEM_BUILTIN));
+ if (!isBuiltIn.booleanValue()) {
+ values.add(((Element)node).getAttribute(IOption.LIST_ITEM_VALUE));
+ }
}
}
+ configuration.setOption(tool,option,(String[])values.toArray(new String[values.size()]));
+ break;
}
- configuration.setOption(tool,option,(String[])values.toArray(new String[values.size()]));
+ default:
break;
}
- default:
- break;
+ }
+ catch(BuildException e){
+ throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
+ ConverterMessages.getFormattedString("UpdateManagedProject20.8",e.getMessage()), e)); //$NON-NLS-1$
}
}
- catch(BuildException e){
- throw new CoreException(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.getUniqueIdentifier(), -1,
- ConverterMessages.getFormattedString("UpdateManagedProject20.8",e.getMessage()), e)); //$NON-NLS-1$
- }
-
}
}

Back to the top