mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 15:35:24 +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.core.ManagedBuilderCorePlugin;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
import org.eclipse.cdt.managedbuilder.internal.core.Configuration;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.FolderInfo;
|
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.Tool;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
|
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFileData;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFileData;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFolderData;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildFolderData;
|
||||||
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
import org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildLanguageData;
|
||||||
|
@ -247,7 +245,6 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void cache(ContextInfo cInfo, IRcSettingInfo rcSetting){
|
private void cache(ContextInfo cInfo, IRcSettingInfo rcSetting){
|
||||||
CResourceData rcData = rcSetting.getResourceData();
|
CResourceData rcData = rcSetting.getResourceData();
|
||||||
clearCache(rcData);
|
clearCache(rcData);
|
||||||
|
@ -303,20 +300,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
||||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
|
||||||
PathInfo info = getCachedPathInfo(cInfo, true, true, false);
|
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;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +404,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
contextInfo.fInitialContext = context;
|
contextInfo.fInitialContext = context;
|
||||||
contextInfo.fCfgInfo = cfgInfo;
|
contextInfo.fCfgInfo = cfgInfo;
|
||||||
if(isPerRcType){
|
if(isPerRcType){
|
||||||
contextInfo.fLoadContext = adjustPerRcTypeContext(contextInfo.fInitialContext);
|
contextInfo.fLoadContext = CfgScannerConfigUtil.adjustPerRcTypeContext(contextInfo.fInitialContext);
|
||||||
contextInfo.fCacheContext = contextInfo.fLoadContext;
|
contextInfo.fCacheContext = contextInfo.fLoadContext;
|
||||||
contextInfo.fIsFerFileCache = false;
|
contextInfo.fIsFerFileCache = false;
|
||||||
contextInfo.fInfo = cfgInfo.getInfo(contextInfo.fLoadContext);
|
contextInfo.fInfo = cfgInfo.getInfo(contextInfo.fLoadContext);
|
||||||
|
@ -434,72 +418,6 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
return contextInfo;
|
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){
|
private PathInfo setCachedPathInfo(ContextInfo cInfo, PathInfo info){
|
||||||
CfgInfoContext cacheContext = cInfo.fCacheContext;
|
CfgInfoContext cacheContext = cInfo.fCacheContext;
|
||||||
return setCachedPathInfo(cInfo, (Configuration)cacheContext.getConfiguration(), (Tool)cacheContext.getTool(), cacheContext.getInputType(), info);
|
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.CfgInfoContext;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
|
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.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
import org.eclipse.cdt.core.settings.model.ICProjectDescription;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||||
|
@ -173,36 +174,37 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
for(int t = 0; t < types.length; t++){
|
for(int t = 0; t < types.length; t++){
|
||||||
InputType type = (InputType)types[t];
|
InputType type = (InputType)types[t];
|
||||||
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, type);
|
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, type);
|
||||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.remove(context);
|
context = CfgScannerConfigUtil.adjustPerRcTypeContext(context);
|
||||||
if(info == null && type.hasScannerConfigSettings()){
|
if(context != null && context.getResourceInfo() != null){
|
||||||
InfoContext baseContext = context.toInfoContext();
|
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||||
if(!type.isExtensionElement() && type.getSuperClass() != null){
|
if(info == null && !type.isExtensionElement() && type.getSuperClass() != null){
|
||||||
CfgInfoContext tmpCfgC = new CfgInfoContext(rcInfo, tool, type.getSuperClass());
|
CfgInfoContext superContext = new CfgInfoContext(rcInfo, tool, type.getSuperClass());
|
||||||
info = (IScannerConfigBuilderInfo2)configMap.get(tmpCfgC);
|
superContext = CfgScannerConfigUtil.adjustPerRcTypeContext(superContext);
|
||||||
if(info != null){
|
if(superContext != null){
|
||||||
info = container.createInfo(baseContext, info);
|
info = (IScannerConfigBuilderInfo2)configMap.get(superContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(info == null){
|
if(info == null){
|
||||||
String id = type.getDiscoveryProfileId(tool);
|
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
||||||
|
InfoContext baseContext = context.toInfoContext();
|
||||||
if(id != null){
|
if(id != null){
|
||||||
info = container.createInfo(baseContext, id);
|
info = container.createInfo(baseContext, id);
|
||||||
} else {
|
} else {
|
||||||
info = container.createInfo(baseContext);
|
info = container.createInfo(baseContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(info != null){
|
if(info != null){
|
||||||
map.put(context, info);
|
map.put(context, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, null);
|
CfgInfoContext context = new CfgInfoContext(rcInfo, tool, null);
|
||||||
|
context = CfgScannerConfigUtil.adjustPerRcTypeContext(context);
|
||||||
|
if(context != null && context.getResourceInfo() != null){
|
||||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||||
if(info == null && tool.hasScannerConfigSettings(null)){
|
if(info == null){
|
||||||
String id = tool.getDiscoveryProfileId();
|
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
||||||
InfoContext baseContext = context.toInfoContext();
|
InfoContext baseContext = context.toInfoContext();
|
||||||
if(id != null){
|
if(id != null){
|
||||||
info = container.createInfo(baseContext, id);
|
info = container.createInfo(baseContext, id);
|
||||||
|
@ -216,10 +218,13 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!configMap.isEmpty()){
|
if(!configMap.isEmpty()){
|
||||||
for(Iterator iter = configMap.entrySet().iterator(); iter.hasNext();){
|
for(Iterator iter = configMap.entrySet().iterator(); iter.hasNext();){
|
||||||
Map.Entry entry = (Map.Entry)iter.next();
|
Map.Entry entry = (Map.Entry)iter.next();
|
||||||
|
if(map.containsKey(entry.getKey()))
|
||||||
|
continue;
|
||||||
CfgInfoContext c = (CfgInfoContext)entry.getKey();
|
CfgInfoContext c = (CfgInfoContext)entry.getKey();
|
||||||
if(c.getResourceInfo() != null || c.getTool() != null || c.getInputType() != null){
|
if(c.getResourceInfo() != null || c.getTool() != null || c.getInputType() != null){
|
||||||
InfoContext baseC = c.toInfoContext();
|
InfoContext baseC = c.toInfoContext();
|
||||||
|
|
Loading…
Add table
Reference in a new issue