1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00
This commit is contained in:
Andrew Gvozdev 2012-05-04 19:53:16 -04:00
parent 56f5df2f68
commit 2949c7da2f
12 changed files with 2615 additions and 2613 deletions

View file

@ -307,9 +307,9 @@
fileVersion="4.0.0">
</managedBuildRevision>
<configuration
id="org.eclipse.cdt.build.core.emptycfg"
id="org.eclipse.cdt.build.core.emptycfg"
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;${Toolchain}"
name="%cfg1_empty">
name="%cfg1_empty">
</configuration>
<configuration

View file

@ -38,7 +38,7 @@ public class CfgScannerConfigUtil {
IInputType inType = context.getInputType();
boolean adjust = false;
CfgInfoContext newContext = context;
if(tool != null){
if(inType != null){
if(!tool.hasScannerConfigSettings(inType)){
@ -59,10 +59,10 @@ public class CfgScannerConfigUtil {
inType = null;
adjust = true;
}
if(rcInfo != null){
ToolChain tc = getToolChain(rcInfo);
if(tc != null){
if(!tc.hasScannerConfigSettings()){
adjust = true;
@ -85,23 +85,23 @@ public class CfgScannerConfigUtil {
// 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 ?
return rcInfo instanceof FolderInfo ?
(ToolChain)((FolderInfo)rcInfo).getToolChain()
: (ToolChain)((ResourceConfiguration)rcInfo).getBaseToolChain();
}
public static String getDefaultProfileId(CfgInfoContext context, boolean searchFirstIfNone){
String id = null;
if(context.getInputType() != null)
@ -116,19 +116,19 @@ public class CfgScannerConfigUtil {
if(id == null){
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);
@ -142,25 +142,26 @@ public class CfgScannerConfigUtil {
if(id != null)
break;
}
return id;
}
/**
* Search for toolchain's discovery profiles. Discovery profiles could be
* specified on toolchain level, input types level or in their super-classes.
*
*
* @param toolchain - toolchain to search for scanner discovery profiles.
* @return all available discovery profiles in given toolchain
*/
public static Set<String> getAllScannerDiscoveryProfileIds(IToolChain toolchain) {
Assert.isNotNull(toolchain);
Set<String> profiles = new TreeSet<String>();
if (toolchain!=null) {
String toolchainProfileId = null;
if (toolchain instanceof ToolChain) {
// still allow a user a choice to select any legacy profiles
toolchainProfileId = ((ToolChain) toolchain).getLegacyScannerConfigDiscoveryProfileId();
} else {
toolchainProfileId = toolchain.getScannerConfigDiscoveryProfileId();
@ -177,15 +178,15 @@ public class CfgScannerConfigUtil {
profiles.addAll(getAllScannerDiscoveryProfileIds(superClass));
}
}
return profiles;
}
/**
* Search for tool's discovery profiles. Discovery profiles could be retrieved
* from tool/input type super-class. Input type could hold list of profiles
* separated by pipe character '|'.
*
*
* @param tool - tool to search for scanner discovery profiles
* @return all available discovery profiles in given configuration
*/
@ -197,39 +198,39 @@ public class CfgScannerConfigUtil {
new Object[] { Tool.class.getName() });
throw new UnsupportedOperationException(msg);
}
Set<String> profiles = new TreeSet<String>();
for (IInputType inputType : ((Tool) tool).getAllInputTypes()) {
for (String profileId : getAllScannerDiscoveryProfileIds(inputType)) {
profiles.add(profileId);
}
}
ITool superClass = tool.getSuperClass();
if (superClass!=null) {
profiles.addAll(getAllScannerDiscoveryProfileIds(superClass));
}
return profiles;
}
/**
* Search for input type's discovery profiles. Discovery profiles could be specified
* on input type super-class. Input type could hold list of profiles
* separated by pipe character '|'.
*
*
* @param inputType - input type to search for scanner discovery profiles
* @return all available discovery profiles in given configuration
*/
private static Set<String> getAllScannerDiscoveryProfileIds(IInputType inputType) {
Assert.isNotNull(inputType);
if ( ! (inputType instanceof InputType) ) {
String msg = MessageFormat.format(ManagedMakeMessages.getString("CfgScannerConfigUtil_ErrorNotSupported"), //$NON-NLS-1$
new Object[] { InputType.class.getName() });
throw new UnsupportedOperationException(msg);
}
Set<String> profiles = new TreeSet<String>();
String attribute = ((InputType) inputType).getLegacyDiscoveryProfileIdAttribute();

View file

@ -47,7 +47,7 @@ public interface IConfiguration extends IBuildObject, IBuildObjectPropertiesCont
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
/** @since 8.1 */
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$
public static final String EXTENSION = "artifactExtension"; //$NON-NLS-1$
public static final String PARENT = "parent"; //$NON-NLS-1$

View file

@ -54,7 +54,7 @@ public interface IToolChain extends IBuildObject, IHoldsOptions {
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
/** @since 8.1 */
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders";
public static final String LANGUAGE_SETTINGS_PROVIDERS = "languageSettingsProviders"; //$NON-NLS-1$
/**
* Returns the configuration that is the parent of this tool-chain.

View file

@ -786,7 +786,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// Get the semicolon separated list of IDs of the error parsers
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(ERROR_PARSERS));
// Get the initial/default language setttings providers IDs
// Get the initial/default language settings providers IDs
defaultLanguageSettingsProvidersAttribute = SafeStringInterner.safeIntern(element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS));
// Get the artifact extension
@ -1475,7 +1475,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/**
* {@inheritDoc}
*
*
* This function will try to find default provider Ids specified in this instance.
* It none defined, it will try to pull Ids from the parent configuration.
*/

View file

@ -1842,9 +1842,9 @@ public class InputType extends BuildObject implements IInputType {
}
/**
* Temporary method to support compatibility during SD transition.
* Check if legacy scanner discovery method should be used.
*/
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
private boolean isLegacyScannerDiscovery() {
boolean isLanguageSettingsProvidersEnabled = false;
ITool tool = getParent();
if (tool!=null) {
@ -1860,14 +1860,14 @@ public class InputType extends BuildObject implements IInputType {
}
}
}
return isLanguageSettingsProvidersEnabled;
return !isLanguageSettingsProvidersEnabled;
}
/**
* Temporary method to support compatibility during SD transition.
* @noreference This method is not intended to be referenced by clients.
*/
public String getLegacyDiscoveryProfileIdAttribute(){
public String getLegacyDiscoveryProfileIdAttribute() {
String profileId = buildInfoDicsoveryProfileId;
if (profileId == null) {
profileId = ScannerDiscoveryLegacySupport.getDeprecatedLegacyProfiles(id);
@ -1878,19 +1878,21 @@ public class InputType extends BuildObject implements IInputType {
return profileId;
}
public String getDiscoveryProfileIdAttribute(){
if (!isLanguageSettingsProvidersFunctionalityEnabled())
public String getDiscoveryProfileIdAttribute() {
if (isLegacyScannerDiscovery()) {
return getLegacyDiscoveryProfileIdAttribute();
}
return getDiscoveryProfileIdAttributeInternal();
}
/**
* Method extracted temporarily to support compatibility during SD transition.
* Do not inline! This method needs to call itself recursively.
*/
private String getDiscoveryProfileIdAttributeInternal(){
if(buildInfoDicsoveryProfileId == null && superClass instanceof InputType)
private String getDiscoveryProfileIdAttributeInternal() {
if (buildInfoDicsoveryProfileId == null && superClass instanceof InputType) {
return ((InputType)superClass).getDiscoveryProfileIdAttributeInternal();
}
return buildInfoDicsoveryProfileId;
}

View file

@ -442,7 +442,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
@Override
public String[] getDefaultLanguageSettingsProviderIds() {
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode");
ManagedBuilderCorePlugin.error("Default Language Settings Providers are not supported in multiconfiguration mode"); //$NON-NLS-1$
return null;
}

View file

@ -558,7 +558,7 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
// Get the target tool id
targetToolIds = SafeStringInterner.safeIntern(element.getAttribute(TARGET_TOOL));
// Get the initial/default language setttings providers IDs
// Get the initial/default language settings providers IDs
defaultLanguageSettingsProviderIds = element.getAttribute(LANGUAGE_SETTINGS_PROVIDERS);
// Get the scanner config discovery profile id
@ -1545,9 +1545,9 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
}
/**
* Temporary method to support compatibility during SD transition.
* Check if legacy scanner discovery method should be used.
*/
private boolean isLanguageSettingsProvidersFunctionalityEnabled() {
private boolean isLegacyScannerDiscovery() {
boolean isLanguageSettingsProvidersEnabled = false;
IConfiguration cfg = getParent();
if (cfg != null) {
@ -1557,13 +1557,13 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
isLanguageSettingsProvidersEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project);
}
}
return isLanguageSettingsProvidersEnabled;
return !isLanguageSettingsProvidersEnabled;
}
/**
* Temporary method to support compatibility during SD transition.
* Get list of scanner discovery profiles supported by previous version.
* @see ScannerDiscoveryLegacySupport#getDeprecatedLegacyProfiles(String)
*
*
* @noreference This method is not intended to be referenced by clients.
*/
public String getLegacyScannerConfigDiscoveryProfileId() {
@ -1580,21 +1580,17 @@ public class ToolChain extends HoldsOptions implements IToolChain, IMatchKeyProv
return profileId;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.cdt.managedbuilder.core.IToolChain#getScannerConfigDiscoveryProfileId()
*/
@Override
public String getScannerConfigDiscoveryProfileId() {
if (!isLanguageSettingsProvidersFunctionalityEnabled())
if (isLegacyScannerDiscovery()) {
return getLegacyScannerConfigDiscoveryProfileId();
}
return getScannerConfigDiscoveryProfileIdInternal();
}
/**
* Method extracted temporarily to support compatibility during SD transition.
* Do not inline! This method needs to call itself recursively.
*/
private String getScannerConfigDiscoveryProfileIdInternal() {
if (scannerConfigDiscoveryProfileId == null && superClass instanceof ToolChain) {

View file

@ -100,8 +100,8 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
String bPath = b.getDefaultBuildPath();
b.setBuildPathAttribute(bPath);
}
// cfg.setConfigurationDescription(des);
// ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_APPLY);
// cfg.setConfigurationDescription(des);
// ManagedBuildManager.performValueHandlerEvent(cfg, IManagedOptionValueHandler.EVENT_APPLY);
cfg.serialize(cfgElemen);
return appliedCfg;
@ -129,7 +129,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
CConfigurationData base,
IModificationContext context,
IProgressMonitor monitor)
throws CoreException {
throws CoreException {
if(cfgDescription.isPreferenceConfiguration())
return applyPreferences(cfgDescription, base);
@ -178,14 +178,14 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
protected CConfigurationData createPreferences(
ICConfigurationDescription cfgDescription, CConfigurationData base)
throws CoreException {
throws CoreException {
Configuration cfg = (Configuration)((BuildConfigurationData)base).getConfiguration();
Configuration newCfg = new Configuration((ManagedProject)cfg.getManagedProject(), cfg, cfgDescription.getId(), true, true, true);
newCfg.setConfigurationDescription(cfgDescription);
newCfg.setName(cfgDescription.getName());
// if(!newCfg.getId().equals(cfg.getId())){
// newCfg.exportArtifactInfo();
// }
// if(!newCfg.getId().equals(cfg.getId())){
// newCfg.exportArtifactInfo();
// }
return newCfg.getConfigurationData();
}
@ -197,7 +197,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
ICConfigurationDescription baseCfgDescription,
CConfigurationData base, boolean clone,
IProgressMonitor monitor)
throws CoreException {
throws CoreException {
if(cfgDescription.isPreferenceConfiguration())
return createPreferences(cfgDescription, base);
@ -229,9 +229,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
ManagedBuildManager.performValueHandlerEvent(newCfg, IManagedOptionValueHandler.EVENT_OPEN);
// if(!newCfg.getId().equals(cfg.getId())){
// newCfg.exportArtifactInfo();
// }
// if(!newCfg.getId().equals(cfg.getId())){
// newCfg.exportArtifactInfo();
// }
return newCfg;
}
@ -337,7 +337,7 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
}
protected CConfigurationData loadPreferences(ICConfigurationDescription cfgDescription)
throws CoreException {
throws CoreException {
Configuration cfg = load(cfgDescription, null, true);
@ -496,7 +496,9 @@ public class ConfigurationDataProvider extends CConfigurationDataProvider implem
}
@Override
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription, IProgressMonitor monitor) throws CoreException {
public CConfigurationData loadConfiguration(ICConfigurationDescription cfgDescription,
IProgressMonitor monitor)
throws CoreException {
if(cfgDescription.isPreferenceConfiguration())
return loadPreferences(cfgDescription);

View file

@ -1702,10 +1702,10 @@
</builder>
<toolChain
archList="all"
archList="all"
id="cdt.managedbuild.toolchain.gnu.base"
languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
name="%ToolChainName.Linux"
name="%ToolChainName.Linux"
osList="linux,hpux,aix,qnx"
targetTool="cdt.managedbuild.tool.gnu.c.linker;cdt.managedbuild.tool.gnu.cpp.linker;cdt.managedbuild.tool.gnu.archiver">
<targetPlatform
@ -2481,27 +2481,27 @@
</projectType>
<configuration
artifactExtension="exe"
artifactExtension="exe"
cleanCommand="rm -rf"
id="cdt.managedbuild.config.gnu.cygwin.base"
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser">
<enablement type="CONTAINER_ATTRIBUTE"
attribute="artifactExtension"
value="dll"
extensionAdjustment="false">
<checkBuildProperty
property="org.eclipse.cdt.build.core.buildArtefactType"
value="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE"
attribute="artifactExtension"
value="a"
extensionAdjustment="false">
<checkBuildProperty
property="org.eclipse.cdt.build.core.buildArtefactType"
value="org.eclipse.cdt.build.core.buildArtefactType.staticLib"/>
</enablement>
</configuration>
<enablement type="CONTAINER_ATTRIBUTE"
attribute="artifactExtension"
value="dll"
extensionAdjustment="false">
<checkBuildProperty
property="org.eclipse.cdt.build.core.buildArtefactType"
value="org.eclipse.cdt.build.core.buildArtefactType.sharedLib"/>
</enablement>
<enablement type="CONTAINER_ATTRIBUTE"
attribute="artifactExtension"
value="a"
extensionAdjustment="false">
<checkBuildProperty
property="org.eclipse.cdt.build.core.buildArtefactType"
value="org.eclipse.cdt.build.core.buildArtefactType.staticLib"/>
</enablement>
</configuration>
<projectType
buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe"
@ -2879,7 +2879,7 @@
</projectType>
<configuration
artifactExtension="exe"
artifactExtension="exe"
cleanCommand="rm -rf"
id="cdt.managedbuild.config.gnu.mingw.base"
languageSettingsProviders="org.eclipse.cdt.ui.UserLanguageSettingsProvider;org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider;${Toolchain};-org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser">

View file

@ -125,10 +125,10 @@ public class CDTPrefUtil {
/**
* Returns string list display mode for multi-configuration edits (conjunction/disjunction).
*
*
* @return the mode which can be either {@link CDTPrefUtil#DMODE_CONJUNCTION} (default value)
* or else {@link CDTPrefUtil#DMODE_DISJUNCTION}.
*
*
* @since 5.3
*/
public static int getMultiCfgStringListDisplayMode() {
@ -141,10 +141,10 @@ public class CDTPrefUtil {
/**
* Sets string list display mode for multi-configuration edits (conjunction/disjunction).
*
*
* @param mode must be either {@link CDTPrefUtil#DMODE_CONJUNCTION}
* or {@link CDTPrefUtil#DMODE_DISJUNCTION}.
*
*
* @since 5.3
*/
public static void setMultiCfgStringListDisplayMode(int mode) {
@ -153,10 +153,10 @@ public class CDTPrefUtil {
/**
* Returns string list write mode for multi-configuration edits (modify/replace).
*
*
* @return the mode which can be either {@link CDTPrefUtil#WMODE_MODIFY} (default value)
* or else {@link CDTPrefUtil#WMODE_REPLACE}.
*
*
* @since 5.3
*/
public static int getMultiCfgStringListWriteMode() {
@ -169,10 +169,10 @@ public class CDTPrefUtil {
/**
* Sets string list write mode for multi-configuration edits (modify/replace).
*
*
* @param mode must be either {@link CDTPrefUtil#WMODE_MODIFY}
* or {@link CDTPrefUtil#WMODE_REPLACE}.
*
*
* @since 5.3
*/
public static void setMultiCfgStringListWriteMode(int mode) {
@ -256,25 +256,23 @@ public class CDTPrefUtil {
/**
* Utility method forms string list
* according to current list display mode
*
*
* @param input - array of string arrays
* @return
*/
private static final Object[] getListForDisplay(Object[][] input, int mode, Comparator<Object> cmp) {
if (input == null || input.length == 0)
return EMPTY_ARRAY;
if (input.length == 1) {
return (input[0] == null) ?
EMPTY_ARRAY :
input[0];
return (input[0] == null) ? EMPTY_ARRAY : input[0];
}
Object[] s1 = input[0];
if (s1 == null ||
s1.length == 0)
if (s1 == null || s1.length == 0)
return EMPTY_ARRAY;
if (getMultiCfgStringListDisplayMode() == DMODE_CONJUNCTION)
{
if (getMultiCfgStringListDisplayMode() == DMODE_CONJUNCTION) {
ArrayList<Object> lst = new ArrayList<Object>();
for (int i=0; i<s1.length; i++) {
if (s1[i] == null)
@ -282,10 +280,12 @@ public class CDTPrefUtil {
boolean found = true;
for (int k = 1; k<input.length; k++) {
Object[] s2 = input[k];
if (s2 == null || s2.length == 0)
if (s2 == null || s2.length == 0) {
return EMPTY_ARRAY;
if (i == 0)
}
if (i == 0) {
Arrays.sort(s2, cmp);
}
if (Arrays.binarySearch(s2, s1[i], cmp) < 0) {
found = false;
break;
@ -299,11 +299,12 @@ public class CDTPrefUtil {
}
TreeSet<Object> lst = new TreeSet<Object>(cmp); // set, to avoid doubles
for (Object[] element : input) {
if (element == null ||
element.length == 0)
if (element == null || element.length == 0) {
continue;
for (Object element2 : element)
}
for (Object element2 : element) {
lst.add(element2);
}
}
s1 = lst.toArray();
Arrays.sort(s1, cmp);