1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

clean-up legacy support

This commit is contained in:
Andrew Gvozdev 2012-04-10 18:50:16 -04:00
parent ee5fedb69c
commit a14ad44b67
8 changed files with 68 additions and 69 deletions

View file

@ -62,6 +62,11 @@ public class ScannerConfigBuilder extends ACBuilder {
// boolean autodiscoveryEnabled; // boolean autodiscoveryEnabled;
if(buildNewStyle(getProject(), monitor)) if(buildNewStyle(getProject(), monitor))
return getProject().getReferencedProjects(); return getProject().getReferencedProjects();
if (!ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
return getProject().getReferencedProjects();
}
boolean autodiscoveryEnabled2; boolean autodiscoveryEnabled2;
IScannerConfigBuilderInfo2 buildInfo2 = null; IScannerConfigBuilderInfo2 buildInfo2 = null;
try { try {
@ -77,11 +82,6 @@ public class ScannerConfigBuilder extends ACBuilder {
buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject()); buildInfo2 = ScannerConfigProfileManager.createScannerConfigBuildInfo2(getProject());
autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled(); autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
if (autodiscoveryEnabled2) {
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject());
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration();
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
}
if (autodiscoveryEnabled2) { if (autodiscoveryEnabled2) {
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
@ -135,26 +135,22 @@ public class ScannerConfigBuilder extends ACBuilder {
} }
protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){ protected boolean build(IProject project, InfoContext context, IScannerConfigBuilderInfo2 buildInfo2, IProgressMonitor monitor){
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled(); if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject())) {
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
if (autodiscoveryEnabled2) { if (autodiscoveryEnabled2) {
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(getProject()); monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
ICConfigurationDescription cfgDescription = prjDescription.getActiveConfiguration(); monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription); getProject().getName());
// get scanner info from all external providers
SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
// update and persist scanner configuration
SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 30));
return true;
} }
}
if (autodiscoveryEnabled2) { return false;
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
getProject().getName());
// get scanner info from all external providers
SCJobsUtil.getProviderScannerInfo(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 70));
// update and persist scanner configuration
SCJobsUtil.updateScannerConfiguration(getProject(), context, buildInfo2, new SubProgressMonitor(monitor, 30));
return true;
}
return false;
} }

View file

@ -183,12 +183,8 @@ public class DiscoveryOptionsBlock extends AbstractDiscoveryOptionsBlock {
((GridData)scEnabledButton.getLayoutData()).horizontalSpan = numColumns; ((GridData)scEnabledButton.getLayoutData()).horizontalSpan = numColumns;
((GridData)scEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true; ((GridData)scEnabledButton.getLayoutData()).grabExcessHorizontalSpace = true;
// VMIR* old projects will have discovery disabled by default // VMIR* old projects will have discovery disabled by default
boolean autodiscoveryEnabled2 = getBuildInfo().isAutoDiscoveryEnabled(); boolean autodiscoveryEnabled2 = getBuildInfo().isAutoDiscoveryEnabled() &&
if (autodiscoveryEnabled2) { ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(getProject());
ICProjectDescription projDesc = CoreModel.getDefault().getProjectDescription(getProject());
ICConfigurationDescription cfgDescription = projDesc.getActiveConfiguration();
autodiscoveryEnabled2 = ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription);
}
scEnabledButton.setSelection(needsSCNature ? false scEnabledButton.setSelection(needsSCNature ? false
: (autodiscoveryEnabled2 : (autodiscoveryEnabled2
&& !getBuildInfo().getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID))); && !getBuildInfo().getSelectedProfileId().equals(ScannerConfigProfileManager.NULL_PROFILE_ID)));

View file

@ -180,39 +180,40 @@ public class ScannerConfigBuilder extends ACBuilder {
public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{ public static SCProfileInstance build(CfgInfoContext context, IScannerConfigBuilderInfo2 buildInfo2, int flags, Properties env, IProgressMonitor monitor) throws CoreException{
IConfiguration cfg = context.getConfiguration(); IConfiguration cfg = context.getConfiguration();
IProject project = cfg.getOwner().getProject(); if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(ManagedBuildManager.getDescriptionForConfiguration(cfg))) {
boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled() && IProject project = cfg.getOwner().getProject();
ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(ManagedBuildManager.getDescriptionForConfiguration(cfg)); boolean autodiscoveryEnabled2 = buildInfo2.isAutoDiscoveryEnabled();
if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) { if (autodiscoveryEnabled2 || ((flags & FORCE_DISCOVERY) != 0)) {
monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$ monitor.beginTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder"), 100); //$NON-NLS-1$
monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$ monitor.subTask(MakeMessages.getString("ScannerConfigBuilder.Invoking_Builder") + //$NON-NLS-1$
project.getName()); project.getName());
if(env == null) if(env == null)
env = calcEnvironment(cfg); env = calcEnvironment(cfg);
// get scanner info from all external providers // get scanner info from all external providers
SCProfileInstance instance = ScannerConfigProfileManager.getInstance(). SCProfileInstance instance = ScannerConfigProfileManager.getInstance().
getSCProfileInstance(project, context.toInfoContext(), buildInfo2.getSelectedProfileId()); getSCProfileInstance(project, context.toInfoContext(), buildInfo2.getSelectedProfileId());
// if there are any providers call job to pull scanner info // if there are any providers call job to pull scanner info
if ((flags & SKIP_SI_DISCOVERY) == 0) { if ((flags & SKIP_SI_DISCOVERY) == 0) {
if ((instance == null) || !buildInfo2.getProviderIdList().isEmpty()) if ((instance == null) || !buildInfo2.getProviderIdList().isEmpty())
instance = CfgSCJobsUtil.getProviderScannerInfo(project, context, instance, buildInfo2, env, new SubProgressMonitor(monitor, 70)); instance = CfgSCJobsUtil.getProviderScannerInfo(project, context, instance, buildInfo2, env, new SubProgressMonitor(monitor, 70));
} }
// update and persist scanner configuration // update and persist scanner configuration
CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30)); CfgSCJobsUtil.updateScannerConfiguration(project, context, instance, buildInfo2, new SubProgressMonitor(monitor, 30));
// Remove the previous discovered path info to ensure it get's regenerated. // Remove the previous discovered path info to ensure it get's regenerated.
// TODO we should really only do this if the information has changed // TODO we should really only do this if the information has changed
CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false); CfgDiscoveredPathManager.getInstance().removeDiscoveredInfo(project, context, false);
if((flags & PERFORM_CORE_UPDATE) != 0) if((flags & PERFORM_CORE_UPDATE) != 0)
CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg}); CfgDiscoveredPathManager.getInstance().updateCoreSettings(project, new IConfiguration[]{cfg});
return instance; return instance;
} }
}
return null; return null;
} }

View file

@ -217,8 +217,8 @@ public class CfgScannerConfigInfoFactory2 {
if (id == null) { if (id == null) {
// Language Settings Providers are meant to replace legacy scanner discovery // Language Settings Providers are meant to replace legacy scanner discovery
// so do not try to find default profile // so do not try to find default profile
IProject project = cfg.getOwner().getProject(); ICConfigurationDescription cfgDescription = ManagedBuildManager.getDescriptionForConfiguration(cfg);
if (!ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(project)) { if (ScannerDiscoveryLegacySupport.isLegacyScannerDiscoveryOn(cfgDescription)) {
id = CfgScannerConfigUtil.getDefaultProfileId(context, true); id = CfgScannerConfigUtil.getDefaultProfileId(context, true);
} }
} }

View file

@ -165,6 +165,7 @@ public abstract class AbstractBuildCommandParser extends AbstractLanguageSetting
break; break;
} }
setSettingEntries(currentCfgDescription, rc, currentLanguageId, entries); setSettingEntries(currentCfgDescription, rc, currentLanguageId, entries);
// AG FIXME - temporary log to remove before CDT Juno release // AG FIXME - temporary log to remove before CDT Juno release

View file

@ -381,21 +381,14 @@ public abstract class AbstractBuiltinSpecsDetector extends AbstractLanguageSetti
} }
}; };
IProject ownerProject = null; IProject project = null;
if (currentCfgDescription != null) { if (currentCfgDescription != null) {
ICProjectDescription prjDescription = currentCfgDescription.getProjectDescription(); ICProjectDescription prjDescription = currentCfgDescription.getProjectDescription();
if (prjDescription != null) { if (prjDescription != null) {
ownerProject = prjDescription.getProject(); project = prjDescription.getProject();
} }
} }
ISchedulingRule rule = null; job.setRule(project);
if (ownerProject != null) {
rule = ownerProject.getFile(".settings/language.settings.xml");
}
if (rule == null) {
rule = ResourcesPlugin.getWorkspace().getRoot();
}
job.setRule(rule);
job.schedule(); job.schedule();
// AG FIXME - temporary log to remove before CDT Juno release // AG FIXME - temporary log to remove before CDT Juno release

View file

@ -17,6 +17,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.model.CoreModel;
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.internal.core.LocalProjectScope; import org.eclipse.cdt.internal.core.LocalProjectScope;
@ -119,6 +120,19 @@ public class ScannerDiscoveryLegacySupport {
return isLanguageSettingsProvidersFunctionalityEnabled(project) || isMbsLanguageSettingsProviderOn(cfgDescription); return isLanguageSettingsProvidersFunctionalityEnabled(project) || isMbsLanguageSettingsProviderOn(cfgDescription);
} }
/**
* @noreference This is internal helper method to support compatibility with previous versions
* which is not intended to be referenced by clients.
*/
public static boolean isLegacyScannerDiscoveryOn(IProject project) {
ICConfigurationDescription cfgDescription = null;
ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project);
if (prjDescription != null) {
cfgDescription = prjDescription.getActiveConfiguration();
}
return isLanguageSettingsProvidersFunctionalityEnabled(project) || isMbsLanguageSettingsProviderOn(cfgDescription);
}
/** /**
* Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility). * Return list containing MBS and User provider. Used to initialize for unaware tool-chains (backward compatibility).
*/ */

View file

@ -20,8 +20,6 @@ import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsEditabl
import org.eclipse.cdt.core.settings.model.ICSettingEntry; import org.eclipse.cdt.core.settings.model.ICSettingEntry;
import org.eclipse.cdt.managedbuilder.language.settings.providers.ToolchainBuiltinSpecsDetector; import org.eclipse.cdt.managedbuilder.language.settings.providers.ToolchainBuiltinSpecsDetector;
/** /**
* Language settings provider to detect built-in compiler settings for IBM XLC compiler. * Language settings provider to detect built-in compiler settings for IBM XLC compiler.
*/ */