mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Fix for the scanner discovery profile mechanism
This commit is contained in:
parent
b06161edc1
commit
9bb901a2bf
2 changed files with 53 additions and 29 deletions
|
@ -304,7 +304,7 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
||||
PathInfo info = getCachedPathInfo(cInfo, true, true);
|
||||
PathInfo info = getCachedPathInfo(cInfo, true, true, false);
|
||||
// boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||
// if(!queryCfg){
|
||||
// Tool tool = (Tool)context.getTool();
|
||||
|
@ -320,24 +320,42 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return info;
|
||||
}
|
||||
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo, boolean queryParent, boolean clearIfInvalid){
|
||||
return getCachedPathInfo(cInfo, (Configuration)cInfo.fCacheContext.getConfiguration(), (Tool)cInfo.fCacheContext.getTool(), cInfo.fCacheContext.getInputType(), queryParent, clearIfInvalid);
|
||||
private PathInfo removeCachedPathInfo(ContextInfo cInfo){
|
||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
||||
PathInfo info = getCachedPathInfo(cInfo, true, true, true);
|
||||
// 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;
|
||||
}
|
||||
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, boolean queryParent, boolean clearIfInvalid){
|
||||
PathInfoCache infoCache = getPathInfoCache(cInfo, cfg, tool, inType, queryParent, clearIfInvalid);
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo, boolean queryParent, boolean clearIfInvalid, boolean clear){
|
||||
return getCachedPathInfo(cInfo, (Configuration)cInfo.fCacheContext.getConfiguration(), (Tool)cInfo.fCacheContext.getTool(), cInfo.fCacheContext.getInputType(), queryParent, clearIfInvalid, clear);
|
||||
}
|
||||
|
||||
private PathInfo getCachedPathInfo(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, boolean queryParent, boolean clearIfInvalid, boolean clear){
|
||||
PathInfoCache infoCache = getPathInfoCache(cInfo, cfg, tool, inType, queryParent, clearIfInvalid, clear);
|
||||
if(infoCache != null && isCacheValid(cInfo, infoCache))
|
||||
return infoCache.fPathInfo;
|
||||
return null;
|
||||
}
|
||||
|
||||
private PathInfoCache getPathInfoCache(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, boolean queryParent, boolean clearIfInvalid){
|
||||
private PathInfoCache getPathInfoCache(ContextInfo cInfo, Configuration cfg, Tool tool, IInputType inType, boolean queryParent, boolean clearIfInvalid, boolean clear){
|
||||
PathInfoCache info = null;
|
||||
// boolean queryCfg = false;
|
||||
if(tool != null){
|
||||
info = tool.getDiscoveredPathInfo(inType);
|
||||
if(info != null){
|
||||
if(clearIfInvalid && !isCacheValid(cInfo, info)){
|
||||
if(clear || (clearIfInvalid && !isCacheValid(cInfo, info))){
|
||||
tool.clearDiscoveredPathInfo(inType);
|
||||
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
||||
}
|
||||
|
@ -354,18 +372,18 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
break;
|
||||
}
|
||||
if(superInType != null){
|
||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, superInType, true, clearIfInvalid);
|
||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, superInType, true, clearIfInvalid, clear);
|
||||
}
|
||||
} else {
|
||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, null, true, clearIfInvalid);
|
||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, null, true, clearIfInvalid, clear);
|
||||
}
|
||||
} else {
|
||||
info = getPathInfoCache(cInfo, cfg, null, null, true, clearIfInvalid);
|
||||
info = getPathInfoCache(cInfo, cfg, null, null, true, clearIfInvalid, clear);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
info = cfg.getDiscoveredPathInfo();
|
||||
if(clearIfInvalid && !isCacheValid(cInfo, info)){
|
||||
if(clear || (clearIfInvalid && !isCacheValid(cInfo, info))){
|
||||
cfg.clearDiscoveredPathInfo();
|
||||
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
||||
}
|
||||
|
@ -508,16 +526,14 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
|||
return oldInfo != null ? oldInfo.fPathInfo : null;
|
||||
}
|
||||
|
||||
// public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
||||
//// if(context == null)
|
||||
//// context = ScannerConfigUtil.createContextForProject(project);
|
||||
//
|
||||
// context = adjustContext(context);
|
||||
//
|
||||
// setCachedPathInfo(context, null);
|
||||
// fBaseMngr.removeDiscoveredInfo(project, context.toInfoContext());
|
||||
//// if (info != null) {
|
||||
//// fireUpdate(INFO_REMOVED, info);
|
||||
//// }
|
||||
// }
|
||||
public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
||||
// if(context == null)
|
||||
// context = ScannerConfigUtil.createContextForProject(project);
|
||||
|
||||
ContextInfo cInfo = getContextInfo(context);
|
||||
|
||||
removeCachedPathInfo(cInfo);
|
||||
|
||||
fBaseMngr.removeDiscoveredInfo(project, cInfo.fLoadContext.toInfoContext());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,11 @@ 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.CfgDiscoveredPathManager;
|
||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
|
||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||
|
@ -476,9 +476,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
|
||||
private void clearChangedDiscoveredInfos(){
|
||||
List changedContexts = checkChanges();
|
||||
IProject project = getProject();
|
||||
for(int i = 0; i < changedContexts.size(); i++){
|
||||
InfoContext c = (InfoContext)changedContexts.get(i);
|
||||
MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(c.getProject(), c);
|
||||
CfgInfoContext c = (CfgInfoContext)changedContexts.get(i);
|
||||
CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, c);
|
||||
// MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(c.getProject(), c);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,14 +502,20 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
|||
IScannerConfigBuilderInfo2 old = (IScannerConfigBuilderInfo2)baseCopy.remove(c);
|
||||
|
||||
if(old == null){
|
||||
list.add(c);
|
||||
list.add(cic);
|
||||
} else if(!settingsEqual(changed, old)){
|
||||
list.add(c);
|
||||
list.add(cic);
|
||||
}
|
||||
}
|
||||
|
||||
if(baseCopy.size() != 0){
|
||||
list.addAll(baseCopy.keySet());
|
||||
IConfiguration cfg = cbi.getConfiguration();
|
||||
for(Iterator iter = baseCopy.keySet().iterator(); iter.hasNext();){
|
||||
InfoContext c = (InfoContext)iter.next();
|
||||
CfgInfoContext cic = CfgInfoContext.fromInfoContext(cfg, c);
|
||||
if(cic != null)
|
||||
list.add(cic);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
|
|
Loading…
Add table
Reference in a new issue