source: rtems-eclipse-plug-in/org.rtems.cdt/src/org/rtems/cdt/build/EnvironmentSupplier.java @ 6740c53

Last change on this file since 6740c53 was 6740c53, checked in by Sebastian Huber <sebastian.huber@…>, on 12/04/08 at 14:53:45

Initial commit.

  • Property mode set to 100644
File size: 2.2 KB
Line 
1/*
2 * Copyright (c) 2008 Embedded Brains GmbH and others.
3 *
4 *   Embedded Brains GmbH
5 *   Obere Lagerstr. 30
6 *   D-82178 Puchheim
7 *   Germany
8 *   rtems@embedded-brains.de
9 *
10 * All rights reserved.  This program and the accompanying materials are made
11 * available under the terms of the Eclipse Public License Version 1.0 ("EPL")
12 * which accompanies this distribution and is available at
13 *
14 *   http://www.eclipse.org/legal/epl-v10.html
15 *
16 * For purposes of the EPL, "Program" will mean the Content.
17 *
18 * Contributors:
19 *
20 *   Sebastian Huber (Embedded Brains GmbH) - Initial API and implementation.
21 */
22
23package org.rtems.cdt.build;
24
25import org.eclipse.core.resources.IProject;
26import org.eclipse.cdt.managedbuilder.core.IConfiguration;
27import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
28import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier;
29import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
30import org.eclipse.cdt.managedbuilder.internal.envvar.BuildEnvVar;
31import org.rtems.cdt.Constants;
32import org.rtems.cdt.Storage;
33
34public class EnvironmentSupplier implements IConfigurationEnvironmentVariableSupplier {
35        private static final int PATH_INDEX = 0;
36
37        private static final int VARIABLE_COUNT = 1;
38
39        protected String getPlatform() {
40                return Constants.PLATFORM_DEFAULT;
41        }
42
43        public IBuildEnvironmentVariable getVariable( String name, IConfiguration configuration, IEnvironmentVariableProvider provider) {
44                if (name.equals( "PATH")) {
45                        IProject project = (IProject) configuration.getOwner();
46
47                        // Change platform
48                        Storage.changePlatform( project, getPlatform());
49
50                        // Get path parts
51                        String part = Storage.getProperty( project, Constants.PATH_PREPEND_KEY);
52
53                        return new BuildEnvVar( name, part, IBuildEnvironmentVariable.ENVVAR_PREPEND, Constants.PATH_SEPARATOR);
54                }
55
56                return null;
57        }
58
59        public IBuildEnvironmentVariable [] getVariables( IConfiguration configuration, IEnvironmentVariableProvider provider) {
60                IBuildEnvironmentVariable variables [] = new IBuildEnvironmentVariable [VARIABLE_COUNT];
61
62                variables [PATH_INDEX] = getVariable( "PATH", configuration, provider);
63
64                return variables;
65        }
66}
Note: See TracBrowser for help on using the repository browser.