mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-01 21:35:40 +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){
|
private PathInfo getCachedPathInfo(ContextInfo cInfo){
|
||||||
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
// ICfgScannerConfigBuilderInfo2Set cfgInfo = cInfo.fCfgInfo;
|
||||||
PathInfo info = getCachedPathInfo(cInfo, true, true);
|
PathInfo info = getCachedPathInfo(cInfo, true, true, false);
|
||||||
// boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
// boolean queryCfg = !cfgInfo.isPerRcTypeDiscovery();
|
||||||
// if(!queryCfg){
|
// if(!queryCfg){
|
||||||
// Tool tool = (Tool)context.getTool();
|
// Tool tool = (Tool)context.getTool();
|
||||||
|
@ -320,24 +320,42 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PathInfo getCachedPathInfo(ContextInfo cInfo, boolean queryParent, boolean clearIfInvalid){
|
private PathInfo removeCachedPathInfo(ContextInfo cInfo){
|
||||||
return getCachedPathInfo(cInfo, (Configuration)cInfo.fCacheContext.getConfiguration(), (Tool)cInfo.fCacheContext.getTool(), cInfo.fCacheContext.getInputType(), queryParent, clearIfInvalid);
|
// 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){
|
private PathInfo getCachedPathInfo(ContextInfo cInfo, boolean queryParent, boolean clearIfInvalid, boolean clear){
|
||||||
PathInfoCache infoCache = getPathInfoCache(cInfo, cfg, tool, inType, queryParent, clearIfInvalid);
|
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))
|
if(infoCache != null && isCacheValid(cInfo, infoCache))
|
||||||
return infoCache.fPathInfo;
|
return infoCache.fPathInfo;
|
||||||
return null;
|
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;
|
PathInfoCache info = null;
|
||||||
// boolean queryCfg = false;
|
// boolean queryCfg = false;
|
||||||
if(tool != null){
|
if(tool != null){
|
||||||
info = tool.getDiscoveredPathInfo(inType);
|
info = tool.getDiscoveredPathInfo(inType);
|
||||||
if(info != null){
|
if(info != null){
|
||||||
if(clearIfInvalid && !isCacheValid(cInfo, info)){
|
if(clear || (clearIfInvalid && !isCacheValid(cInfo, info))){
|
||||||
tool.clearDiscoveredPathInfo(inType);
|
tool.clearDiscoveredPathInfo(inType);
|
||||||
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
||||||
}
|
}
|
||||||
|
@ -354,18 +372,18 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(superInType != null){
|
if(superInType != null){
|
||||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, superInType, true, clearIfInvalid);
|
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, superInType, true, clearIfInvalid, clear);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, null, true, clearIfInvalid);
|
info = getPathInfoCache(cInfo, cfg, (Tool)superTool, null, true, clearIfInvalid, clear);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info = getPathInfoCache(cInfo, cfg, null, null, true, clearIfInvalid);
|
info = getPathInfoCache(cInfo, cfg, null, null, true, clearIfInvalid, clear);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
info = cfg.getDiscoveredPathInfo();
|
info = cfg.getDiscoveredPathInfo();
|
||||||
if(clearIfInvalid && !isCacheValid(cInfo, info)){
|
if(clear || (clearIfInvalid && !isCacheValid(cInfo, info))){
|
||||||
cfg.clearDiscoveredPathInfo();
|
cfg.clearDiscoveredPathInfo();
|
||||||
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
// fBaseMngr.removeDiscoveredInfo(cfg.getOwner().getProject(), cInfo.fLoadContext.toInfoContext());
|
||||||
}
|
}
|
||||||
|
@ -508,16 +526,14 @@ public class CfgDiscoveredPathManager implements IResourceChangeListener {
|
||||||
return oldInfo != null ? oldInfo.fPathInfo : null;
|
return oldInfo != null ? oldInfo.fPathInfo : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
public void removeDiscoveredInfo(IProject project, CfgInfoContext context) {
|
||||||
//// if(context == null)
|
// if(context == null)
|
||||||
//// context = ScannerConfigUtil.createContextForProject(project);
|
// context = ScannerConfigUtil.createContextForProject(project);
|
||||||
//
|
|
||||||
// context = adjustContext(context);
|
ContextInfo cInfo = getContextInfo(context);
|
||||||
//
|
|
||||||
// setCachedPathInfo(context, null);
|
removeCachedPathInfo(cInfo);
|
||||||
// fBaseMngr.removeDiscoveredInfo(project, context.toInfoContext());
|
|
||||||
//// if (info != null) {
|
fBaseMngr.removeDiscoveredInfo(project, cInfo.fLoadContext.toInfoContext());
|
||||||
//// fireUpdate(INFO_REMOVED, info);
|
}
|
||||||
//// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,11 +19,11 @@ 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.CfgDiscoveredPathManager;
|
||||||
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
import org.eclipse.cdt.core.settings.model.ICResourceDescription;
|
||||||
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
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.IScannerConfigBuilderInfo2;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2Set;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||||
|
@ -476,9 +476,11 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
|
|
||||||
private void clearChangedDiscoveredInfos(){
|
private void clearChangedDiscoveredInfos(){
|
||||||
List changedContexts = checkChanges();
|
List changedContexts = checkChanges();
|
||||||
|
IProject project = getProject();
|
||||||
for(int i = 0; i < changedContexts.size(); i++){
|
for(int i = 0; i < changedContexts.size(); i++){
|
||||||
InfoContext c = (InfoContext)changedContexts.get(i);
|
CfgInfoContext c = (CfgInfoContext)changedContexts.get(i);
|
||||||
MakeCorePlugin.getDefault().getDiscoveryManager().removeDiscoveredInfo(c.getProject(), c);
|
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);
|
IScannerConfigBuilderInfo2 old = (IScannerConfigBuilderInfo2)baseCopy.remove(c);
|
||||||
|
|
||||||
if(old == null){
|
if(old == null){
|
||||||
list.add(c);
|
list.add(cic);
|
||||||
} else if(!settingsEqual(changed, old)){
|
} else if(!settingsEqual(changed, old)){
|
||||||
list.add(c);
|
list.add(cic);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(baseCopy.size() != 0){
|
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;
|
return list;
|
||||||
|
|
Loading…
Add table
Reference in a new issue