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.envvar.IEnvironmentVariableProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.buildproperties.BuildPropertyManager;
|
import org.eclipse.cdt.managedbuilder.internal.buildproperties.BuildPropertyManager;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.BooleanExpressionApplicabilityCalculator;
|
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.Builder;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.BuilderFactory;
|
import org.eclipse.cdt.managedbuilder.internal.core.BuilderFactory;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder;
|
import org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder;
|
||||||
|
@ -1420,7 +1421,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
}
|
}
|
||||||
|
|
||||||
// try {
|
// try {
|
||||||
CoreModel.getDefault().setProjectDescription(project, projDes);
|
BuildSettingsUtil.checkApplyDescription(project, projDes);
|
||||||
// } catch (CoreException e) {
|
// } catch (CoreException e) {
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
|
@ -1561,7 +1562,7 @@ public class ManagedBuildManager extends AbstractCExtension implements IScannerI
|
||||||
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project);
|
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(project);
|
||||||
if(projDes != null){
|
if(projDes != null){
|
||||||
if(applyConfiguration(cfg, projDes, true)){
|
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;
|
updated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(updated)
|
if(updated){
|
||||||
CoreModel.getDefault().setProjectDescription(project, projDes);
|
BuildSettingsUtil.checkApplyDescription(project, projDes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
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.BuildException;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IOption;
|
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.ManagedBuildManager;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
|
import org.eclipse.cdt.managedbuilder.core.OptionStringValue;
|
||||||
|
import org.eclipse.core.resources.IProject;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
||||||
public class BuildSettingsUtil {
|
public class BuildSettingsUtil {
|
||||||
private static final int[] COMMON_SETTINGS_IDS = new int[]{
|
private static final int[] COMMON_SETTINGS_IDS = new int[]{
|
||||||
|
@ -133,4 +138,14 @@ public class BuildSettingsUtil {
|
||||||
values.clear();
|
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.ITool;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
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.IBuildEnvironmentVariable;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
|
||||||
|
@ -260,12 +261,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
}
|
}
|
||||||
return defaultConfig;
|
return defaultConfig;
|
||||||
*/
|
*/
|
||||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(getOwner().getProject(), false);
|
IConfiguration activeCfg = findExistingDefaultConfiguration();
|
||||||
IConfiguration activeCfg = null;
|
|
||||||
if(des != null){
|
|
||||||
ICConfigurationDescription cfgDes = des.getActiveConfiguration();
|
|
||||||
activeCfg = managedProject.getConfiguration(cfgDes.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(activeCfg == null){
|
if(activeCfg == null){
|
||||||
IConfiguration cfgs[] = managedProject.getConfigurations();
|
IConfiguration cfgs[] = managedProject.getConfigurations();
|
||||||
|
@ -276,6 +272,17 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
return activeCfg;
|
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)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
|
* @see org.eclipse.cdt.core.build.managed.IScannerInfo#getDefinedSymbols()
|
||||||
|
@ -767,7 +774,7 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
// Sanity
|
// Sanity
|
||||||
if (configuration == null || configuration.isExtensionElement()) return;
|
if (configuration == null || configuration.isExtensionElement()) return;
|
||||||
|
|
||||||
if (!configuration.equals(getDefaultConfiguration())) {
|
if (!configuration.equals(findExistingDefaultConfiguration())) {
|
||||||
IProject project = owner.getProject();
|
IProject project = owner.getProject();
|
||||||
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project);
|
ICProjectDescription des = CoreModel.getDefault().getProjectDescription(project);
|
||||||
if(des != null){
|
if(des != null){
|
||||||
|
@ -783,8 +790,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
|
||||||
if(activeCfgDes != null){
|
if(activeCfgDes != null){
|
||||||
des.setActiveConfiguration(activeCfgDes);
|
des.setActiveConfiguration(activeCfgDes);
|
||||||
try {
|
try {
|
||||||
CoreModel.getDefault().setProjectDescription(project, des);
|
BuildSettingsUtil.checkApplyDescription(project, des);
|
||||||
} catch (CoreException e) {
|
} 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;
|
package org.eclipse.cdt.core.settings.model;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
|
|
@ -919,6 +919,8 @@ public class CConfigurationSpecSettings implements ICSettingsStorage{
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
ICConfigExtensionReference[] thisRefs = (ICConfigExtensionReference[])entry.getValue();
|
ICConfigExtensionReference[] thisRefs = (ICConfigExtensionReference[])entry.getValue();
|
||||||
ICConfigExtensionReference[] otherRefs = (ICConfigExtensionReference[])other.fExtMap.get(entry.getKey());
|
ICConfigExtensionReference[] otherRefs = (ICConfigExtensionReference[])other.fExtMap.get(entry.getKey());
|
||||||
|
if(otherRefs == null)
|
||||||
|
return thisRefs.length == 0;
|
||||||
if(thisRefs.length != otherRefs.length)
|
if(thisRefs.length != otherRefs.length)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.settings.model;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
|
@ -45,7 +46,7 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
private IProject fProject;
|
private IProject fProject;
|
||||||
private ICSettingsStorage fStorage;
|
private ICSettingsStorage fStorage;
|
||||||
private ICStorageElement fRootStorageElement;
|
private ICStorageElement fRootStorageElement;
|
||||||
private Map fCfgMap = new HashMap();
|
private LinkedHashMap fCfgMap = new LinkedHashMap();
|
||||||
private boolean fIsReadOnly;
|
private boolean fIsReadOnly;
|
||||||
private boolean fIsModified;
|
private boolean fIsModified;
|
||||||
private HashMap fPropertiesMap;
|
private HashMap fPropertiesMap;
|
||||||
|
@ -234,6 +235,10 @@ public class CProjectDescription implements ICProjectDescription, ICDataProxyCon
|
||||||
doneInitializing();
|
doneInitializing();
|
||||||
fIsLoadding = false;
|
fIsLoadding = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setLoadding(boolean loadding){
|
||||||
|
fIsLoadding = loadding;
|
||||||
|
}
|
||||||
|
|
||||||
private void doneInitializing(){
|
private void doneInitializing(){
|
||||||
for(Iterator iter = fCfgMap.values().iterator(); iter.hasNext();){
|
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);
|
Map map = getDescriptionLoaddingMap(false);
|
||||||
if(map != null)
|
if(map != null)
|
||||||
map.remove(project);
|
return (CProjectDescription)map.remove(project);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map getDescriptionLoaddingMap(boolean create){
|
private Map getDescriptionLoaddingMap(boolean create){
|
||||||
|
@ -553,6 +554,7 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
ownerId = (String)info[0];
|
ownerId = (String)info[0];
|
||||||
des = (CProjectDescription)info[1];
|
des = (CProjectDescription)info[1];
|
||||||
setDescriptionLoadding(project, des);
|
setDescriptionLoadding(project, des);
|
||||||
|
des.setLoadding(true);
|
||||||
} else {
|
} else {
|
||||||
ownerId = null;
|
ownerId = null;
|
||||||
des = null;
|
des = null;
|
||||||
|
@ -584,10 +586,13 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
des = new CProjectDescription(des, true, el);
|
des = new CProjectDescription(des, true, el);
|
||||||
setDescriptionApplying(project, des);
|
try {
|
||||||
des.applyDatas();
|
setDescriptionApplying(project, des);
|
||||||
des.doneApplying();
|
des.applyDatas();
|
||||||
clearDescriptionApplying(project);
|
des.doneApplying();
|
||||||
|
} finally {
|
||||||
|
clearDescriptionApplying(project);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
((InternalXmlStorageElement)des.getRootStorageElement()).setReadOnly(true);
|
((InternalXmlStorageElement)des.getRootStorageElement()).setReadOnly(true);
|
||||||
|
@ -595,7 +600,9 @@ public class CProjectDescriptionManager implements ICProjectDescriptionManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}finally{
|
}finally{
|
||||||
clearDescriptionLoadding(project);
|
CProjectDescription d = clearDescriptionLoadding(project);
|
||||||
|
if(d != null)
|
||||||
|
d.setLoadding(false);
|
||||||
}
|
}
|
||||||
return des;
|
return des;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue