Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2009-09-03 14:00:25 -0400
committerAndrew Gvozdev2009-09-03 14:00:25 -0400
commit6018a38286328d8177a7295cda2ffe618dc7ad2c (patch)
tree650652d1f29d2ace6febbd3f0ab4cae0389db0d2
parentdb47eeb81844785381c1c875eaa4385f80f99f49 (diff)
downloadorg.eclipse.cdt-6018a38286328d8177a7295cda2ffe618dc7ad2c.tar.gz
org.eclipse.cdt-6018a38286328d8177a7295cda2ffe618dc7ad2c.tar.xz
org.eclipse.cdt-6018a38286328d8177a7295cda2ffe618dc7ad2c.zip
bug 226419: [Scanner Discovery] "Other toolchain" projects attempt scanner config discovery
-rw-r--r--build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigDiscoveryTests.java12
-rw-r--r--build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigProfileTests.java2
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java6
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java7
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigProfileManager.java3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java50
6 files changed, 50 insertions, 30 deletions
diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigDiscoveryTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigDiscoveryTests.java
index e25d1e6785..5cea716921 100644
--- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigDiscoveryTests.java
+++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigDiscoveryTests.java
@@ -69,9 +69,9 @@ public class ScannerConfigDiscoveryTests extends BaseTestCase {
getScannerInformation(fCFile);
assertNotNull(scInfo);
String[] includes = scInfo.getIncludePaths();
- assertTrue(includes.length > 0);
- Map symbols = scInfo.getDefinedSymbols();
- assertFalse(symbols.isEmpty());
+ assertTrue(includes.length == 0);
+ Map<String, String> symbols = scInfo.getDefinedSymbols();
+ assertTrue(symbols.isEmpty());
}
public void testGetCCCompilerBuiltins() throws CoreException {
@@ -84,9 +84,9 @@ public class ScannerConfigDiscoveryTests extends BaseTestCase {
getScannerInformation(fCFile);
assertNotNull(scInfo);
String[] includes = scInfo.getIncludePaths();
- assertTrue(includes.length > 0);
- Map symbols = scInfo.getDefinedSymbols();
- assertFalse(symbols.isEmpty());
+ assertTrue(includes.length == 0);
+ Map<String, String> symbols = scInfo.getDefinedSymbols();
+ assertTrue(symbols.isEmpty());
}
}
diff --git a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigProfileTests.java b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigProfileTests.java
index 2eff825735..5411170ac4 100644
--- a/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigProfileTests.java
+++ b/build/org.eclipse.cdt.make.core.tests/src/org/eclipse/cdt/make/scannerdiscovery/ScannerConfigProfileTests.java
@@ -48,7 +48,7 @@ public class ScannerConfigProfileTests extends BaseTestCase {
*/
public void testBasicScannerConfigProfile() throws CoreException {
// Add a scanner config profile to the project
- IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fCProject, ScannerConfigProfileManager.DEFAULT_SI_PROFILE_ID);
+ IScannerConfigBuilderInfo2 scProjInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(fCProject, ScannerConfigProfileManager.PER_PROJECT_PROFILE_ID);
// Save
scProjInfo.save();
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
index a640408c78..4b67a08bd5 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig/DiscoveredPathInitializer.java
@@ -30,8 +30,12 @@ public class DiscoveredPathInitializer extends PathEntryContainerInitializer {
public void initialize(IPath containerPath, ICProject cProject) throws CoreException {
IProject project = cProject.getProject();
IScannerConfigBuilderInfo2 buildInfo = ScannerConfigProfileManager.createScannerConfigBuildInfo2(project);
+ String selectedProfileId = buildInfo.getSelectedProfileId();
+ if (ScannerConfigProfileManager.NULL_PROFILE_ID.equals(selectedProfileId))
+ return;
+
ScannerConfigScope profileScope = ScannerConfigProfileManager.getInstance().
- getSCProfileConfiguration(buildInfo.getSelectedProfileId()).getProfileScope();
+ getSCProfileConfiguration(selectedProfileId).getProfileScope();
if (ScannerConfigScope.PROJECT_SCOPE.equals(profileScope)) {
CoreModel.setPathEntryContainer(new ICProject[]{cProject}, new DiscoveredPathContainer(project), null);
}
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
index 8ccb4c7eee..9f7036eb2f 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/ScannerConfigProfileManager.java
@@ -35,8 +35,8 @@ import org.eclipse.core.runtime.Preferences;
public final class ScannerConfigProfileManager {
public static final String SI_PROFILE_SIMPLE_ID = "ScannerConfigurationDiscoveryProfile"; //$NON-NLS-1$
public static final String PER_PROJECT_PROFILE_ID = MakeCorePlugin.getUniqueIdentifier() + ".GCCStandardMakePerProjectProfile"; //$NON-NLS-1$
- public static final String DEFAULT_SI_PROFILE_ID = PER_PROJECT_PROFILE_ID;
- public static final String NULL_PROFILE_ID = "";//$NON-NLS-1$
+ public static final String NULL_PROFILE_ID = "";//$NON-NLS-1$
+ public static final String DEFAULT_SI_PROFILE_ID = NULL_PROFILE_ID;
private final Map<IProject, Map<InfoContext, Object>> projectToProfileInstanceMap;
private List<String> profileIds;
@@ -171,9 +171,8 @@ public final class ScannerConfigProfileManager {
}
/**
- * returns the list of profile IDs supported for this context
* @param context
- * @return
+ * @return the list of profile IDs supported for this context
*/
public List<String> getProfileIds(InfoContext context){
if(context.isDefaultContext() || context.getProject() == null)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigProfileManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigProfileManager.java
index 6061b6d12e..5b8bf3996e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigProfileManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/build/internal/core/scannerconfig2/CfgScannerConfigProfileManager.java
@@ -29,7 +29,8 @@ public class CfgScannerConfigProfileManager {
public static boolean isPerFileProfile(String profileId){
ScannerConfigProfile profile = ScannerConfigProfileManager.getInstance().getSCProfileConfiguration(profileId);
- return profile.getProfileScope().equals(ScannerConfigScope.FILE_SCOPE);
+ ScannerConfigScope scope = profile.getProfileScope();
+ return scope!=null && scope.equals(ScannerConfigScope.FILE_SCOPE);
}
public static InfoContext createDefaultContext(IProject project){
diff --git a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
index b019f46ab6..ee22002ccd 100644
--- a/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
+++ b/build/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/DiscoveryTab.java
@@ -33,6 +33,7 @@ import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IInputType;
import org.eclipse.cdt.managedbuilder.core.IResourceInfo;
import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.internal.core.InputType;
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.ui.CUIPlugin;
@@ -67,6 +68,7 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
@Deprecated
protected static final String PREFIX = "ScannerConfigOptionsDialog"; //$NON-NLS-1$
+ private static final String MAKEFILE_PROJECT_TOOLCHAIN_ID = "org.eclipse.cdt.build.core.prefbase.toolchain"; //$NON-NLS-1$
private static final String NAMESPACE = "org.eclipse.cdt.make.ui"; //$NON-NLS-1$
private static final String POINT = "DiscoveryProfilePage"; //$NON-NLS-1$
private static final String PROFILE_PAGE = "profilePage"; //$NON-NLS-1$
@@ -175,10 +177,14 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
autoDiscoveryCheckBox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- buildInfo.setAutoDiscoveryEnabled(autoDiscoveryCheckBox.getSelection());
enableAllControls();
- if (autoDiscoveryCheckBox.getSelection())
+ boolean isSCDEnabled = autoDiscoveryCheckBox.getSelection();
+ buildInfo.setAutoDiscoveryEnabled(isSCDEnabled);
+ if (isSCDEnabled) {
+ String id = visibleProfilesList.get(profileComboBox.getSelectionIndex());
+ buildInfo.setSelectedProfileId(id);
handleDiscoveryProfileChanged();
+ }
}
});
reportProblemsCheckBox = setupCheck(autoDiscoveryGroup,
@@ -319,6 +325,16 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
return false;
}
+ /**
+ * @param toolchain to check
+ * @return if this toolchain is a toolchain created by Makefile project "Other Toolchain".
+ * Note that name of this toolchain set to "No ToolChain" in plugin.xml.
+ */
+ private boolean isMakefileProjectToolChain(IToolChain toolchain) {
+ return toolchain!=null
+ && (toolchain.getId().equals(MAKEFILE_PROJECT_TOOLCHAIN_ID) || isMakefileProjectToolChain(toolchain.getSuperClass()));
+ }
+
private void handleToolSelected() {
if (resTable.getSelectionCount() == 0)
return;
@@ -327,8 +343,10 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
TableItem ti = resTable.getSelection()[0];
buildInfo = (IScannerConfigBuilderInfo2) ti.getData("info"); //$NON-NLS-1$
+ String selectedProfileId = buildInfo.getSelectedProfileId();
iContext = (CfgInfoContext) ti.getData("cont"); //$NON-NLS-1$
- autoDiscoveryCheckBox.setSelection(buildInfo.isAutoDiscoveryEnabled());
+ autoDiscoveryCheckBox.setSelection(buildInfo.isAutoDiscoveryEnabled()
+ && !selectedProfileId.equals(ScannerConfigProfileManager.NULL_PROFILE_ID));
reportProblemsCheckBox.setSelection(buildInfo.isProblemReportingEnabled());
profileComboBox.removeAll();
@@ -350,28 +368,26 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
String[] profiles = new String[profilesList.size()];
int counter = 0;
int pos = 0;
- String selectedProfileId = buildInfo.getSelectedProfileId();
ITool[] tools = null;
+ IConfiguration conf = iContext.getConfiguration();
+ IToolChain toolchain = conf!=null ? conf.getToolChain() : null;
boolean needPerRcProfile = cbi.isPerRcTypeDiscovery();
if (!page.isForPrefs()) {
Tool tool = (Tool) iContext.getTool();
- if (null == tool) {
- IConfiguration conf = iContext.getConfiguration();
- if (null != conf) {
- tools = conf.getToolChain().getTools();
+ if (tool != null) {
+ tools = new ITool[] { tool };
+ } else {
+ if (toolchain != null) {
+ tools = toolchain.getTools();
}
- if (null == tools)
+ if (tools == null)
return;
- } else {
- tools = new ITool[] { tool };
}
}
for (String profileId : profilesList) {
- // do not check selected profile id in tool-chain because
- // for Makefile project tool-chain does not contain profile,
- // instead default one is loaded from preferences to selectedProfileId
- if (!profileId.equals(selectedProfileId)) {
+ // for Makefile project with default tool-chain any profiles can be selected
+ if (!isMakefileProjectToolChain(toolchain) || needPerRcProfile) {
if (tools != null) {
boolean foundProfile = false;
for (ITool tool : tools) {
@@ -382,9 +398,9 @@ public class DiscoveryTab extends AbstractCBuildPropertyTab implements IBuildInf
if (!foundProfile)
continue;
}
+ if (needPerRcProfile && !CfgScannerConfigProfileManager.isPerFileProfile(profileId))
+ continue;
}
- if (needPerRcProfile && !CfgScannerConfigProfileManager.isPerFileProfile(profileId))
- continue;
visibleProfilesList.add(profileId);
labels[counter] = profiles[counter] = getProfileName(profileId);

Back to the top