mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
bug 206372: [Scanner Discovery] Include path discovery doesn't discard obsolete paths on compiler upgrade
This commit is contained in:
parent
f0ff969691
commit
be678f1ff4
2 changed files with 85 additions and 0 deletions
|
@ -31,7 +31,12 @@ import org.eclipse.cdt.core.settings.model.util.CDataUtil;
|
||||||
import org.eclipse.cdt.make.core.MakeCorePlugin;
|
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.IScannerInfoCollector;
|
||||||
|
import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
|
||||||
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
|
||||||
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
|
||||||
import org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage;
|
import org.eclipse.cdt.make.ui.dialogs.AbstractDiscoveryPage;
|
||||||
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
|
||||||
|
@ -42,6 +47,7 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
import org.eclipse.cdt.ui.newui.CDTPrefUtil;
|
||||||
import org.eclipse.cdt.ui.newui.UIMessages;
|
import org.eclipse.cdt.ui.newui.UIMessages;
|
||||||
|
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
|
||||||
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
import org.eclipse.cdt.utils.ui.controls.TabFolderLayout;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -52,6 +58,7 @@ import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -63,6 +70,7 @@ import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Group;
|
import org.eclipse.swt.widgets.Group;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Table;
|
import org.eclipse.swt.widgets.Table;
|
||||||
import org.eclipse.swt.widgets.TableItem;
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
|
||||||
|
@ -221,6 +229,31 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
handleDiscoveryProfileChanged();
|
handleDiscoveryProfileChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// "Clear" label
|
||||||
|
@SuppressWarnings("unused")
|
||||||
|
Label clearLabel = ControlFactory.createLabel(autoDiscoveryGroup, Messages.getString("DiscoveryTab.ClearDisoveredEntries")); //$NON-NLS-1$
|
||||||
|
|
||||||
|
// "Clear" button
|
||||||
|
Button clearButton = ControlFactory.createPushButton(autoDiscoveryGroup, Messages.getString("DiscoveryTab.Clear")); //$NON-NLS-1$
|
||||||
|
GridData gd = (GridData) clearButton.getLayoutData();
|
||||||
|
gd.grabExcessHorizontalSpace = false;
|
||||||
|
gd.widthHint = 80;
|
||||||
|
gd.horizontalAlignment = SWT.RIGHT;
|
||||||
|
|
||||||
|
final Shell shell = parent.getShell();
|
||||||
|
clearButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent event) {
|
||||||
|
String title = Messages.getString("DiscoveryTab.ClearEntries"); //$NON-NLS-1$
|
||||||
|
try {
|
||||||
|
clearDiscoveredEntries();
|
||||||
|
MessageDialog.openInformation(shell, title, Messages.getString("DiscoveryTab.DiscoveredEntriesCleared")); //$NON-NLS-1$
|
||||||
|
} catch (CoreException e) {
|
||||||
|
MessageDialog.openError(shell, title, Messages.getString("DiscoveryTab.ErrorClearingEntries") + e.getLocalizedMessage()); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enableAllControls() {
|
private void enableAllControls() {
|
||||||
|
@ -737,4 +770,47 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
|
||||||
protected void updateButtons() {
|
protected void updateButtons() {
|
||||||
// Do nothing. No buttons to update.
|
// Do nothing. No buttons to update.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void clearDiscoveredEntries() throws CoreException {
|
||||||
|
CfgInfoContext cfgInfoContext = getContext();
|
||||||
|
|
||||||
|
IConfiguration cfg = cfgInfoContext.getConfiguration();
|
||||||
|
if (cfg==null) {
|
||||||
|
cfg = cfgInfoContext.getResourceInfo().getParent();
|
||||||
|
}
|
||||||
|
if (cfg==null) {
|
||||||
|
Status status = new Status(IStatus.ERROR, ManagedBuilderUIPlugin.getUniqueIdentifier(),
|
||||||
|
"Unexpected cfg=null while trying to clear discovery entries"); //$NON-NLS-1$
|
||||||
|
throw new CoreException(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
IProject project = (IProject) cfg.getOwner();
|
||||||
|
|
||||||
|
DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
|
||||||
|
InfoContext infoContext = cfgInfoContext.toInfoContext();
|
||||||
|
|
||||||
|
// 1. Remove scanner info from .metadata/.plugins/org.eclipse.cdt.make.core/Project.sc
|
||||||
|
DiscoveredScannerInfoStore dsiStore = DiscoveredScannerInfoStore.getInstance();
|
||||||
|
dsiStore.saveDiscoveredScannerInfoToState(project, infoContext, pathInfo);
|
||||||
|
|
||||||
|
// 2. Remove scanner info from CfgDiscoveredPathManager cache and from the Tool
|
||||||
|
CfgDiscoveredPathManager cdpManager = CfgDiscoveredPathManager.getInstance();
|
||||||
|
cdpManager.removeDiscoveredInfo(project, cfgInfoContext);
|
||||||
|
|
||||||
|
// 3. Remove scanner info from SI collector
|
||||||
|
ICfgScannerConfigBuilderInfo2Set info2 = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(cfg);
|
||||||
|
Map<CfgInfoContext, IScannerConfigBuilderInfo2> infoMap2 = info2.getInfoMap();
|
||||||
|
IScannerConfigBuilderInfo2 buildInfo2 = infoMap2.get(cfgInfoContext);
|
||||||
|
if (buildInfo2!=null) {
|
||||||
|
ScannerConfigProfileManager scpManager = ScannerConfigProfileManager.getInstance();
|
||||||
|
String selectedProfileId = buildInfo2.getSelectedProfileId();
|
||||||
|
SCProfileInstance profileInstance = scpManager.getSCProfileInstance(project, infoContext, selectedProfileId);
|
||||||
|
|
||||||
|
IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
|
||||||
|
if (collector instanceof IScannerInfoCollectorCleaner) {
|
||||||
|
((IScannerInfoCollectorCleaner) collector).deleteAll(project);
|
||||||
|
}
|
||||||
|
buildInfo2 = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,6 +53,11 @@ DiscoveryTab.5=Tools:
|
||||||
DiscoveryTab.6=No profiles found
|
DiscoveryTab.6=No profiles found
|
||||||
DiscoveryTab.7=InfoContexts are different \!
|
DiscoveryTab.7=InfoContexts are different \!
|
||||||
DiscoveryTab.8=Configuration:
|
DiscoveryTab.8=Configuration:
|
||||||
|
DiscoveryTab.Clear=Clear
|
||||||
|
DiscoveryTab.ClearDisoveredEntries=Clear discovered entries now:
|
||||||
|
DiscoveryTab.ClearEntries=Clear entries
|
||||||
|
DiscoveryTab.DiscoveredEntriesCleared=Discovered entries cleared. Scanner discovery will re-aquire the settings when run (normally during the build).
|
||||||
|
DiscoveryTab.ErrorClearingEntries=Error clearing entries:
|
||||||
ToolSelectionDialog.0=Select tools
|
ToolSelectionDialog.0=Select tools
|
||||||
ToolSelectionDialog.1=Available tools
|
ToolSelectionDialog.1=Available tools
|
||||||
ToolSelectionDialog.2=Used tools
|
ToolSelectionDialog.2=Used tools
|
||||||
|
@ -99,6 +104,10 @@ PreferredToolchainsTab.2=Make toolchain(s) not preferred
|
||||||
PreferredToolchainsTab.3=Preferred toolchain(s):
|
PreferredToolchainsTab.3=Preferred toolchain(s):
|
||||||
ToolSettingsTab.0=Hover over an option to display its tooltip
|
ToolSettingsTab.0=Hover over an option to display its tooltip
|
||||||
BuildOptionSettingsUI.0=No tooltip is available for this option
|
BuildOptionSettingsUI.0=No tooltip is available for this option
|
||||||
|
ScannerConfigOptionsDialog.scGroup.enabled.button=
|
||||||
|
ScannerConfigOptionsDialog.scGroup.label=
|
||||||
|
ScannerConfigOptionsDialog.scGroup.problemReporting.enabled.button=
|
||||||
|
ScannerConfigOptionsDialog.scGroup.selectedProfile.combo=
|
||||||
StdProjectTypeHandler.0=-- Other Toolchain --
|
StdProjectTypeHandler.0=-- Other Toolchain --
|
||||||
StdProjectTypeHandler.2=Default
|
StdProjectTypeHandler.2=Default
|
||||||
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
StdProjectTypeHandler.3=creation Make project: IBuilder is null
|
||||||
|
|
Loading…
Add table
Reference in a new issue