diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
index dfaafb86cec..565b947e544 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml
@@ -9372,5 +9372,36 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests.java b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests.java
index 53d4cfc4114..7092c31ae09 100644
--- a/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests.java
+++ b/build/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuilder/core/tests/ManagedBuildCoreTests.java
@@ -48,6 +48,7 @@ public class ManagedBuildCoreTests extends TestCase {
TestSuite suite = new TestSuite(ManagedBuildCoreTests.class.getName());
suite.addTest(new ManagedBuildCoreTests("testLoadManifest"));
suite.addTest(new ManagedBuildCoreTests("testTreeOptions"));
+ suite.addTest(new ManagedBuildCoreTests("testOptionsAttributeUseByScannerDiscovery"));
return suite;
}
@@ -661,5 +662,19 @@ public class ManagedBuildCoreTests extends TestCase {
assertTrue(exception);
}
+
+ /**
+ * Tests attribute useByScannerDiscovery.
+ * @throws Exception
+ */
+ public void testOptionsAttributeUseByScannerDiscovery() throws Exception {
+ IOption optionNotSD = ManagedBuildManager.getExtensionOption("cdt.managedbuilder.lsp.tests.option.not-sd");
+ assertNotNull(optionNotSD);
+ assertEquals(false, optionNotSD.isForScannerDiscovery());
+
+ IOption option = ManagedBuildManager.getExtensionOption("cdt.managedbuilder.lsp.tests.option.string");
+ assertNotNull(option);
+ assertEquals(true, option.isForScannerDiscovery());
+ }
} // end class
diff --git a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd
index 8a3777470fd..2cb51076d5d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd
+++ b/build/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd
@@ -1380,6 +1380,13 @@ Additional special types exist to flag options of special relevance to the build
+
+
+
+ An optional field to allow the option additionally to be passed to scanner discovery of built-in compiler macros and paths. The default is false.
+
+
+
@@ -1611,14 +1618,12 @@ If no order is defined a default order is assumed, see "org.eclipse.cdt.man
-
-
@@ -2569,6 +2574,15 @@ The only difference between this element and the resourceConfiguration is that r
+
+
+
+
+
+ [Enter API information here.]
+
+
+
@@ -2587,15 +2601,6 @@ The only difference between this element and the resourceConfiguration is that r
-
-
-
-
-
- [Enter API information here.]
-
-
-
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
index bb091ca84fb..663efb6236b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IOption.java
@@ -100,6 +100,7 @@ public interface IOption extends IBuildObject {
public static final String ORDER = "order"; //$NON-NLS-1$
public static final String COMMAND = "command"; //$NON-NLS-1$
public static final String COMMAND_FALSE = "commandFalse"; //$NON-NLS-1$
+ public static final String USE_BY_SCANNER_DISCOVERY = "useByScannerDiscovery"; //$NON-NLS-1$
/** @since 8.0 */
public static final String COMMAND_GENERATOR = "commandGenerator"; //$NON-NLS-1$
public static final String TOOL_TIP = "tip"; //$NON-NLS-1$
@@ -605,6 +606,13 @@ public interface IOption extends IBuildObject {
public OptionStringValue[] getBasicStringListValueElements() throws BuildException;
+ /**
+ * Flag to indicate whether the option is also used by scanner discovery.
+ * @return {@code true} if the option is intended to be passed to scanner discovery command
+ * or {@code false} otherwise.
+ */
+ public boolean isForScannerDiscovery();
+
/**
* Returns the tree root of this option if it is of type {@link #TREE}
* @return tree root of this option or null if not found.
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
index d67134d6eba..250dce53259 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
@@ -69,6 +69,7 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
private IConfigurationElement commandGeneratorElement;
private IOptionCommandGenerator commandGenerator;
private String commandFalse;
+ private Boolean isForScannerDiscovery;
private String tip;
private String contextId;
private List applicableValuesList;
@@ -207,6 +208,9 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
if (option.commandFalse != null) {
commandFalse = new String(option.commandFalse);
}
+ if (option.isForScannerDiscovery != null) {
+ isForScannerDiscovery = new Boolean(option.isForScannerDiscovery.booleanValue());
+ }
if (option.tip != null) {
tip = new String(option.tip);
}
@@ -373,6 +377,12 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
// Get the command defined for a Boolean option when the value is False
commandFalse = SafeStringInterner.safeIntern(element.getAttribute(COMMAND_FALSE));
+ // isForScannerDiscovery
+ String isForSD = element.getAttribute(USE_BY_SCANNER_DISCOVERY);
+ if (isForSD != null){
+ isForScannerDiscovery = new Boolean("true".equals(isForSD)); //$NON-NLS-1$
+ }
+
// Get the tooltip for the option
tip = SafeStringInterner.safeIntern(element.getAttribute(TOOL_TIP));
@@ -508,6 +518,14 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
commandFalse = SafeStringInterner.safeIntern(element.getAttribute(COMMAND_FALSE));
}
+ // isForScannerDiscovery
+ if (element.getAttribute(USE_BY_SCANNER_DISCOVERY) != null) {
+ String isForSD = element.getAttribute(USE_BY_SCANNER_DISCOVERY);
+ if (isForSD != null){
+ isForScannerDiscovery = new Boolean("true".equals(isForSD)); //$NON-NLS-1$
+ }
+ }
+
// Get the tooltip for the option
if (element.getAttribute(TOOL_TIP) != null) {
tip = SafeStringInterner.safeIntern(element.getAttribute(TOOL_TIP));
@@ -797,6 +815,10 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
element.setAttribute(COMMAND_FALSE, commandFalse);
}
+ if (isForScannerDiscovery != null) {
+ element.setAttribute(USE_BY_SCANNER_DISCOVERY, isForScannerDiscovery.toString());
+ }
+
if (tip != null) {
element.setAttribute(TOOL_TIP, tip);
}
@@ -1248,6 +1270,14 @@ public class Option extends BuildObject implements IOption, IBuildPropertiesRest
return commandFalse;
}
+ @Override
+ public boolean isForScannerDiscovery() {
+ if (isForScannerDiscovery == null) {
+ isForScannerDiscovery = new Boolean(superClass != null && superClass.isForScannerDiscovery());
+ }
+ return isForScannerDiscovery;
+ }
+
@Override
public String getToolTip() {
if (tip == null) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
index e76bfffdcae..3d190081596 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/OptionReference.java
@@ -921,6 +921,12 @@ public class OptionReference implements IOption {
}
return ve;
}
+
+ @Override
+ public boolean isForScannerDiscovery() {
+ return option.isForScannerDiscovery();
+ }
+
@Override
public ITreeRoot getTreeRoot() {
if (!resolved) {