mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-30 04:15:35 +02:00
Fix for [Bug 197685] CfgScannerConfigInfo should getContainer with proper profileId to make the default profile id picked up from the tool-chain
This commit is contained in:
parent
e0256faf6b
commit
128f34e967
2 changed files with 33 additions and 3 deletions
|
@ -13,6 +13,7 @@ package org.eclipse.cdt.build.internal.core.scannerconfig;
|
||||||
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
import org.eclipse.cdt.managedbuilder.core.IInputType;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
|
||||||
|
import org.eclipse.cdt.managedbuilder.core.ITool;
|
||||||
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.ResourceConfiguration;
|
||||||
|
@ -90,7 +91,7 @@ public class CfgScannerConfigUtil {
|
||||||
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getDefaultProfileId(CfgInfoContext context){
|
public static String getDefaultProfileId(CfgInfoContext context, boolean searchFirstIfNone){
|
||||||
String id = null;
|
String id = null;
|
||||||
if(context.getInputType() != null)
|
if(context.getInputType() != null)
|
||||||
id = context.getInputType().getDiscoveryProfileId(context.getTool());
|
id = context.getInputType().getDiscoveryProfileId(context.getTool());
|
||||||
|
@ -105,6 +106,32 @@ public class CfgScannerConfigUtil {
|
||||||
id = ((Configuration)context.getConfiguration()).getDiscoveryProfileId();
|
id = ((Configuration)context.getConfiguration()).getDiscoveryProfileId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(id == null && searchFirstIfNone){
|
||||||
|
id = getFirstProfileId(context.getConfiguration().getFilteredTools());
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFirstProfileId(ITool[] tools){
|
||||||
|
String id = null;
|
||||||
|
for(int i = 0; i < tools.length; i++){
|
||||||
|
ITool tool = tools[i];
|
||||||
|
IInputType[] types = tool.getInputTypes();
|
||||||
|
|
||||||
|
if(types.length != 0){
|
||||||
|
for(int k = 0; k < types.length; k++){
|
||||||
|
id = types[k].getDiscoveryProfileId(tool);
|
||||||
|
if(id != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
id = ((Tool)tool).getDiscoveryProfileId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(id != null)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,6 +136,9 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
|
|
||||||
if(info == null){
|
if(info == null){
|
||||||
String id = cfg.getDiscoveryProfileId();
|
String id = cfg.getDiscoveryProfileId();
|
||||||
|
if(id == null)
|
||||||
|
id = CfgScannerConfigUtil.getFirstProfileId(cfg.getFilteredTools());
|
||||||
|
|
||||||
IScannerConfigBuilderInfo2 prefInfo = null;
|
IScannerConfigBuilderInfo2 prefInfo = null;
|
||||||
if(!cfg.isPreference()){
|
if(!cfg.isPreference()){
|
||||||
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
IConfiguration prefCfg = ManagedBuildManager.getPreferenceConfiguration(false);
|
||||||
|
@ -183,7 +186,7 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
if(superContext != null && superContext.getResourceInfo() != null){
|
if(superContext != null && superContext.getResourceInfo() != null){
|
||||||
info = (IScannerConfigBuilderInfo2)configMap.get(superContext);
|
info = (IScannerConfigBuilderInfo2)configMap.get(superContext);
|
||||||
}
|
}
|
||||||
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
String id = CfgScannerConfigUtil.getDefaultProfileId(context, true);
|
||||||
InfoContext baseContext = context.toInfoContext();
|
InfoContext baseContext = context.toInfoContext();
|
||||||
if(info == null){
|
if(info == null){
|
||||||
if(id != null){
|
if(id != null){
|
||||||
|
@ -210,7 +213,7 @@ public class CfgScannerConfigInfoFactory2 {
|
||||||
if(context != null && context.getResourceInfo() != null){
|
if(context != null && context.getResourceInfo() != null){
|
||||||
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
IScannerConfigBuilderInfo2 info = (IScannerConfigBuilderInfo2)configMap.get(context);
|
||||||
if(info == null){
|
if(info == null){
|
||||||
String id = CfgScannerConfigUtil.getDefaultProfileId(context);
|
String id = CfgScannerConfigUtil.getDefaultProfileId(context, true);
|
||||||
InfoContext baseContext = context.toInfoContext();
|
InfoContext baseContext = context.toInfoContext();
|
||||||
if(id != null){
|
if(id != null){
|
||||||
info = container.createInfo(baseContext, id);
|
info = container.createInfo(baseContext, id);
|
||||||
|
|
Loading…
Add table
Reference in a new issue