1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Apply patch from 130170 - Issues with handling version information while generating IDs

This commit is contained in:
Leo Treggiari 2006-03-03 19:19:47 +00:00
parent 7f33784eff
commit 2f7eba1275
4 changed files with 2322 additions and 2324 deletions

View file

@ -337,7 +337,7 @@ public class Configuration extends BuildObject implements IConfiguration {
Iterator iter = resElements.listIterator(); Iterator iter = resElements.listIterator();
while (iter.hasNext()) { while (iter.hasNext()) {
ResourceConfiguration resConfig = (ResourceConfiguration) iter.next(); ResourceConfiguration resConfig = (ResourceConfiguration) iter.next();
subId = getId() + "." + ManagedBuildManager.getRandomNumber(); //$NON-NLS-1$ subId = ManagedBuildManager.calculateChildId(getId(), resConfig.getResourcePath());
ResourceConfiguration newResConfig = new ResourceConfiguration(this, resConfig, subId); ResourceConfiguration newResConfig = new ResourceConfiguration(this, resConfig, subId);
addResourceConfiguration(newResConfig); addResourceConfiguration(newResConfig);
} }
@ -974,7 +974,7 @@ public class Configuration extends BuildObject implements IConfiguration {
return parent.getCleanCommand(); return parent.getCleanCommand();
} else { } else {
// User forgot to specify it. Guess based on OS. // User forgot to specify it. Guess based on OS.
if (Platform.getOS().equals("OS_WIN32")) { //$NON-NLS-1$ if (Platform.getOS().equals(Platform.OS_WIN32)) {
return new String("del"); //$NON-NLS-1$ return new String("del"); //$NON-NLS-1$
} else { } else {
return new String("rm"); //$NON-NLS-1$ return new String("rm"); //$NON-NLS-1$
@ -1486,5 +1486,4 @@ public class Configuration extends BuildObject implements IConfiguration {
setDirty(true); setDirty(true);
} }
} }
} }

View file

@ -528,7 +528,13 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
} }
// Create a new extension Option element // Create a new extension Option element
String subId; String subId;
subId = newSuperClass.getId() + ".adjusted." + new Integer(ManagedBuildManager.getRandomNumber()); //$NON-NLS-1$ //$NON-NLS-2$ String version = ManagedBuildManager.getVersionFromIdAndVersion(newSuperClass.getId());
String baseId = ManagedBuildManager.getIdFromIdAndVersion(newSuperClass.getId());
if ( version != null) {
subId = baseId + ".adjusted." + new Integer(ManagedBuildManager.getRandomNumber()) + "_" + version; //$NON-NLS-1$ //$NON-NLS-2$
} else {
subId = baseId + ".adjusted." + new Integer(ManagedBuildManager.getRandomNumber()); //$NON-NLS-1$
}
setOption = createOption(newSuperClass, subId, null, true); setOption = createOption(newSuperClass, subId, null, true);
((Option)setOption).setAdjusted(true); ((Option)setOption).setAdjusted(true);
setOption.setValueType(option.getValueType()); setOption.setValueType(option.getValueType());
@ -552,8 +558,7 @@ public class HoldsOptions extends BuildObject implements IHoldsOptions {
} }
// Create an Option element for the managed build project file (.CDTBUILD) // Create an Option element for the managed build project file (.CDTBUILD)
String subId; String subId;
int nnn = ManagedBuildManager.getRandomNumber(); subId = ManagedBuildManager.calculateChildId(newSuperClass.getId(), null);
subId = newSuperClass.getId() + "." + nnn; //$NON-NLS-1$
setOption = createOption(newSuperClass, subId, null, false); setOption = createOption(newSuperClass, subId, null, false);
setOption.setValueType(option.getValueType()); setOption.setValueType(option.getValueType());
} }

View file

@ -394,7 +394,7 @@ public class Target extends BuildObject implements ITarget {
return parent.getCleanCommand(); return parent.getCleanCommand();
} else { } else {
// User forgot to specify it. Guess based on OS. // User forgot to specify it. Guess based on OS.
if (Platform.getOS().equals("OS_WIN32")) { //$NON-NLS-1$ if (Platform.getOS().equals(Platform.OS_WIN32)) {
return new String("del"); //$NON-NLS-1$ return new String("del"); //$NON-NLS-1$
} else { } else {
return new String("rm"); //$NON-NLS-1$ return new String("rm"); //$NON-NLS-1$

View file

@ -55,8 +55,6 @@ public class NewConfigurationDialog extends StatusDialog {
private static final String INVALID = ERROR + ".invalidName"; //$NON-NLS-1$ private static final String INVALID = ERROR + ".invalidName"; //$NON-NLS-1$
private static final String DESCRIPTION = LABEL + ".description"; //$NON-NLS-1$ private static final String DESCRIPTION = LABEL + ".description"; //$NON-NLS-1$
private static final String ID_SEPARATOR = "."; //$NON-NLS-1$
// Widgets // Widgets
private Button btnClone; private Button btnClone;
private Button btnCopy; private Button btnCopy;
@ -549,23 +547,19 @@ public class NewConfigurationDialog extends StatusDialog {
* the dialog. * the dialog.
*/ */
public IConfiguration newConfiguration(IManagedBuildInfo info) { public IConfiguration newConfiguration(IManagedBuildInfo info) {
int id = ManagedBuildManager.getRandomNumber();
// Create ID for the new component based on the parent ID and random component String newId = null;
String newId = parentConfig.getId();
int index = newId.lastIndexOf(ID_SEPARATOR);
if (index > 0) {
String lastComponent = newId.substring(index + 1, newId.length());
if (Character.isDigit(lastComponent.charAt(0))) {
// Strip the last component
newId = newId.substring(0, index);
}
}
newId += ID_SEPARATOR + id;
IConfiguration newConfig; IConfiguration newConfig;
if (parentConfig.isExtensionElement()) { if (parentConfig.isExtensionElement()) {
// If parent config is an extension element,
// Create ID for the new component based on the parentConfig's id and random component
newId = ManagedBuildManager.calculateChildId(parentConfig.getId(), null);
newConfig = info.getManagedProject().createConfiguration(parentConfig, newId); newConfig = info.getManagedProject().createConfiguration(parentConfig, newId);
} else { } else {
// If parent config is not an extension element, then
// Create ID for the new component based on the parentConfig's parent id and random component
newId = ManagedBuildManager.calculateChildId(parentConfig.getParent().getId(), null);
newConfig = info.getManagedProject().createConfigurationClone(parentConfig, newId); newConfig = info.getManagedProject().createConfigurationClone(parentConfig, newId);
} }