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