source: rtems-eclipse-plug-in/org.rtems.cdt.toolchain2/org/rtems/cdt/build/EnvironmentSupplier.java @ d280296

Last change on this file since d280296 was d280296, checked in by Sebastian Huber <sebastian.huber@…>, on 12/02/08 at 16:20:37

Cleanup.

  • Property mode set to 100644
File size: 1.7 KB
Line 
1/*
2 * Copyright (c) 2008
3 * Embedded Brains GmbH
4 * Obere Lagerstr. 30
5 * D-82178 Puchheim
6 * Germany
7 * rtems@embedded-brains.de
8 *
9 * The license and distribution terms for this file may be found in the file
10 * LICENSE in this distribution or at http://www.rtems.com/license/LICENSE.
11 */
12
13package org.rtems.cdt.build;
14
15import org.eclipse.core.resources.IProject;
16import org.eclipse.core.runtime.IPath;
17import org.eclipse.core.runtime.Path;
18import org.eclipse.cdt.managedbuilder.core.IManagedProject;
19import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
20import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
21import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
22import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
23import org.rtems.cdt.Constants;
24import org.rtems.cdt.Storage;
25
26public class EnvironmentSupplier implements IProjectEnvironmentVariableSupplier {
27        private static final int PATH_INDEX = 0;
28       
29        private static final int VARIABLE_COUNT = 1;
30
31        public IBuildEnvironmentVariable getVariable( String name, IManagedProject project, IEnvironmentVariableProvider provider) {
32                if (name.equals( "PATH")) {
33                        IPath path = new Path(
34                                Storage.getProperty( (IProject) project.getOwner(), Constants.BASE_PATH_KEY)
35                        );
36                        path = path.append( "bin");
37                       
38                        return new BuildEnvVar( name, path.toOSString(), IBuildEnvironmentVariable.ENVVAR_PREPEND, Constants.PATH_SEPERATOR);
39                }
40
41                return null;
42        }
43
44        public IBuildEnvironmentVariable [] getVariables( IManagedProject project, IEnvironmentVariableProvider provider) {
45                IBuildEnvironmentVariable variables [] = new IBuildEnvironmentVariable [VARIABLE_COUNT];
46               
47                variables [PATH_INDEX] = getVariable( "PATH", project, provider);
48               
49                return variables;
50        }
51}
Note: See TracBrowser for help on using the repository browser.