1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix for 79689 -- Unable to convert static libraries from 1.2 -> 2.1

Fix for 75859 -- Importing 1.2x mgd make projects doesn't update artifactName
This commit is contained in:
Sean Evoy 2004-11-29 18:35:49 +00:00
parent 01ad33e1cd
commit bc84af8c5a

View file

@ -48,7 +48,6 @@ import org.w3c.dom.NodeList;
class UpdateManagedProject12 { class UpdateManagedProject12 {
private static final String ID_CYGWIN = "cygwin"; //$NON-NLS-1$ private static final String ID_CYGWIN = "cygwin"; //$NON-NLS-1$
private static final String ID_DEBUG = "debug"; //$NON-NLS-1$ private static final String ID_DEBUG = "debug"; //$NON-NLS-1$
private static final String ID_DIRS = "dirs"; //$NON-NLS-1$ private static final String ID_DIRS = "dirs"; //$NON-NLS-1$
@ -160,20 +159,28 @@ class UpdateManagedProject12 {
Element oldTarget = (Element)oldConfig.getParentNode(); Element oldTarget = (Element)oldConfig.getParentNode();
if(oldTarget.hasAttribute(ITarget.ARTIFACT_NAME)){ if(oldTarget.hasAttribute(ITarget.ARTIFACT_NAME)){
String artName = oldTarget.getAttribute(ITarget.ARTIFACT_NAME); String buildGoal = oldTarget.getAttribute(ITarget.ARTIFACT_NAME);
String ext = newConfig.getArtifactExtension(); // The name may be in the form <name>[.ext1[.ext2[...]]]
int extIndex = artName.lastIndexOf("."); //$NON-NLS-1$ String[] nameElements = buildGoal.split("\\."); //$NON-NLS-1$
try{ // There had better be at least a name
if(extIndex != -1){ String name = null;
String name_ext = artName.substring(extIndex+1); try {
if(!"".equals(name_ext) && name_ext.equalsIgnoreCase(ext)) //$NON-NLS-1$ name = nameElements[0];
artName = artName.substring(0,extIndex); } catch (ArrayIndexOutOfBoundsException e) {
name = "default"; //$NON-NLS-1$
}
// Reconstruct the extension
String extension = new String();
for (int index = 1; index < nameElements.length; ++index) {
extension += nameElements[index];
if (index < nameElements.length - 1) {
extension += "."; //$NON-NLS-1$
} }
} }
catch(IndexOutOfBoundsException e){ newConfig.setArtifactName(name);
if (extension.length() != 0) {
newConfig.setArtifactExtension(extension);
} }
newConfig.setArtifactName(artName);
} }
// Convert the tool references // Convert the tool references
@ -383,8 +390,8 @@ class UpdateManagedProject12 {
type = TYPE_EXE; type = TYPE_EXE;
} else if (token.equalsIgnoreCase(ID_SHARED)){ } else if (token.equalsIgnoreCase(ID_SHARED)){
type = TYPE_SHARED; type = TYPE_SHARED;
} else if (token.equalsIgnoreCase(ID_SHARED)){ } else if (token.equalsIgnoreCase(ID_STATIC)){
type = TYPE_SHARED; type = TYPE_STATIC;
} }
} }
// Create a target based on the new target type // Create a target based on the new target type