Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2012-04-28 18:53:29 +0000
committerMarc-Andre Laperle2012-04-28 18:53:29 +0000
commit8b7660f83b255bbbd4f99409c77010244802da96 (patch)
tree98674bfe981208ef83d5124094a525f9524858dd /cross/org.eclipse.cdt.build.crossgcc
parentc51e0ece365d76a5008936ae98ddaa7c7c2661b7 (diff)
downloadorg.eclipse.cdt-8b7660f83b255bbbd4f99409c77010244802da96.tar.gz
org.eclipse.cdt-8b7660f83b255bbbd4f99409c77010244802da96.tar.xz
org.eclipse.cdt-8b7660f83b255bbbd4f99409c77010244802da96.zip
Bug 353786 - Bug 353890 Convert Cross compile template to a custom page
Diffstat (limited to 'cross/org.eclipse.cdt.build.crossgcc')
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/.project6
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/META-INF/MANIFEST.MF5
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/plugin.properties13
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/plugin.xml79
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java27
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java4
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java10
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java30
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java (renamed from cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/build/crossgcc/SetCrossCommandProcess.java)255
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandWizardPage.java203
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/messages.properties16
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/templates/setCrossCommand/template.xml33
12 files changed, 479 insertions, 202 deletions
diff --git a/cross/org.eclipse.cdt.build.crossgcc/.project b/cross/org.eclipse.cdt.build.crossgcc/.project
index 2655c345209..6726fdfe5d5 100755
--- a/cross/org.eclipse.cdt.build.crossgcc/.project
+++ b/cross/org.eclipse.cdt.build.crossgcc/.project
@@ -20,9 +20,15 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
</natures>
</projectDescription>
diff --git a/cross/org.eclipse.cdt.build.crossgcc/META-INF/MANIFEST.MF b/cross/org.eclipse.cdt.build.crossgcc/META-INF/MANIFEST.MF
index ccea5ca7c3e..f83e6e3161a 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/META-INF/MANIFEST.MF
+++ b/cross/org.eclipse.cdt.build.crossgcc/META-INF/MANIFEST.MF
@@ -8,7 +8,10 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.core;bundle-version="5.1.0",
org.eclipse.cdt.managedbuilder.core;bundle-version="5.0.100",
org.eclipse.cdt.managedbuilder.gnu.ui;bundle-version="5.0.100",
- org.eclipse.core.resources;bundle-version="3.5.0"
+ org.eclipse.core.resources;bundle-version="3.5.0",
+ org.eclipse.cdt.managedbuilder.ui;bundle-version="8.1.0",
+ org.eclipse.jface,
+ org.eclipse.ui.ide
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: %Bundle-Vendor
diff --git a/cross/org.eclipse.cdt.build.crossgcc/plugin.properties b/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
index 5c185e331aa..044e4f27e59 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc/plugin.properties
@@ -11,4 +11,15 @@
###############################################################################
Bundle-Vendor = Eclipse CDT
-Bundle-Name = CDT GCC Cross Compiler Support \ No newline at end of file
+Bundle-Name = CDT GCC Cross Compiler Support
+
+toolChain.name = Cross GCC
+optionCategory.name = Cross Settings
+option.prefix = Prefix
+option.path = Path
+tool.gcc.compiler = Cross GCC Compiler
+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
diff --git a/cross/org.eclipse.cdt.build.crossgcc/plugin.xml b/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
index 7e896703775..e8ad4b0b327 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
+++ b/cross/org.eclipse.cdt.build.crossgcc/plugin.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<!--
-# Copyright (c) 2009, 2010 Wind River Systems, Inc. and others.
+# Copyright (c) 2009, 2011 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
@@ -23,7 +23,7 @@
configurationEnvironmentSupplier="org.eclipse.cdt.internal.build.crossgcc.CrossEnvironmentVariableSupplier"
id="cdt.managedbuild.toolchain.gnu.cross.base"
isAbstract="false"
- name="Cross GCC"
+ 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">
<targetPlatform
@@ -39,13 +39,13 @@
</builder>
<optionCategory
id="cdt.managedbuild.optionCategory.gnu.cross.settings"
- name="Cross Settings">
+ name="%optionCategory.name">
</optionCategory>
<option
category="cdt.managedbuild.optionCategory.gnu.cross.settings"
id="cdt.managedbuild.option.gnu.cross.prefix"
isAbstract="false"
- name="Prefix"
+ name="%option.prefix"
resourceFilter="all"
valueType="string">
</option>
@@ -54,7 +54,7 @@
category="cdt.managedbuild.optionCategory.gnu.cross.settings"
id="cdt.managedbuild.option.gnu.cross.path"
isAbstract="false"
- name="Path"
+ name="%option.path"
resourceFilter="all"
valueType="string">
</option>
@@ -62,21 +62,21 @@
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.c.compiler"
isAbstract="false"
- name="Cross GCC Compiler"
+ name="%tool.gcc.compiler"
superClass="cdt.managedbuild.tool.gnu.c.compiler">
</tool>
<tool
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.cpp.compiler"
isAbstract="false"
- name="Cross G++ Compiler"
+ name="%tool.gpp.compiler"
superClass="cdt.managedbuild.tool.gnu.cpp.compiler">
</tool>
<tool
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.c.linker"
isAbstract="false"
- name="Cross GCC Linker"
+ name="%tool.gcc.linker"
superClass="cdt.managedbuild.tool.gnu.c.linker">
<enablement
type="ALL">
@@ -92,7 +92,7 @@
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.cpp.linker"
isAbstract="false"
- name="Cross G++ Linker"
+ name="%tool.gpp.linker"
superClass="cdt.managedbuild.tool.gnu.cpp.linker">
<enablement
type="ALL">
@@ -108,7 +108,7 @@
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.archiver"
isAbstract="false"
- name="Cross GCC Archiver"
+ name="%tool.gcc.archiver"
superClass="cdt.managedbuild.tool.gnu.archiver">
<enablement
type="ALL">
@@ -122,7 +122,7 @@
commandLineGenerator="org.eclipse.cdt.internal.build.crossgcc.CrossCommandLineGenerator"
id="cdt.managedbuild.tool.gnu.cross.assembler"
isAbstract="false"
- name="Cross GCC Assembler"
+ name="%tool.gcc.assembler"
superClass="cdt.managedbuild.tool.gnu.assembler">
</tool>
</toolChain>
@@ -217,37 +217,44 @@
</projectType>
</extension>
<extension
- point="org.eclipse.cdt.core.templateProcessTypes">
- <processType
- name="setCrossCommand"
- processRunner="org.eclipse.cdt.build.crossgcc.SetCrossCommandProcess">
- <simple
- name="projectName">
- </simple>
- <simple
- name="prefix">
- </simple>
- <simple
- name="path">
- </simple>
- </processType>
- </extension>
- <extension
- point="org.eclipse.cdt.core.templates">
+ point="org.eclipse.cdt.core.templateAssociations">
<template
- id="org.eclipse.cdt.build.crossgcc.setCrossCommand"
- location="templates/setCrossCommand/template.xml"
- projectType="org.eclipse.cdt.build.core.buildArtefactType.exe">
+ id="org.eclipse.cdt.build.core.templates.HelloWorldCAnsiProject">
+ <toolChain
+ id="cdt.managedbuild.toolchain.gnu.cross.base">
+ </toolChain>
</template>
- </extension>
- <extension
- point="org.eclipse.cdt.core.templateAssociations">
<template
- id="org.eclipse.cdt.build.crossgcc.setCrossCommand">
+ id="org.eclipse.cdt.build.core.templates.HelloWorldCCProject">
<toolChain
id="cdt.managedbuild.toolchain.gnu.cross.base">
</toolChain>
</template>
</extension>
-
+ <extension
+ point="org.eclipse.cdt.managedbuilder.ui.newWizardPages">
+ <wizardPage
+ ID="org.eclipse.cdt.build.crossgcc.setcCrossCommandWizardPage"
+ operationClass="org.eclipse.cdt.internal.build.crossgcc.SetCrossCommandOperation"
+ pageClass="org.eclipse.cdt.internal.build.crossgcc.SetCrossCommandWizardPage">
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.exe.debug">
+ </toolchain>
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.exe.release">
+ </toolchain>
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.so.debug">
+ </toolchain>
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.so.release">
+ </toolchain>
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.lib.debug">
+ </toolchain>
+ <toolchain
+ toolchainID="cdt.managedbuild.toolchain.gnu.cross.lib.release">
+ </toolchain>
+ </wizardPage>
+ </extension>
</plugin>
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java
index 085dcfdd088..fbe8e209b69 100755
--- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2012 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
@@ -7,10 +7,13 @@
*
* Contributors:
* Doug Schaefer - initial API and implementation
+ * Marc-Andre Laperle
*******************************************************************************/
package org.eclipse.cdt.internal.build.crossgcc;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
/**
@@ -19,7 +22,7 @@ import org.osgi.framework.BundleContext;
public class Activator extends Plugin {
// The plug-in ID
- public static final String PLUGIN_ID = "tut.cross.good";
+ public static final String PLUGIN_ID = "tut.cross.good"; //$NON-NLS-1$
// The shared instance
private static Activator plugin;
@@ -47,6 +50,26 @@ public class Activator extends Plugin {
plugin = null;
super.stop(context);
}
+
+ /**
+ * Logs the specified status with this plug-in's log.
+ *
+ * @param status
+ * status to log
+ */
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * Logs an internal error with the specified throwable
+ *
+ * @param e
+ * the exception to be logged
+ */
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, 1, "Internal Error", e)); //$NON-NLS-1$
+ }
/**
* Returns the shared instance
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java
index fd0ba8fa424..153126944de 100755
--- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2012 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
@@ -32,7 +32,7 @@ public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
else
toolchain = (IToolChain)parent;
- IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix");
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$
String prefix = (String)option.getValue();
String newCommandName = prefix + commandName;
return super.generateCommandLineInfo(tool, newCommandName, flags, outputFlag,
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java
index 4bfb49fa94e..c29d7a56085 100755
--- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2012 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
@@ -39,7 +39,7 @@ public class CrossEnvironmentVariableSupplier implements
private static class PathEnvironmentVariable implements IBuildEnvironmentVariable {
- public static String name = "PATH";
+ public static String name = "PATH"; //$NON-NLS-1$
private File path;
@@ -49,10 +49,10 @@ public class CrossEnvironmentVariableSupplier implements
public static PathEnvironmentVariable create(IConfiguration configuration) {
IToolChain toolchain = configuration.getToolChain();
- IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path");
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path"); //$NON-NLS-1$
String path = (String)option.getValue();
File sysroot = new File(path);
- File bin = new File(sysroot, "bin");
+ File bin = new File(sysroot, "bin"); //$NON-NLS-1$
if (bin.isDirectory())
sysroot = bin;
return new PathEnvironmentVariable(sysroot);
@@ -66,7 +66,7 @@ public class CrossEnvironmentVariableSupplier implements
}
public String getDelimiter() {
- return Platform.getOS().equals(Platform.OS_WIN32) ? ";" : ":";
+ return Platform.getOS().equals(Platform.OS_WIN32) ? ";" : ":"; //$NON-NLS-1$ //$NON-NLS-2$
}
public String getName() {
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java
new file mode 100644
index 00000000000..86a6afad40f
--- /dev/null
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Marc-Andre Laperle 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 - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.build.crossgcc;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.build.crossgcc.messages"; //$NON-NLS-1$
+ public static String SetCrossCommandWizardPage_browse;
+ public static String SetCrossCommandWizardPage_description;
+ public static String SetCrossCommandWizardPage_name;
+ public static String SetCrossCommandWizardPage_path;
+ public static String SetCrossCommandWizardPage_prefix;
+ public static String SetCrossCommandWizardPage_title;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/build/crossgcc/SetCrossCommandProcess.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java
index 3c606328870..3599872230e 100644
--- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/build/crossgcc/SetCrossCommandProcess.java
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java
@@ -1,122 +1,133 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2012 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
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Doug Schaefer - initial API and implementation
- *******************************************************************************/
-package org.eclipse.cdt.build.crossgcc;
-
-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.TemplateCore;
-import org.eclipse.cdt.core.templateengine.process.ProcessArgument;
-import org.eclipse.cdt.core.templateengine.process.ProcessFailureException;
-import org.eclipse.cdt.core.templateengine.process.ProcessRunner;
-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;
-import org.eclipse.cdt.managedbuilder.core.IToolChain;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-public class SetCrossCommandProcess extends ProcessRunner {
-
- @Override
- public void process(TemplateCore template, ProcessArgument[] args,
- String processId, IProgressMonitor monitor)
- throws ProcessFailureException {
- String projectName = args[0].getSimpleValue();
- String prefix = args[1].getSimpleValue();
- String path = args[2].getSimpleValue();
-
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- if (!project.exists())
- return;
-
- IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- if (buildInfo == null)
- return;
-
- IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
- for (IConfiguration config : configs) {
- IToolChain toolchain = config.getToolChain();
- IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix");
- ManagedBuildManager.setOption(config, toolchain, option, prefix);
- option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path");
- 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";
- String runCommand = bi.getProviderRunCommand(providerId);
- bi.setProviderRunCommand(providerId, prefix + runCommand);
- try {
- bi.save();
- } catch (CoreException e) {
- throw new ProcessFailureException(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, monitor);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009, 2012 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Doug Schaefer - initial API and implementation
+ * Marc-Andre Laperle - Moved to an operation for a custom wizard page
+ *******************************************************************************/
+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;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+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;
+
+/**
+ * An operation that runs when the new project wizard finishes for the Cross GCC toolchain.
+ * It reuses the information from {@link SetCrossCommandWizardPage} to set build options (prefix and path).
+ * It also clears and reruns scanner discovery to account for the modified command.
+ *
+ */
+public class SetCrossCommandOperation implements IRunnableWithProgress {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+
+ String projectName = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_PROJECT_NAME);
+ String prefix = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PREFIX);
+ String path = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PATH);
+
+ SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PATH_KEY, path);
+ SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PREFIX_KEY, prefix);
+ SharedDefaults.getInstance().updateShareDefaultsMap(SharedDefaults.getInstance().getSharedDefaultsMap());
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (!project.exists())
+ return;
+
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ if (buildInfo == null)
+ return;
+
+ IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations();
+ for (IConfiguration config : configs) {
+ IToolChain toolchain = config.getToolChain();
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$
+ 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());
+ }
+
+ }
+
+}
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandWizardPage.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandWizardPage.java
new file mode 100644
index 00000000000..1448e5057dc
--- /dev/null
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandWizardPage.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 Marc-Andre Laperle 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 - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.internal.build.crossgcc;
+
+import org.eclipse.cdt.core.templateengine.SharedDefaults;
+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPage;
+import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
+
+/**
+ * A wizard page that allows the user to specify the prefix and the path of a Cross GCC command.
+ * The values are passed to {@link SetCrossCommandOperation} using the {@link MBSCustomPageManager}
+ */
+public class SetCrossCommandWizardPage extends MBSCustomPage {
+
+ private Composite composite;
+ private boolean finish = false;
+ private Text pathTxt;
+ private Text prefixTxt;
+
+ public static final String PAGE_ID = "org.eclipse.cdt.build.crossgcc.setcCrossCommandWizardPage"; //$NON-NLS-1$
+
+ public static final String CROSS_PROJECT_NAME = "crossProjectName"; //$NON-NLS-1$
+ public static final String CROSS_COMMAND_PREFIX = "crossCommandPrefix"; //$NON-NLS-1$
+ public static final String CROSS_COMMAND_PATH = "crossCommandPath"; //$NON-NLS-1$
+
+ // Note: The shared defaults keys don't have "cross" in them because we want to keep
+ // compatibility with defaults that were saved when it used to be a template
+ static final String SHARED_DEFAULTS_PREFIX_KEY = "prefix";
+ static final String SHARED_DEFAULTS_PATH_KEY = "path";
+
+ public SetCrossCommandWizardPage() {
+ pageID = PAGE_ID;
+
+ MBSCustomPageManager.addPageProperty(PAGE_ID, CROSS_COMMAND_PATH, ""); //$NON-NLS-1$
+ MBSCustomPageManager.addPageProperty(PAGE_ID, CROSS_COMMAND_PREFIX, ""); //$NON-NLS-1$
+ }
+
+ @Override
+ protected boolean isCustomPageComplete() {
+ // Make sure that if the users goes back to the first page and changes the project name,
+ // the property will be updated
+ updateProjectNameProperty();
+ return finish;
+ }
+
+ public String getName() {
+ return Messages.SetCrossCommandWizardPage_name;
+ }
+
+ public void createControl(Composite parent) {
+ composite = new Composite(parent, SWT.NULL);
+
+ composite.setLayout(new GridLayout(3, false));
+ GridData layoutData = new GridData();
+ composite.setLayoutData(layoutData);
+
+ Label prefixLbl = new Label(composite, SWT.NONE);
+ prefixLbl.setText(Messages.SetCrossCommandWizardPage_prefix);
+
+ prefixTxt = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
+ prefixTxt.setLayoutData(layoutData);
+ String crossCommandPrefix = SharedDefaults.getInstance().getSharedDefaultsMap().get(SHARED_DEFAULTS_PREFIX_KEY);
+ if (crossCommandPrefix != null) {
+ prefixTxt.setText(crossCommandPrefix);
+ updatePrefixProperty();
+ }
+ prefixTxt.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ updatePrefixProperty();
+ }
+ });
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText(Messages.SetCrossCommandWizardPage_path);
+
+ pathTxt = new Text(composite, SWT.SINGLE | SWT.BORDER);
+ String crossCommandPath = SharedDefaults.getInstance().getSharedDefaultsMap().get(SHARED_DEFAULTS_PATH_KEY);
+ if (crossCommandPath != null) {
+ pathTxt.setText(crossCommandPath);
+ updatePathProperty();
+ }
+ layoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
+ pathTxt.setLayoutData(layoutData);
+ pathTxt.addModifyListener(new ModifyListener() {
+
+ public void modifyText(ModifyEvent e) {
+ updatePathProperty();
+ }
+ });
+
+ Button button = new Button(composite, SWT.NONE);
+ button.setText(Messages.SetCrossCommandWizardPage_browse);
+ button.addSelectionListener(new SelectionListener() {
+
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+
+ public void widgetSelected(SelectionEvent e) {
+ DirectoryDialog dirDialog = new DirectoryDialog(composite.getShell(), SWT.APPLICATION_MODAL);
+ String browsedDirectory = dirDialog.open();
+ pathTxt.setText(browsedDirectory);
+
+ }
+ });
+ layoutData = new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1);
+ button.setLayoutData(layoutData);
+ }
+
+ public Control getControl() {
+ return composite;
+ }
+
+ public String getDescription() {
+ return Messages.SetCrossCommandWizardPage_description;
+ }
+
+ public String getErrorMessage() {
+ return null;
+ }
+
+ public Image getImage() {
+ return wizard.getDefaultPageImage();
+ }
+
+ public String getMessage() {
+ return null;
+ }
+
+ public String getTitle() {
+ return Messages.SetCrossCommandWizardPage_title;
+ }
+
+ public void performHelp() {
+ }
+
+ public void setDescription(String description) {
+ }
+
+ public void setImageDescriptor(ImageDescriptor image) {
+ }
+
+ public void setTitle(String title) {
+ }
+
+ public void setVisible(boolean visible) {
+ if (visible) {
+ finish = true;
+ }
+ composite.setVisible(visible);
+ }
+
+ public void dispose() {
+ }
+
+
+ /**
+ * MBSCustomPageManager and properties are used to pass things to SetCrossCommandOperation
+ */
+ private void updatePathProperty() {
+ MBSCustomPageManager.addPageProperty(PAGE_ID, CROSS_COMMAND_PATH, pathTxt.getText());
+ }
+
+ private void updatePrefixProperty() {
+ MBSCustomPageManager.addPageProperty(PAGE_ID, CROSS_COMMAND_PREFIX, prefixTxt.getText());
+ }
+
+ private void updateProjectNameProperty() {
+ IWizardPage[] pages = getWizard().getPages();
+ for (IWizardPage wizardPage : pages) {
+ if (wizardPage instanceof WizardNewProjectCreationPage) {
+ MBSCustomPageManager.addPageProperty(PAGE_ID, CROSS_PROJECT_NAME, ((WizardNewProjectCreationPage) wizardPage).getProjectName());
+ break;
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/messages.properties b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/messages.properties
new file mode 100644
index 00000000000..aed22f3dc2a
--- /dev/null
+++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/messages.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2011, 2012 Marc-Andre Laperle
+# 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 - initial API and implementation
+###############################################################################
+SetCrossCommandWizardPage_browse=Browse...
+SetCrossCommandWizardPage_description=Configure the Cross GCC path and prefix
+SetCrossCommandWizardPage_name=Cross GCC Command Wizard Page
+SetCrossCommandWizardPage_path=Cross compiler path:
+SetCrossCommandWizardPage_prefix=Cross compiler prefix:
+SetCrossCommandWizardPage_title=Cross GCC Command
diff --git a/cross/org.eclipse.cdt.build.crossgcc/templates/setCrossCommand/template.xml b/cross/org.eclipse.cdt.build.crossgcc/templates/setCrossCommand/template.xml
deleted file mode 100755
index f65902e8b88..00000000000
--- a/cross/org.eclipse.cdt.build.crossgcc/templates/setCrossCommand/template.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<template type="ProjTempl" version="1.0" supplier="Eclipse.org" revision="1.0" author="EclipseCon"
- copyright="Copyright (c) 2009 EclipseCon 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"
- id="EmptyProject" label="Cross-Compile Project" description="Set up a cross compiler"
- help="help.html">
-
- <property-group id="command" label="Command" description="The Cross Compile Command" type="PAGES-ONLY" help="help.html">
- <property id="prefix"
- label="Tool command prefix"
- description="The prefix to attach to the build commands, e.g. gcc"
- type="input"
- pattern=".*"
- default=""
- hidden="false"
- persist="true"/>
-
- <property id="path"
- label="Tool command path"
- description="The root directory for the toolchain"
- type="browsedir"
- pattern=".*"
- default=""
- hidden="false"
- persist="true"/>
- </property-group>
-
- <process type="org.eclipse.cdt.build.crossgcc.setCrossCommand">
- <simple name="projectName" value="$(projectName)"/>
- <simple name="prefix" value="$(prefix)"/>
- <simple name="path" value="$(path)"/>
- </process>
-
-</template>

Back to the top