mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
bug 378766: [Scanner discovery] GCC Build Output parser doesn't handle framework paths (-F)
This commit is contained in:
parent
cfff2b91fb
commit
d4d87ca412
2 changed files with 47 additions and 0 deletions
|
@ -573,6 +573,51 @@ public class GCCBuildCommandParserTest extends BaseTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse Mac Frameworks.
|
||||
*/
|
||||
public void testCIncludePathEntryFrameworks() throws Exception {
|
||||
// Create model project and accompanied descriptions
|
||||
String projectName = getName();
|
||||
IProject project = ResourceHelper.createCDTProjectWithConfig(projectName);
|
||||
ICConfigurationDescription[] cfgDescriptions = getConfigurationDescriptions(project);
|
||||
ICConfigurationDescription cfgDescription = cfgDescriptions[0];
|
||||
|
||||
IFile file=ResourceHelper.createFile(project, "file.cpp");
|
||||
ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file.getProjectRelativePath(), true);
|
||||
String languageId = ls.getLanguageId();
|
||||
|
||||
// create GCCBuildCommandParser
|
||||
GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(GCC_BUILD_COMMAND_PARSER_EXT, true);
|
||||
|
||||
// parse line
|
||||
parser.startup(cfgDescription, null);
|
||||
parser.processLine("gcc"
|
||||
// framework
|
||||
+ " -F/Framework "
|
||||
// framework system
|
||||
+ " -iframework/framework/system "
|
||||
// with spaces
|
||||
+ " -F '/Framework with spaces' "
|
||||
+ " file.cpp");
|
||||
parser.shutdown();
|
||||
|
||||
// check populated entries
|
||||
List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file, languageId);
|
||||
{
|
||||
IPath path = new Path("/Framework").setDevice(project.getLocation().getDevice());
|
||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(0));
|
||||
}
|
||||
{
|
||||
IPath path = new Path("/framework/system").setDevice(project.getLocation().getDevice());
|
||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(1));
|
||||
}
|
||||
{
|
||||
IPath path = new Path("/Framework with spaces").setDevice(project.getLocation().getDevice());
|
||||
assertEquals(new CIncludePathEntry(path, ICSettingEntry.FRAMEWORKS_MAC), entries.get(2));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse variations of -D options.
|
||||
*/
|
||||
|
|
|
@ -26,6 +26,8 @@ public class GCCBuildCommandParser extends AbstractBuildCommandParser implements
|
|||
static final AbstractOptionParser[] optionParsers = {
|
||||
new IncludePathOptionParser("-I\\s*([\"'])(.*)\\1", "$2"),
|
||||
new IncludePathOptionParser("-I\\s*([^\\s\"']*)", "$1"),
|
||||
new IncludePathOptionParser("-(F|(iframework))\\s*([\"'])(.*)\\3", "$4", ICSettingEntry.FRAMEWORKS_MAC),
|
||||
new IncludePathOptionParser("-(F|(iframework))\\s*([^\\s\"']*)", "$3", ICSettingEntry.FRAMEWORKS_MAC),
|
||||
new IncludeFileOptionParser("-include\\s*([\"'])(.*)\\1", "$2"),
|
||||
new IncludeFileOptionParser("-include\\s*([^\\s\"']*)", "$1"),
|
||||
new MacroOptionParser("-D\\s*([\"'])([^=]*)(=(.*))?\\1", "$2", "$4"),
|
||||
|
|
Loading…
Add table
Reference in a new issue