mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
1. NPE in Extension reference mechanism
2. Active CFG selection fixes 3. conversion mechanism fixes
This commit is contained in:
parent
3855937321
commit
7566d17867
7 changed files with 69 additions and 20 deletions
|
@ -65,6 +65,7 @@ import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentBuildPathsChangeListene
|
|||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.buildproperties.BuildPropertyManager;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.BooleanExpressionApplicabilityCalculator;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.BuildSettingsUtil;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Builder;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.BuilderFactory;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder;
|
||||
|
@ -1420,7 +1421,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
}
|
||||
|
||||
// try {
|
||||
CoreModel.getDefault().setProjectDescription(project, projDes);
|
||||
BuildSettingsUtil.checkApplyDescription(project, projDes);
|
||||
// } catch (CoreException e) {
|
||||
// return false;
|
||||
// }
|
||||
|
@ -1561,7 +1562,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project);
|
||||
if(projDes != null){
|
||||
if(applyConfiguration(cfg, projDes, true)){
|
||||
CoreModel.getDefault().setProjectDescription(project, projDes);
|
||||
BuildSettingsUtil.checkApplyDescription(project, projDes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1584,8 +1585,9 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
|||
updated = true;
|
||||
}
|
||||
}
|
||||
if(updated)
|
||||
CoreModel.getDefault().setProjectDescription(project, projDes);
|
||||
if(updated){
|
||||
BuildSettingsUtil.checkApplyDescription(project, projDes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,9 @@ import java.util.ArrayList;
|
|||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.model.CoreModel;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.managedbuilder.core.BuildException;
|
||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
||||
|
@ -22,6 +25,8 @@ import org.eclipse.cdt.managedbuilder.core.ITool;
|
|||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
||||
public class BuildSettingsUtil {
|
||||
private static final int[] COMMON_SETTINGS_IDS = new int[]{
|
||||
|
@ -133,4 +138,14 @@ public class BuildSettingsUtil {
|
|||
values.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkApplyDescription(IProject project, ICProjectDescription des) throws CoreException{
|
||||
ICConfigurationDescription[] cfgs = des.getConfigurations();
|
||||
for(int i = 0; i < cfgs.length; i++){
|
||||
if(!ManagedBuildManager.CFG_DATA_PROVIDER_ID.equals(cfgs[i].getBuildSystemId()))
|
||||
des.removeConfiguration(cfgs[i]);
|
||||
}
|
||||
|
||||
CoreModel.getDefault().setProjectDescription(project, des);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.eclipse.cdt.managedbuilder.core.ITarget;
|
|||
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
|
||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
||||
|
@ -260,12 +261,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
}
|
||||
return defaultConfig;
|
||||
*/
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(getOwner().getProject(), false);
|
||||
IConfiguration activeCfg = null;
|
||||
if(des != null){
|
||||
ICConfigurationDescription cfgDes = des.getActiveConfiguration();
|
||||
activeCfg = managedProject.getConfiguration(cfgDes.getId());
|
||||
}
|
||||
IConfiguration activeCfg = findExistingDefaultConfiguration();
|
||||
|
||||
if(activeCfg == null){
|
||||
IConfiguration cfgs[] = managedProject.getConfigurations();
|
||||
|
@ -276,6 +272,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
return activeCfg;
|
||||
|
||||
}
|
||||
|
||||
private IConfiguration findExistingDefaultConfiguration() {
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(getOwner().getProject(), false);
|
||||
IConfiguration activeCfg = null;
|
||||
if(des != null){
|
||||
ICConfigurationDescription cfgDes = des.getActiveConfiguration();
|
||||
activeCfg = managedProject.getConfiguration(cfgDes.getId());
|
||||
}
|
||||
|
||||
return activeCfg;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
|
||||
|
@ -767,7 +774,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
// Sanity
|
||||
if (configuration == null || configuration.isExtensionElement()) return;
|
||||
|
||||
if (!configuration.equals(getDefaultConfiguration())) {
|
||||
if (!configuration.equals(findExistingDefaultConfiguration())) {
|
||||
IProject project = owner.getProject();
|
||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project);
|
||||
if(des != null){
|
||||
|
@ -783,8 +790,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
|||
if(activeCfgDes != null){
|
||||
des.setActiveConfiguration(activeCfgDes);
|
||||
try {
|
||||
CoreModel.getDefault().setProjectDescription(project, des);
|
||||
BuildSettingsUtil.checkApplyDescription(project, des);
|
||||
} catch (CoreException e) {
|
||||
ManagedBuilderCorePlugin.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2007 Intel Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* Intel Corporation - Initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.core.settings.model;
|
||||
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
|
|
|
@ -919,6 +919,8 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
|||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
ICConfigExtensionReference[] thisRefs = (ICConfigExtensionReference[])entry.getValue();
|
||||
ICConfigExtensionReference[] otherRefs = (ICConfigExtensionReference[])other.fExtMap.get(entry.getKey());
|
||||
if(otherRefs == null)
|
||||
return thisRefs.length == 0;
|
||||
if(thisRefs.length != otherRefs.length)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.settings.model;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.CCorePlugin;
|
||||
|
@ -45,7 +46,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
|||
private IProject fProject;
|
||||
private ICSettingsStorage fStorage;
|
||||
private ICStorageElement fRootStorageElement;
|
||||
private Map fCfgMap = new HashMap();
|
||||
private LinkedHashMap fCfgMap = new LinkedHashMap();
|
||||
private boolean fIsReadOnly;
|
||||
private boolean fIsModified;
|
||||
private HashMap fPropertiesMap;
|
||||
|
@ -234,6 +235,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
|||
doneInitializing();
|
||||
fIsLoadding = false;
|
||||
}
|
||||
|
||||
void setLoadding(boolean loadding){
|
||||
fIsLoadding = loadding;
|
||||
}
|
||||
|
||||
private void doneInitializing(){
|
||||
for(Iterator iter = fCfgMap.values().iterator(); iter.hasNext();){
|
||||
|
|
|
@ -380,10 +380,11 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
}
|
||||
}
|
||||
|
||||
private void clearDescriptionLoadding(IProject project){
|
||||
private CProjectDescription clearDescriptionLoadding(IProject project){
|
||||
Map map = getDescriptionLoaddingMap(false);
|
||||
if(map != null)
|
||||
map.remove(project);
|
||||
return (CProjectDescription)map.remove(project);
|
||||
return null;
|
||||
}
|
||||
|
||||
private Map getDescriptionLoaddingMap(boolean create){
|
||||
|
@ -553,6 +554,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
ownerId = (String)info[0];
|
||||
des = (CProjectDescription)info[1];
|
||||
setDescriptionLoadding(project, des);
|
||||
des.setLoadding(true);
|
||||
} else {
|
||||
ownerId = null;
|
||||
des = null;
|
||||
|
@ -584,10 +586,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
}
|
||||
|
||||
des = new CProjectDescription(des, true, el);
|
||||
setDescriptionApplying(project, des);
|
||||
des.applyDatas();
|
||||
des.doneApplying();
|
||||
clearDescriptionApplying(project);
|
||||
try {
|
||||
setDescriptionApplying(project, des);
|
||||
des.applyDatas();
|
||||
des.doneApplying();
|
||||
} finally {
|
||||
clearDescriptionApplying(project);
|
||||
}
|
||||
|
||||
try {
|
||||
((InternalXmlStorageElement)des.getRootStorageElement()).setReadOnly(true);
|
||||
|
@ -595,7 +600,9 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
|||
}
|
||||
}
|
||||
}finally{
|
||||
clearDescriptionLoadding(project);
|
||||
CProjectDescription d = clearDescriptionLoadding(project);
|
||||
if(d != null)
|
||||
d.setLoadding(false);
|
||||
}
|
||||
return des;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue