Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2015-03-05 23:13:11 -0500
committerMarc-Andre Laperle2015-03-24 16:41:21 -0400
commitbb69775934ccc1a9a049bcb58ae0e42c4cb24de3 (patch)
tree9f4159c408905f41bb8993804dd05aecfd9f33f1
parent3c13a7101757355463d68dfdc626f6cee5b57137 (diff)
downloadorg.eclipse.cdt-bb69775934ccc1a9a049bcb58ae0e42c4cb24de3.tar.gz
org.eclipse.cdt-bb69775934ccc1a9a049bcb58ae0e42c4cb24de3.tar.xz
org.eclipse.cdt-bb69775934ccc1a9a049bcb58ae0e42c4cb24de3.zip
Bug 426627 - GCC Build Output Parser doesn't work with libtool
Change-Id: Id1fa62c15c57d84c8a646bb41096c887714d4474 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--build/org.eclipse.cdt.autotools.core/plugin.properties1
-rw-r--r--build/org.eclipse.cdt.autotools.core/plugin.xml12
-rw-r--r--build/org.eclipse.cdt.autotools.tests/META-INF/MANIFEST.MF3
-rw-r--r--build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java86
4 files changed, 100 insertions, 2 deletions
diff --git a/build/org.eclipse.cdt.autotools.core/plugin.properties b/build/org.eclipse.cdt.autotools.core/plugin.properties
index 01a486842f2..19c5089a1a5 100644
--- a/build/org.eclipse.cdt.autotools.core/plugin.properties
+++ b/build/org.eclipse.cdt.autotools.core/plugin.properties
@@ -176,6 +176,7 @@ AutomakeEditor.name = AutomakeEditor
Automake.name = automake
ConfigureScript.name=Configure Script
AutogenScript.name=Autogen Script
+LibtoolGCCBuildOutputParser.name = CDT Libtool GCC Build Output Parser
AutotoolsProblemMarker.name=Configure Problem
AutotoolsErrorParser.name=Autotools Error Parser
diff --git a/build/org.eclipse.cdt.autotools.core/plugin.xml b/build/org.eclipse.cdt.autotools.core/plugin.xml
index fbf5b63700a..fb62142df3b 100644
--- a/build/org.eclipse.cdt.autotools.core/plugin.xml
+++ b/build/org.eclipse.cdt.autotools.core/plugin.xml
@@ -398,7 +398,7 @@
archList="all"
configurationEnvironmentSupplier="org.eclipse.cdt.internal.autotools.core.AutotoolsEnvironmentVariableSupplier"
id="org.eclipse.linuxtools.cdt.autotools.core.toolChain"
- languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
+ languageSettingsProviders="org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser;org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector"
name="%Autotools.gnu.toolchain.name"
supportsManagedBuild="false"
targetTool="org.eclipse.linuxtools.cdt.autotools.core.tool.configure">
@@ -567,4 +567,14 @@
name="%AutoconfErrorParser.name">
</errorparser>
</extension>
+ <extension
+ point="org.eclipse.cdt.core.LanguageSettingsProvider">
+ <provider
+ class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser"
+ id="org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"
+ name="%LibtoolGCCBuildOutputParser.name"
+ parameter="(libtool:\s+compile:\s+)?((gcc)|([gc]\+\+)|(clang))"
+ prefer-non-shared="true">
+ </provider>
+ </extension>
</plugin>
diff --git a/build/org.eclipse.cdt.autotools.tests/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.autotools.tests/META-INF/MANIFEST.MF
index 8afc5f63fec..2d419f51a30 100644
--- a/build/org.eclipse.cdt.autotools.tests/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.autotools.tests/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.cdt.make.ui,
org.eclipse.ui.workbench.texteditor,
org.eclipse.cdt.core,
- org.eclipse.cdt.autotools.ui;bundle-version="1.0.0"
+ org.eclipse.cdt.autotools.ui;bundle-version="1.0.0",
+ org.eclipse.cdt.core.tests
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.cdt.autotools.tests,
diff --git a/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java
new file mode 100644
index 00000000000..7263c52892c
--- /dev/null
+++ b/build/org.eclipse.cdt.autotools.tests/src/org/eclipse/cdt/autotools/tests/LibtoolGCCBuildCommandParserTest.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2015 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc-Andre Laperle (Ericsson) - initial API and implementation adapted from GCCBuildCommandParserTest
+ *******************************************************************************/
+
+package org.eclipse.cdt.autotools.tests;
+
+import java.util.List;
+
+import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager;
+import org.eclipse.cdt.core.model.CoreModel;
+import org.eclipse.cdt.core.settings.model.CIncludePathEntry;
+import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
+import org.eclipse.cdt.core.settings.model.ICLanguageSetting;
+import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry;
+import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager;
+import org.eclipse.cdt.core.testplugin.ResourceHelper;
+import org.eclipse.cdt.core.testplugin.util.BaseTestCase;
+import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+
+/**
+ * Test cases to test libtool build command parser.
+ */
+public class LibtoolGCCBuildCommandParserTest extends BaseTestCase {
+ // ID of the parser taken from the extension point
+ private static final String BUILD_COMMAND_PARSER_EXT = "org.eclipse.cdt.autotools.core.LibtoolGCCBuildCommandParser"; //$NON-NLS-1$
+
+ /**
+ * Helper method to fetch configuration descriptions.
+ */
+ private ICConfigurationDescription[] getConfigurationDescriptions(IProject project) {
+ CoreModel coreModel = CoreModel.getDefault();
+ ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
+ // project description
+ ICProjectDescription projectDescription = mngr.getProjectDescription(project, false);
+ assertNotNull(projectDescription);
+ assertEquals(1, projectDescription.getConfigurations().length);
+ // configuration description
+ ICConfigurationDescription[] cfgDescriptions = projectDescription.getConfigurations();
+ return cfgDescriptions;
+ }
+
+ /**
+ * Test possible variations of libtool/compiler command.
+ */
+ public void testProcessLine() 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 file1=ResourceHelper.createFile(project, "file1.cpp");
+ IFile file2=ResourceHelper.createFile(project, "file2.cpp");
+ @SuppressWarnings("deprecation")
+ ICLanguageSetting ls = cfgDescription.getLanguageSettingForFile(file1.getProjectRelativePath(), true);
+ String languageId = ls.getLanguageId();
+
+ // create GCCBuildCommandParser
+ GCCBuildCommandParser parser = (GCCBuildCommandParser) LanguageSettingsManager.getExtensionProviderCopy(BUILD_COMMAND_PARSER_EXT, true);
+
+ // parse line
+ parser.startup(cfgDescription, null);
+ parser.processLine("libtool: compile: gcc -I/path0 file1.cpp");
+ parser.processLine("libtool: compile: g++ -I/path0 file2.cpp");
+ parser.shutdown();
+ {
+ List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file1, languageId);
+ assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
+ }
+ {
+ List<ICLanguageSettingEntry> entries = parser.getSettingEntries(cfgDescription, file2, languageId);
+ assertEquals(new CIncludePathEntry("/path0", 0), entries.get(0));
+ }
+ }
+
+} \ No newline at end of file

Back to the top