1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 10:15:39 +02:00

1. Fix to [Bug 175836] project build macro no longer resolved in the new project model

2. [Bug 175581] Includes path entry not filled out with envVarBuildPath: project suppliers now working
3. Option event handling fixes
4. Other bug-fixes
This commit is contained in:
Mikhail Sennikovsky 2007-02-28 17:49:25 +00:00
parent 91a194dc33
commit d6885590f9
8 changed files with 104 additions and 30 deletions

View file

@ -44,6 +44,7 @@ import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.util.XmlStorageElement;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty; import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyManager; import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyManager;
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListener; import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListener;
@ -1884,7 +1885,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
Node node = nodes.item(0); Node node = nodes.item(0);
// Create the internal representation of the project's MBS information // Create the internal representation of the project's MBS information
buildInfo = new ManagedBuildInfo(project, (Element)node, fileVersion); buildInfo = new ManagedBuildInfo(project, new XmlStorageElement((Element)node), true, fileVersion);
if (fileVersion != null) { if (fileVersion != null) {
// buildInfo.setVersion(fileVersion); // buildInfo.setVersion(fileVersion);
PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion); PluginVersionIdentifier version = new PluginVersionIdentifier(fileVersion);

View file

@ -27,6 +27,7 @@ import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription; import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.WriteAccessException; import org.eclipse.cdt.core.settings.model.WriteAccessException;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IBuildObject; import org.eclipse.cdt.managedbuilder.core.IBuildObject;
@ -123,16 +124,18 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
* @param element * @param element
* @param managedBuildRevision * @param managedBuildRevision
*/ */
public ManagedBuildInfo(IResource owner, Element element, String managedBuildRevision) { public ManagedBuildInfo(IResource owner, ICStorageElement element, boolean loadConfigs, String managedBuildRevision) {
this(owner); this(owner);
// Recreate the managed build project element and its children // Recreate the managed build project element and its children
NodeList projNodes = element.getElementsByTagName(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME); ICStorageElement projNodes[] = element.getChildren();
// TODO: There should only be 1? // TODO: There should only be 1?
for (int projIndex = projNodes.getLength() - 1; projIndex >= 0; --projIndex) { for (int projIndex = projNodes.length - 1; projIndex >= 0; --projIndex) {
ManagedProject proj = new ManagedProject(this, (Element)projNodes.item(projIndex), managedBuildRevision); if(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME.equals(projNodes[projIndex].getName())){
if (!proj.resolveReferences()) ManagedProject proj = new ManagedProject(this, projNodes[projIndex], loadConfigs, managedBuildRevision);
proj.setValid(false); if (!proj.resolveReferences())
proj.setValid(false);
}
} }
// Switch the rebuild off since this is an existing project // Switch the rebuild off since this is an existing project

View file

@ -124,7 +124,7 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* @param element * @param element
* @param managedBuildRevision the fileVersion of Managed Build System * @param managedBuildRevision the fileVersion of Managed Build System
*/ */
public ManagedProject(ManagedBuildInfo buildInfo, Element element, String managedBuildRevision) { public ManagedProject(ManagedBuildInfo buildInfo, ICStorageElement element, boolean loadConfigs, String managedBuildRevision) {
this(buildInfo.getOwner()); this(buildInfo.getOwner());
setManagedBuildRevision(managedBuildRevision); setManagedBuildRevision(managedBuildRevision);
@ -133,24 +133,25 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
if (loadFromProject(element)) { if (loadFromProject(element)) {
// check for migration support. // check for migration support.
boolean isSupportAvailable = projectType.checkForMigrationSupport(); boolean isSupportAvailable = projectType != null ? projectType.checkForMigrationSupport() : true;
if (isSupportAvailable == false) { if (isSupportAvailable == false) {
setValid(false); setValid(false);
} }
// Load children if(loadConfigs){
NodeList configElements = element.getChildNodes(); // Load children
for (int i = 0; i < configElements.getLength(); ++i) { ICStorageElement configElements[] = element.getChildren();
Node configElement = configElements.item(i); for (int i = 0; i < configElements.length; ++i) {
if (configElement.getNodeName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) { ICStorageElement configElement = configElements[i];
ICStorageElement el = new XmlStorageElement((Element)configElement); if (configElement.getName().equals(IConfiguration.CONFIGURATION_ELEMENT_NAME)) {
Configuration config = new Configuration(this, el, managedBuildRevision, false); Configuration config = new Configuration(this, configElement, managedBuildRevision, false);
}/*else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) { }/*else if (configElement.getNodeName().equals(StorableMacros.MACROS_ELEMENT_NAME)) {
//load user-defined macros //load user-defined macros
ICStorageElement el = new XmlStorageElement((Element)configElement); ICStorageElement el = new XmlStorageElement((Element)configElement);
userDefinedMacros = new StorableMacros(el); userDefinedMacros = new StorableMacros(el);
}*/ }*/
}
} }
} else { } else {
setValid(false); setValid(false);
@ -170,13 +171,13 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
* *
* @param element An XML element containing the project information * @param element An XML element containing the project information
*/ */
protected boolean loadFromProject(Element element) { protected boolean loadFromProject(ICStorageElement element) {
// id // id
setId(element.getAttribute(IBuildObject.ID)); setId(element.getAttribute(IBuildObject.ID));
// name // name
if (element.hasAttribute(IBuildObject.NAME)) { if (element.getAttribute(IBuildObject.NAME) != null) {
setName(element.getAttribute(IBuildObject.NAME)); setName(element.getAttribute(IBuildObject.NAME));
} }
@ -196,6 +197,21 @@ public class ManagedProject extends BuildObject implements IManagedProject, IBui
return true; return true;
} }
public void serializeProjectInfo(ICStorageElement element) {
element.setAttribute(IBuildObject.ID, id);
if (name != null) {
element.setAttribute(IBuildObject.NAME, name);
}
if (projectType != null) {
element.setAttribute(PROJECTTYPE, projectType.getId());
}
// I am clean now
isDirty = false;
}
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize() * @see org.eclipse.cdt.managedbuilder.core.IManagedProject#serialize()
*/ */

View file

@ -21,6 +21,7 @@ import java.util.Set;
import org.eclipse.cdt.core.model.ILanguageDescriptor; import org.eclipse.cdt.core.model.ILanguageDescriptor;
import org.eclipse.cdt.core.model.LanguageManager; import org.eclipse.cdt.core.model.LanguageManager;
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
import org.eclipse.cdt.core.settings.model.ICStorageElement; import org.eclipse.cdt.core.settings.model.ICStorageElement;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider; import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
@ -29,6 +30,7 @@ import org.eclipse.cdt.managedbuilder.core.IFolderInfo;
import org.eclipse.cdt.managedbuilder.core.IHoldsOptions; import org.eclipse.cdt.managedbuilder.core.IHoldsOptions;
import org.eclipse.cdt.managedbuilder.core.IInputType; import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedOptionValueHandler;
import org.eclipse.cdt.managedbuilder.core.IManagedProject; import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IOption; import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo; import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
@ -38,6 +40,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.internal.core.Configuration; import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
import org.eclipse.cdt.managedbuilder.internal.core.ISettingsChangeListener; import org.eclipse.cdt.managedbuilder.internal.core.ISettingsChangeListener;
import org.eclipse.cdt.managedbuilder.internal.core.InputType; import org.eclipse.cdt.managedbuilder.internal.core.InputType;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject; import org.eclipse.cdt.managedbuilder.internal.core.ManagedProject;
import org.eclipse.cdt.managedbuilder.internal.core.NotificationManager; import org.eclipse.cdt.managedbuilder.internal.core.NotificationManager;
import org.eclipse.cdt.managedbuilder.internal.core.Tool; import org.eclipse.cdt.managedbuilder.internal.core.Tool;
@ -70,6 +73,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
ICStorageElement cfgElemen = rootElement.createChild(IConfiguration.CONFIGURATION_ELEMENT_NAME); ICStorageElement cfgElemen = rootElement.createChild(IConfiguration.CONFIGURATION_ELEMENT_NAME);
Configuration cfg = (Configuration)appliedCfg.getConfiguration(); Configuration cfg = (Configuration)appliedCfg.getConfiguration();
cfg.setConfigurationDescription(des); cfg.setConfigurationDescription(des);
ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_APPLY);
cfg.serialize(cfgElemen); cfg.serialize(cfgElemen);
return appliedCfg; return appliedCfg;
@ -96,10 +100,21 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
IManagedBuildInfo info = getBuildInfo(des); IManagedBuildInfo info = getBuildInfo(des);
ManagedProject mProj = (ManagedProject)info.getManagedProject(); ManagedProject mProj = (ManagedProject)info.getManagedProject();
mProj.applyConfiguration((Configuration)appliedCfg.getConfiguration()); mProj.applyConfiguration((Configuration)appliedCfg.getConfiguration());
writeManagedProjectInfo(des.getProjectDescription(), mProj);
info.setValid(true); info.setValid(true);
return appliedCfg; return appliedCfg;
} }
private static void writeManagedProjectInfo(ICProjectDescription des,
ManagedProject mProj) throws CoreException {
ICStorageElement rootElement = des.getStorage(BUILD_SYSTEM_DATA_MODULE_NAME, true);
rootElement.clear();
rootElement.setAttribute(VERSION_ATTRIBUTE, ManagedBuildManager.getVersion().toString());
ICStorageElement mProjElem = rootElement.createChild(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME);
mProj.serializeProjectInfo(mProjElem);
}
protected CConfigurationData createPreferences( protected CConfigurationData createPreferences(
ICConfigurationDescription des, CConfigurationData base) ICConfigurationDescription des, CConfigurationData base)
@ -149,9 +164,34 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
private IManagedProject getManagedProject(ICConfigurationDescription des, IManagedBuildInfo info){ private IManagedProject getManagedProject(ICConfigurationDescription des, IManagedBuildInfo info){
IManagedProject mProj = info.getManagedProject(); IManagedProject mProj = info.getManagedProject();
if(mProj == null){ if(mProj == null){
mProj = new ManagedProject(des.getProjectDescription()); mProj = createManagedProject(info, des.getProjectDescription());
}
return mProj;
}
private IManagedProject createManagedProject(IManagedBuildInfo info, ICProjectDescription des){
IManagedProject mProj = null;
try {
ICStorageElement rootElem = des.getStorage(BUILD_SYSTEM_DATA_MODULE_NAME, false);
if(rootElem != null){
String version = rootElem.getAttribute(VERSION_ATTRIBUTE);
ICStorageElement children[] = rootElem.getChildren();
for(int i = 0; i < children.length; i++){
if(IManagedProject.MANAGED_PROJECT_ELEMENT_NAME.equals(children[i].getName())){
mProj = new ManagedProject((ManagedBuildInfo)info, children[i], false, version);
break;
}
}
}
} catch (CoreException e) {
mProj = null;
}
if(mProj == null){
mProj = new ManagedProject(des);
info.setManagedProject(mProj); info.setManagedProject(mProj);
} }
return mProj; return mProj;
} }
@ -164,6 +204,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
for(int i = 0; i < children.length; i++){ for(int i = 0; i < children.length; i++){
if(IConfiguration.CONFIGURATION_ELEMENT_NAME.equals(children[i].getName())){ if(IConfiguration.CONFIGURATION_ELEMENT_NAME.equals(children[i].getName())){
cfg = new Configuration(mProj, children[i], version, isPreference); cfg = new Configuration(mProj, children[i], version, isPreference);
ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_OPEN);
break; break;
} }
} }
@ -353,6 +394,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
public void removeConfiguration(ICConfigurationDescription des, public void removeConfiguration(ICConfigurationDescription des,
CConfigurationData data) { CConfigurationData data) {
IConfiguration cfg = ((BuildConfigurationData)data).getConfiguration(); IConfiguration cfg = ((BuildConfigurationData)data).getConfiguration();
ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_CLOSE);
IManagedBuildInfo info = getBuildInfo(des); IManagedBuildInfo info = getBuildInfo(des);
IManagedProject mProj = info.getManagedProject(); IManagedProject mProj = info.getManagedProject();
mProj.removeConfiguration(cfg.getId()); mProj.removeConfiguration(cfg.getId());

View file

@ -106,6 +106,7 @@ public class ProjectConverter implements ICProjectConverter {
Configuration cfg = ConfigurationDataProvider.getClearPreference(des.getId()); Configuration cfg = ConfigurationDataProvider.getClearPreference(des.getId());
cfg.applyToManagedProject(mProj); cfg.applyToManagedProject(mProj);
cfg.setConfigurationDescription(des);
des.setConfigurationData(ManagedBuildManager.CFG_DATA_PROVIDER_ID, cfg.getConfigurationData()); des.setConfigurationData(ManagedBuildManager.CFG_DATA_PROVIDER_ID, cfg.getConfigurationData());
} }
@ -278,7 +279,8 @@ public class ProjectConverter implements ICProjectConverter {
cfg = (Configuration)cfgs[i]; cfg = (Configuration)cfgs[i];
data = cfg.getConfigurationData(); data = cfg.getConfigurationData();
try { try {
newDes.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data); ICConfigurationDescription cfgDes = newDes.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
cfg.setConfigurationDescription(cfgDes);
} catch (WriteAccessException e) { } catch (WriteAccessException e) {
ManagedBuilderCorePlugin.log(e); ManagedBuilderCorePlugin.log(e);
} catch (CoreException e) { } catch (CoreException e) {

View file

@ -93,7 +93,7 @@ public class ExternalExtensionEnvironmentSupplier implements
} }
else if (context instanceof IManagedProject) { else if (context instanceof IManagedProject) {
IManagedProject project = (IManagedProject)context; IManagedProject project = (IManagedProject)context;
IProjectEnvironmentVariableSupplier supplier = null;//project.getProjectType().getEnvironmentVariableSupplier(); IProjectEnvironmentVariableSupplier supplier = project.getProjectType() != null ? project.getProjectType().getEnvironmentVariableSupplier() : null;
if(supplier == null) if(supplier == null)
return null; return null;
variables = supplier.getVariables(project,fProvider); variables = supplier.getVariables(project,fProvider);

View file

@ -93,6 +93,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
*/ */
public CProjectDescription(CProjectDescription base, boolean saving, ICStorageElement el) { public CProjectDescription(CProjectDescription base, boolean saving, ICStorageElement el) {
fActiveCfgId = base.fActiveCfgId; fActiveCfgId = base.fActiveCfgId;
fIndexCfgId = base.fIndexCfgId;
fProject = base.fProject; fProject = base.fProject;
fRootStorageElement = el; fRootStorageElement = el;
fIsReadOnly = saving; fIsReadOnly = saving;
@ -359,13 +360,22 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
if(fIndexCfg == null){ if(fIndexCfg == null){
String id = getIndexConfigurationId(); String id = getIndexConfigurationId();
fIndexCfg = getConfigurationById(id); fIndexCfg = getConfigurationById(id);
if(fIndexCfg == null){
fIndexCfg = getActiveConfiguration();
if(fIndexCfg != null){
fIndexCfgId = fIndexCfg.getId();
} else {
fIndexCfgId = null;
}
}
} }
return fIndexCfg; return fIndexCfg;
} }
private String getIndexConfigurationId(){ private String getIndexConfigurationId(){
if(fIndexCfgId == null) if(fIndexCfgId == null){
fIndexCfgId = getActiveConfigurationId(); fIndexCfgId = getActiveConfigurationId();
}
return fIndexCfgId; return fIndexCfgId;
} }

View file

@ -52,14 +52,14 @@ public class EnvVarOperationProcessor {
String delimiter = added.getDelimiter(); String delimiter = added.getDelimiter();
return new EnvirinmentVariable(name, return new EnvirinmentVariable(name,
performAppend(initial.getValue(),added.getValue(),delimiter), performAppend(initial.getValue(),added.getValue(),delimiter),
// IBuildEnvironmentVariable.ENVVAR_APPEND, IEnvironmentVariable.ENVVAR_APPEND,
delimiter); delimiter);
} }
case IEnvironmentVariable.ENVVAR_PREPEND:{ case IEnvironmentVariable.ENVVAR_PREPEND:{
String delimiter = added.getDelimiter(); String delimiter = added.getDelimiter();
return new EnvirinmentVariable(name, return new EnvirinmentVariable(name,
performPrepend(initial.getValue(),added.getValue(),delimiter), performPrepend(initial.getValue(),added.getValue(),delimiter),
// IBuildEnvironmentVariable.ENVVAR_PREPEND, IEnvironmentVariable.ENVVAR_PREPEND,
delimiter); delimiter);
} }
case IEnvironmentVariable.ENVVAR_REPLACE: case IEnvironmentVariable.ENVVAR_REPLACE: