mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 15:05:36 +02:00
Better backward compatibility support needed for [Bug 182821] ManagedBuildInfo.getIncludePaths() no longer returns default compiler path
This commit is contained in:
parent
4fc2c97265
commit
315771b3bf
3 changed files with 141 additions and 108 deletions
|
@ -44,9 +44,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
|
|||
import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFileData;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFolderData;
|
||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
||||
|
@ -247,7 +245,6 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void cache(ContextInfo cInfo, IRcSettingInfo rcSetting){
|
||||
CResourceData rcData = rcSetting.getResourceData();
|
||||
clearCache(rcData);
|
||||
|
@ -303,20 +300,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
}
|
||||
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
||||
PathInfo info = getCachedPathInfo(cInfo, true, true, false);
|
||||
// boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
// if(!queryCfg){
|
||||
// Tool tool = (Tool)context.getTool();
|
||||
// if(tool != null){
|
||||
// info = tool.getDiscoveredPathInfo(context.getInputType());
|
||||
// } else {
|
||||
// queryCfg = true;
|
||||
// }
|
||||
// }
|
||||
// if(queryCfg) {
|
||||
// info = ((Configuration)context.getConfiguration()).getDiscoveredPathInfo();
|
||||
// }
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -420,7 +404,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
contextInfo.fInitialContext = context;
|
||||
contextInfo.fCfgInfo = cfgInfo;
|
||||
if(isPerRcType){
|
||||
contextInfo.fLoadContext = adjustPerRcTypeContext(contextInfo.fInitialContext);
|
||||
contextInfo.fLoadContext = CfgScannerConfigUtil.adjustPerRcTypeContext(contextInfo.fInitialContext);
|
||||
contextInfo.fCacheContext = contextInfo.fLoadContext;
|
||||
contextInfo.fIsFerFileCache = false;
|
||||
contextInfo.fInfo = cfgInfo.getInfo(contextInfo.fLoadContext);
|
||||
|
@ -434,72 +418,6 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return contextInfo;
|
||||
}
|
||||
|
||||
private CfgInfoContext adjustPerRcTypeContext(CfgInfoContext context){
|
||||
Tool tool = (Tool)context.getTool();
|
||||
IResourceInfo rcInfo = context.getResourceInfo();
|
||||
IInputType inType = context.getInputType();
|
||||
boolean adjust = false;
|
||||
CfgInfoContext newContext = context;
|
||||
|
||||
if(tool != null){
|
||||
if(inType != null){
|
||||
if(!tool.hasScannerConfigSettings(inType)){
|
||||
// tool = null;
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
if(inType == null){
|
||||
if(!tool.hasScannerConfigSettings(null)){
|
||||
tool = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tool == null){
|
||||
if(inType != null){
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
|
||||
if(rcInfo != null){
|
||||
ToolChain tc = rcInfo instanceof FolderInfo ?
|
||||
(ToolChain)((FolderInfo)rcInfo).getToolChain()
|
||||
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
||||
|
||||
if(tc != null){
|
||||
if(!tc.hasScannerConfigSettings()){
|
||||
adjust = true;
|
||||
rcInfo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// if(tool != null){
|
||||
// tool = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(rcInfo != null){
|
||||
// rcInfo = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(inType != null){
|
||||
// inType = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(adjust){
|
||||
if(rcInfo == null)
|
||||
newContext = new CfgInfoContext(context.getConfiguration());
|
||||
else
|
||||
newContext = new CfgInfoContext(rcInfo, tool, inType);
|
||||
}
|
||||
|
||||
return newContext;
|
||||
}
|
||||
|
||||
private PathInfo setCachedPathInfo(ContextInfo cInfo, PathInfo info){
|
||||
CfgInfoContext cacheContext = cInfo.fCacheContext;
|
||||
return setCachedPathInfo(cInfo, (Configuration)cacheContext.getConfiguration(), (Tool)cacheContext.getTool(), cacheContext.getInputType(), info);
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*******************************************************************************
|
||||
* 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.build.internal.core.scannerconfig;
|
||||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ResourceConfiguration;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
|
||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
||||
|
||||
public class CfgScannerConfigUtil {
|
||||
public static CfgInfoContext adjustPerRcTypeContext(CfgInfoContext context){
|
||||
Tool tool = (Tool)context.getTool();
|
||||
IResourceInfo rcInfo = context.getResourceInfo();
|
||||
IInputType inType = context.getInputType();
|
||||
boolean adjust = false;
|
||||
CfgInfoContext newContext = context;
|
||||
|
||||
if(tool != null){
|
||||
if(inType != null){
|
||||
if(!tool.hasScannerConfigSettings(inType)){
|
||||
// tool = null;
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
if(inType == null){
|
||||
if(!tool.hasScannerConfigSettings(null)){
|
||||
tool = null;
|
||||
adjust = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(tool == null){
|
||||
if(inType != null){
|
||||
inType = null;
|
||||
adjust = true;
|
||||
}
|
||||
|
||||
if(rcInfo != null){
|
||||
ToolChain tc = getToolChain(rcInfo);
|
||||
|
||||
if(tc != null){
|
||||
if(!tc.hasScannerConfigSettings()){
|
||||
adjust = true;
|
||||
rcInfo = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// } else {
|
||||
// if(tool != null){
|
||||
// tool = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(rcInfo != null){
|
||||
// rcInfo = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// if(inType != null){
|
||||
// inType = null;
|
||||
// adjust = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
if(adjust){
|
||||
if(rcInfo == null)
|
||||
newContext = new CfgInfoContext(context.getConfiguration());
|
||||
else
|
||||
newContext = new CfgInfoContext(rcInfo, tool, inType);
|
||||
}
|
||||
|
||||
return newContext;
|
||||
}
|
||||
|
||||
private static ToolChain getToolChain(IResourceInfo rcInfo){
|
||||
return rcInfo instanceof FolderInfo ?
|
||||
(ToolChain)((FolderInfo)rcInfo).getToolChain()
|
||||
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
||||
}
|
||||
|
||||
public static String getDefaultProfileId(CfgInfoContext context){
|
||||
String id = null;
|
||||
if(context.getInputType() != null)
|
||||
id = context.getInputType().getDiscoveryProfileId(context.getTool());
|
||||
if(id == null && context.getTool() != null)
|
||||
id = ((Tool)context.getTool()).getDiscoveryProfileId();
|
||||
if(id == null && context.getResourceInfo() != null){
|
||||
ToolChain tCh = getToolChain(context.getResourceInfo());
|
||||
if(tCh != null)
|
||||
id = tCh.getScannerConfigDiscoveryProfileId();
|
||||
}
|
||||
if(id == null){
|
||||
id = ((Configuration)context.getConfiguration()).getDiscoveryProfileId();
|
||||
}
|
||||
|
||||
return id;
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@ import java.util.Map;
|
|||
|
||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig.CfgScannerConfigUtil;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
|
@ -173,45 +174,47 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
for(int t = 0; t < types.length; t++){
|
||||
InputType type = (InputType)types[t];
|
||||
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, type);
|
||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.remove(context);
|
||||
if(info == null && type.hasScannerConfigSettings()){
|
||||
InfoContext baseContext = context.toInfoContext();
|
||||
if(!type.isExtensionElement() && type.getSuperClass() != null){
|
||||
CfgInfoContext tmpCfgC = new CfgInfoContext(rcInfo, tool, type.getSuperClass());
|
||||
info = (IScannerConfigBuilderInfo2)configMap.get(tmpCfgC);
|
||||
if(info != null){
|
||||
info = container.createInfo(baseContext, info);
|
||||
context = CfgScannerConfigUtil.adjustPerRcTypeContext(context);
|
||||
if(context != null && context.getResourceInfo() != null){
|
||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||
if(info == null && !type.isExtensionElement() && type.getSuperClass() != null){
|
||||
CfgInfoContext superContext = new CfgInfoContext(rcInfo, tool, type.getSuperClass());
|
||||
superContext = CfgScannerConfigUtil.adjustPerRcTypeContext(superContext);
|
||||
if(superContext != null){
|
||||
info = (IScannerConfigBuilderInfo2)configMap.get(superContext);
|
||||
}
|
||||
}
|
||||
|
||||
if(info == null){
|
||||
String id = type.getDiscoveryProfileId(tool);
|
||||
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
||||
InfoContext baseContext = context.toInfoContext();
|
||||
if(id != null){
|
||||
info = container.createInfo(baseContext, id);
|
||||
} else {
|
||||
info = container.createInfo(baseContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(info != null){
|
||||
map.put(context, info);
|
||||
if(info != null){
|
||||
map.put(context, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, null);
|
||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||
if(info == null && tool.hasScannerConfigSettings(null)){
|
||||
String id = tool.getDiscoveryProfileId();
|
||||
InfoContext baseContext = context.toInfoContext();
|
||||
if(id != null){
|
||||
info = container.createInfo(baseContext, id);
|
||||
} else {
|
||||
info = container.createInfo(baseContext);
|
||||
context = CfgScannerConfigUtil.adjustPerRcTypeContext(context);
|
||||
if(context != null && context.getResourceInfo() != null){
|
||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||
if(info == null){
|
||||
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
||||
InfoContext baseContext = context.toInfoContext();
|
||||
if(id != null){
|
||||
info = container.createInfo(baseContext, id);
|
||||
} else {
|
||||
info = container.createInfo(baseContext);
|
||||
}
|
||||
}
|
||||
if(info != null){
|
||||
map.put(context, info);
|
||||
}
|
||||
}
|
||||
if(info != null){
|
||||
map.put(context, info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,6 +223,8 @@ public class CfgScannerConfigInfoFactory2 {
|
|||
if(!configMap.isEmpty()){
|
||||
for(Iterator iter = configMap.entrySet().iterator(); iter.hasNext();){
|
||||
Map.Entry entry = (Map.Entry)iter.next();
|
||||
if(map.containsKey(entry.getKey()))
|
||||
continue;
|
||||
CfgInfoContext c = (CfgInfoContext)entry.getKey();
|
||||
if(c.getResourceInfo() != null || c.getTool() != null || c.getInputType() != null){
|
||||
InfoContext baseC = c.toInfoContext();
|
||||
|
|
Loading…
Add table
Reference in a new issue