Skip to main content
summaryrefslogtreecommitdiffstats
path: root/cross
diff options
context:
space:
mode:
authorVivian Kong2009-05-26 16:52:26 -0400
committerVivian Kong2009-05-26 16:52:26 -0400
commitc95d03759bbd2b01cac03dc332a781ddbf8e2a39 (patch)
tree0fa825ab9f71f6bd13fa0df84b6ac177bd071a9c /cross
parentec2f7923b9c4d3710f313f2da8a73fab49caacbe (diff)
downloadorg.eclipse.cdt-c95d03759bbd2b01cac03dc332a781ddbf8e2a39.tar.gz
org.eclipse.cdt-c95d03759bbd2b01cac03dc332a781ddbf8e2a39.tar.xz
org.eclipse.cdt-c95d03759bbd2b01cac03dc332a781ddbf8e2a39.zip
update copyrights
Diffstat (limited to 'cross')
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc-feature/build.properties10
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplateFeature/build.properties2
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/about.properties2
-rw-r--r--cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/build.properties2
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/build.properties22
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/build/crossgcc/SetCrossCommandProcess.java142
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Activator.java110
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossCommandLineGenerator.java58
-rwxr-xr-xcross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/CrossEnvironmentVariableSupplier.java152
9 files changed, 280 insertions, 220 deletions
diff --git a/cross/org.eclipse.cdt.build.crossgcc-feature/build.properties b/cross/org.eclipse.cdt.build.crossgcc-feature/build.properties
index 01b0213b80..839d18496b 100644
--- a/cross/org.eclipse.cdt.build.crossgcc-feature/build.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc-feature/build.properties
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2009 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:
+# IBM Corporation - initial API and implementation
+###############################################################################
bin.includes = feature.xml,\
feature.properties,\
epl-v10.html,\
diff --git a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplateFeature/build.properties b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplateFeature/build.properties
index 231dfcf148..eb69c975a3 100644
--- a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplateFeature/build.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplateFeature/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2008 IBM Corporation and others.
+# Copyright (c) 2008, 2009 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
diff --git a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/about.properties b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/about.properties
index 7f67a90db6..7258f35f18 100644
--- a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/about.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/about.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005 IBM Corporation and others.
+# Copyright (c) 2005, 2009 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
diff --git a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/build.properties b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/build.properties
index 811ba521d7..55291e25f6 100644
--- a/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/build.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc-feature/sourceTemplatePlugin/build.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2005, 2006 IBM Corporation and others.
+# Copyright (c) 2005, 2009 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
diff --git a/cross/org.eclipse.cdt.build.crossgcc/build.properties b/cross/org.eclipse.cdt.build.crossgcc/build.properties
index e3b57a2fde..fb55103b45 100755
--- a/cross/org.eclipse.cdt.build.crossgcc/build.properties
+++ b/cross/org.eclipse.cdt.build.crossgcc/build.properties
@@ -1,6 +1,16 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- templates/
+###############################################################################
+# Copyright (c) 2009 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
+###############################################################################
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ templates/
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/build/crossgcc/SetCrossCommandProcess.java
index efcec43f26..e415bee694 100755
--- 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/build/crossgcc/SetCrossCommandProcess.java
@@ -1,66 +1,76 @@
-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.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.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();
- IScannerConfigBuilderInfo2 bi = map.values().iterator().next();
- String providerId = "specsFile";
- String runCommand = bi.getProviderRunCommand(providerId);
- bi.setProviderRunCommand(providerId, prefix + runCommand);
- try {
- bi.save();
- } catch (CoreException e) {
- throw new ProcessFailureException(e);
- }
- }
-
- ManagedBuildManager.saveBuildInfo(project, true);
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 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.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.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();
+ IScannerConfigBuilderInfo2 bi = map.values().iterator().next();
+ String providerId = "specsFile";
+ String runCommand = bi.getProviderRunCommand(providerId);
+ bi.setProviderRunCommand(providerId, prefix + runCommand);
+ try {
+ bi.save();
+ } catch (CoreException e) {
+ throw new ProcessFailureException(e);
+ }
+ }
+
+ ManagedBuildManager.saveBuildInfo(project, true);
+
+ }
+
+}
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 b508529561..085dcfdd08 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,50 +1,60 @@
-package org.eclipse.cdt.internal.build.crossgcc;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "tut.cross.good";
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 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.internal.build.crossgcc;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "tut.cross.good";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
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 c64fd7bd98..0a1354f890 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,24 +1,34 @@
-package org.eclipse.cdt.internal.build.crossgcc;
-
-import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
-import org.eclipse.cdt.managedbuilder.core.IOption;
-import org.eclipse.cdt.managedbuilder.core.ITool;
-import org.eclipse.cdt.managedbuilder.core.IToolChain;
-import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
-
-public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
-
- @Override
- public IManagedCommandLineInfo generateCommandLineInfo(ITool tool,
- String commandName, String[] flags, String outputFlag,
- String outputPrefix, String outputName, String[] inputResources,
- String commandLinePattern) {
- IToolChain toolchain = (IToolChain)tool.getParent();
- IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix");
- String prefix = (String)option.getValue();
- String newCommandName = prefix + commandName;
- return super.generateCommandLineInfo(tool, newCommandName, flags, outputFlag,
- outputPrefix, outputName, inputResources, commandLinePattern);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2009 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.internal.build.crossgcc;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
+
+public class CrossCommandLineGenerator extends ManagedCommandLineGenerator {
+
+ @Override
+ public IManagedCommandLineInfo generateCommandLineInfo(ITool tool,
+ String commandName, String[] flags, String outputFlag,
+ String outputPrefix, String outputName, String[] inputResources,
+ String commandLinePattern) {
+ IToolChain toolchain = (IToolChain)tool.getParent();
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix");
+ String prefix = (String)option.getValue();
+ String newCommandName = prefix + commandName;
+ return super.generateCommandLineInfo(tool, newCommandName, flags, outputFlag,
+ outputPrefix, outputName, inputResources, commandLinePattern);
+ }
+
+}
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 368e80e408..51f5036a91 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,71 +1,81 @@
-package org.eclipse.cdt.internal.build.crossgcc;
-
-import java.io.File;
-
-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.envvar.IBuildEnvironmentVariable;
-import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
-import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
-import org.eclipse.core.runtime.Platform;
-
-public class CrossEnvironmentVariableSupplier implements
- IConfigurationEnvironmentVariableSupplier {
-
- public IBuildEnvironmentVariable getVariable(String variableName,
- IConfiguration configuration, IEnvironmentVariableProvider provider) {
- if (PathEnvironmentVariable.isVar(variableName))
- return PathEnvironmentVariable.create(configuration);
- else
- return null;
- }
-
- public IBuildEnvironmentVariable[] getVariables(
- IConfiguration configuration, IEnvironmentVariableProvider provider) {
- IBuildEnvironmentVariable path = PathEnvironmentVariable.create(configuration);
- return path != null ? new IBuildEnvironmentVariable[] { path } : new IBuildEnvironmentVariable[0];
- }
-
- private static class PathEnvironmentVariable implements IBuildEnvironmentVariable {
-
- public static String name = "PATH";
-
- private File path;
-
- private PathEnvironmentVariable(File path) {
- this.path = path;
- }
-
- public static PathEnvironmentVariable create(IConfiguration configuration) {
- IToolChain toolchain = configuration.getToolChain();
- IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path");
- String path = (String)option.getValue();
- return new PathEnvironmentVariable(new File(path, "bin"));
- }
-
- public static boolean isVar(String name) {
- // Windows has case insensitive env var names
- return Platform.getOS().equals(Platform.OS_WIN32)
- ? name.equalsIgnoreCase(PathEnvironmentVariable.name)
- : name.equals(PathEnvironmentVariable.name);
- }
-
- public String getDelimiter() {
- return Platform.getOS().equals(Platform.OS_WIN32) ? ";" : ":";
- }
-
- public String getName() {
- return name;
- }
-
- public int getOperation() {
- return IBuildEnvironmentVariable.ENVVAR_PREPEND;
- }
-
- public String getValue() {
- return path.getAbsolutePath();
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2009 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.internal.build.crossgcc;
+
+import java.io.File;
+
+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.envvar.IBuildEnvironmentVariable;
+import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
+import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
+import org.eclipse.core.runtime.Platform;
+
+public class CrossEnvironmentVariableSupplier implements
+ IConfigurationEnvironmentVariableSupplier {
+
+ public IBuildEnvironmentVariable getVariable(String variableName,
+ IConfiguration configuration, IEnvironmentVariableProvider provider) {
+ if (PathEnvironmentVariable.isVar(variableName))
+ return PathEnvironmentVariable.create(configuration);
+ else
+ return null;
+ }
+
+ public IBuildEnvironmentVariable[] getVariables(
+ IConfiguration configuration, IEnvironmentVariableProvider provider) {
+ IBuildEnvironmentVariable path = PathEnvironmentVariable.create(configuration);
+ return path != null ? new IBuildEnvironmentVariable[] { path } : new IBuildEnvironmentVariable[0];
+ }
+
+ private static class PathEnvironmentVariable implements IBuildEnvironmentVariable {
+
+ public static String name = "PATH";
+
+ private File path;
+
+ private PathEnvironmentVariable(File path) {
+ this.path = path;
+ }
+
+ public static PathEnvironmentVariable create(IConfiguration configuration) {
+ IToolChain toolchain = configuration.getToolChain();
+ IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path");
+ String path = (String)option.getValue();
+ return new PathEnvironmentVariable(new File(path, "bin"));
+ }
+
+ public static boolean isVar(String name) {
+ // Windows has case insensitive env var names
+ return Platform.getOS().equals(Platform.OS_WIN32)
+ ? name.equalsIgnoreCase(PathEnvironmentVariable.name)
+ : name.equals(PathEnvironmentVariable.name);
+ }
+
+ public String getDelimiter() {
+ return Platform.getOS().equals(Platform.OS_WIN32) ? ";" : ":";
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public int getOperation() {
+ return IBuildEnvironmentVariable.ENVVAR_PREPEND;
+ }
+
+ public String getValue() {
+ return path.getAbsolutePath();
+ }
+
+ }
+}

Back to the top