Skip to main content
summaryrefslogtreecommitdiffstats
path: root/cross
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-10-09 00:21:36 -0400
committerMarc-Andre Laperle2013-10-16 01:01:43 -0400
commitc644a857ba56c32171d4f5a738e19aea858f7faf (patch)
tree05025518cce17acc3f2857dd9c3523b3ce753ba6 /cross
parent35b004c5d48eff490a097a80530fea2bbe06ea81 (diff)
downloadorg.eclipse.cdt-c644a857ba56c32171d4f5a738e19aea858f7faf.tar.gz
org.eclipse.cdt-c644a857ba56c32171d4f5a738e19aea858f7faf.tar.xz
org.eclipse.cdt-c644a857ba56c32171d4f5a738e19aea858f7faf.zip
Bug 392404 - Change Cross GCC toolchain to use language setting provider
Add cross toolchain prefix to the command macro. Change-Id: I3188d21050b84fdc6d6a4b8d3b6aa540710f1790 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/17189
Diffstat (limited to 'cross')
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/plugin.properties3
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/plugin.xml17
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossGCCBuiltinSpecsDetector.java38
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java69
4 files changed, 56 insertions, 71 deletions
diff --git a/cross/org.eclipse.cdt.build.crossgcc/plugin.properties b/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
index 044e4f27e5..8653e2d91b 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
@@ -22,4 +22,5 @@ tool.gpp.compiler = Cross G++ Compiler
tool.gcc.linker = Cross GCC Linker
tool.gpp.linker = Cross G++ Linker
tool.gcc.archiver = Cross GCC Archiver
-tool.gcc.assembler = Cross GCC Assembler \ No newline at end of file
+tool.gcc.assembler = Cross GCC Assembler
+CrossGCCBuiltinSpecsDetector.name = CDT Cross GCC Built-in Compiler Settings \ No newline at end of file
diff --git a/cross/org.eclipse.cdt.build.crossgcc/plugin.xml b/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
index e8ad4b0b32..5d69435108 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
+++ b/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
@@ -23,9 +23,10 @@
configurationEnvironmentSupplier="org.eclipse.cdt.internal.build.crossgcc.CrossEnvironmentVariableSupplier"
id="cdt.managedbuild.toolchain.gnu.cross.base"
isAbstract="false"
+ languageSettingsProviders="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser;org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector"
name="%toolChain.name"
- targetTool="cdt.managedbuild.tool.gnu.cross.c.linker;cdt.managedbuild.tool.gnu.cross.cpp.linker;cdt.managedbuild.tool.gnu.archiver"
- osList="all">
+ osList="all"
+ targetTool="cdt.managedbuild.tool.gnu.cross.c.linker;cdt.managedbuild.tool.gnu.cross.cpp.linker;cdt.managedbuild.tool.gnu.archiver">
<targetPlatform
archList="all"
binaryParser="org.eclipse.cdt.core.ELF"
@@ -257,4 +258,16 @@
</toolchain>
</wizardPage>
</extension>
+ <extension
+ point="org.eclipse.cdt.core.LanguageSettingsProvider">
+ <provider
+ class="org.eclipse.cdt.internal.build.crossgcc.CrossGCCBuiltinSpecsDetector"
+ id="org.eclipse.cdt.build.crossgcc.CrossGCCBuiltinSpecsDetector"
+ name="%CrossGCCBuiltinSpecsDetector.name"
+ parameter="${COMMAND} ${FLAGS} -E -P -v -dD &quot;${INPUTS}&quot;"
+ prefer-non-shared="true">
+ <language-scope id="org.eclipse.cdt.core.gcc"/>
+ <language-scope id="org.eclipse.cdt.core.g++"/>
+ </provider>
+ </extension>
</plugin>
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossGCCBuiltinSpecsDetector.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossGCCBuiltinSpecsDetector.java
new file mode 100644
index 0000000000..fc26b62374
--- /dev/null
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossGCCBuiltinSpecsDetector.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson 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
+ *******************************************************************************/
+
+package org.eclipse.cdt.internal.build.crossgcc;
+
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuiltinSpecsDetector;
+
+public class CrossGCCBuiltinSpecsDetector extends GCCBuiltinSpecsDetector {
+
+ @Override
+ protected String getCompilerCommand(String languageId) {
+ // Include the cross command prefix (tool option) in the ${COMMAND} macro
+ // For example: "arch-os-" + "gcc"
+ String prefix = "";
+ IToolChain toolchain = null;
+ if (currentCfgDescription != null) {
+ IConfiguration cfg = ManagedBuildManager.getConfigurationForDescription(currentCfgDescription);
+ toolchain = cfg != null ? cfg.getToolChain() : null;
+ if (toolchain != null) {
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$
+ prefix = (String)option.getValue();
+ }
+ }
+ return prefix + super.getCompilerCommand(languageId);
+ }
+}
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java
index 3599872230..89aaf7d8f6 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2013 Wind River Systems, Inc. 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
@@ -11,22 +11,8 @@
*******************************************************************************/
package org.eclipse.cdt.internal.build.crossgcc;
import java.lang.reflect.InvocationTargetException;
-import java.util.Map;
-import org.eclipse.cdt.build.core.scannerconfig.CfgInfoContext;
-import org.eclipse.cdt.build.core.scannerconfig.ICfgScannerConfigBuilderInfo2Set;
-import org.eclipse.cdt.build.core.scannerconfig.ScannerConfigBuilder;
-import org.eclipse.cdt.build.internal.core.scannerconfig.CfgDiscoveredPathManager;
-import org.eclipse.cdt.build.internal.core.scannerconfig2.CfgScannerConfigProfileManager;
import org.eclipse.cdt.core.templateengine.SharedDefaults;
-import org.eclipse.cdt.make.core.scannerconfig.IScannerConfigBuilderInfo2;
-import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector;
-import org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner;
-import org.eclipse.cdt.make.core.scannerconfig.InfoContext;
-import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredPathInfo;
-import org.eclipse.cdt.make.internal.core.scannerconfig.DiscoveredScannerInfoStore;
-import org.eclipse.cdt.make.internal.core.scannerconfig2.SCProfileInstance;
-import org.eclipse.cdt.make.internal.core.scannerconfig2.ScannerConfigProfileManager;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IOption;
@@ -35,9 +21,7 @@ import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.operation.IRunnableWithProgress;
/**
@@ -74,60 +58,9 @@ public class SetCrossCommandOperation implements IRunnableWithProgress {
ManagedBuildManager.setOption(config, toolchain, option, prefix);
option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path"); //$NON-NLS-1$
ManagedBuildManager.setOption(config, toolchain, option, path);
-
- ICfgScannerConfigBuilderInfo2Set cbi = CfgScannerConfigProfileManager.getCfgScannerConfigBuildInfo(config);
- Map<CfgInfoContext, IScannerConfigBuilderInfo2> map = cbi.getInfoMap();
- for (CfgInfoContext cfgInfoContext : map.keySet()) {
- IScannerConfigBuilderInfo2 bi = map.get(cfgInfoContext);
- String providerId = "specsFile"; //$NON-NLS-1$
- String runCommand = bi.getProviderRunCommand(providerId);
- bi.setProviderRunCommand(providerId, prefix + runCommand);
- try {
- bi.save();
- } catch (CoreException e) {
- Activator.log(e);
- }
-
- // Clear the path info that was captured at project creation time
- // TODO we need an API to do this to avoid the discouraged access warnings.
-
- DiscoveredPathInfo pathInfo = new DiscoveredPathInfo(project);
- InfoContext infoContext = cfgInfoContext.toInfoContext();
-
- // 1. Remove scanner info from .metadata/.plugins/org.eclipse.cdt.make.core/Project.sc
- DiscoveredScannerInfoStore dsiStore = DiscoveredScannerInfoStore.getInstance();
- try {
- dsiStore.saveDiscoveredScannerInfoToState(project, infoContext, pathInfo);
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- // 2. Remove scanner info from CfgDiscoveredPathManager cache and from the Tool
- CfgDiscoveredPathManager cdpManager = CfgDiscoveredPathManager.getInstance();
- cdpManager.removeDiscoveredInfo(project, cfgInfoContext);
-
- // 3. Remove scanner info from SI collector
- IScannerConfigBuilderInfo2 buildInfo2 = map.get(cfgInfoContext);
- if (buildInfo2!=null) {
- ScannerConfigProfileManager scpManager = ScannerConfigProfileManager.getInstance();
- String selectedProfileId = buildInfo2.getSelectedProfileId();
- SCProfileInstance profileInstance = scpManager.getSCProfileInstance(project, infoContext, selectedProfileId);
-
- IScannerInfoCollector collector = profileInstance.getScannerInfoCollector();
- if (collector instanceof IScannerInfoCollectorCleaner) {
- ((IScannerInfoCollectorCleaner) collector).deleteAll(project);
- }
- buildInfo2 = null;
- }
- }
}
ManagedBuildManager.saveBuildInfo(project, true);
-
- for (IConfiguration config : configs) {
- ScannerConfigBuilder.build(config, ScannerConfigBuilder.PERFORM_CORE_UPDATE, new NullProgressMonitor());
- }
-
}
}

Back to the top