mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
bug 404913: Flag to designate build options to be also used by scanner discovery.
This commit is contained in:
parent
3d97b3e93c
commit
af57f95d75
6 changed files with 106 additions and 11 deletions
|
@ -9372,5 +9372,36 @@
|
|||
</option>
|
||||
</tool>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
|
||||
<toolChain
|
||||
id="cdt.managedbuilder.lsp.tests.toolchain"
|
||||
isAbstract="false">
|
||||
<tool
|
||||
id="cdt.managedbuilder.lsp.tests.tool"
|
||||
isAbstract="false">
|
||||
<inputType
|
||||
id="cdt.managedbuilder.lsp.tests.input-type"
|
||||
languageId="org.eclipse.cdt.core.gcc">
|
||||
</inputType>
|
||||
<option
|
||||
command="-not-for-scanner-discovery"
|
||||
id="cdt.managedbuilder.lsp.tests.option.not-sd"
|
||||
isAbstract="false"
|
||||
resourceFilter="all"
|
||||
valueType="string">
|
||||
</option>
|
||||
<option
|
||||
command="-str-option="
|
||||
id="cdt.managedbuilder.lsp.tests.option.string"
|
||||
isAbstract="false"
|
||||
resourceFilter="all"
|
||||
useByScannerDiscovery="true"
|
||||
value="str-value"
|
||||
valueType="string">
|
||||
</option>
|
||||
</tool>
|
||||
</toolChain>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1380,6 +1380,13 @@ Additional special types exist to flag options of special relevance to the build
|
|||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="useByScannerDiscovery" type="boolean">
|
||||
<annotation>
|
||||
<documentation>
|
||||
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.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="helpSupplier" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
@ -1611,14 +1618,12 @@ If no order is defined a default order is assumed, see "org.eclipse.cdt.man
|
|||
<attribute name="id" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
|
@ -2569,6 +2574,15 @@ The only difference between this element and the resourceConfiguration is that r
|
|||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="since"/>
|
||||
|
@ -2587,15 +2601,6 @@ The only difference between this element and the resourceConfiguration is that r
|
|||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="apiInfo"/>
|
||||
</appInfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appInfo>
|
||||
<meta.section type="implementation"/>
|
||||
|
|
|
@ -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 <code>null</code> if not found.
|
||||
|
|
|
@ -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<String> 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) {
|
||||
|
|
|
@ -921,6 +921,12 @@ public class OptionReference implements IOption {
|
|||
}
|
||||
return ve;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForScannerDiscovery() {
|
||||
return option.isForScannerDiscovery();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITreeRoot getTreeRoot() {
|
||||
if (!resolved) {
|
||||
|
|
Loading…
Add table
Reference in a new issue