package org.tizen.nativeplatform.build;
import java.util.ArrayList;
+import java.util.List;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
@Override
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration,
IEnvironmentVariableProvider provider) {
- // set "SBI_SYSROOT" variable
- String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
- String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
- if (sysrootPath == null) {
- sysrootPath = "";
+
+ if (variableName.equals("SBI_SYSROOT")) {
+ // set "SBI_SYSROOT" variable
+ String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
+ String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(
+ basePath);
+ if (sysrootPath == null) {
+ sysrootPath = "";
+ }
+ return new BuildEnvVar("SBI_SYSROOT", sysrootPath,
+ IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
+
+ } else if (variableName.equals("BUILD_TYPE")) {
+ String buildtype = "";
+ if (configuration.getBaseId().contains(
+ PlatformConfigurationManager.SBI_DEFAULT_DEBUG_CONFIGRATION_ID)) {
+ buildtype = "Debug";
+ } else if (configuration.getBaseId().contains(
+ PlatformConfigurationManager.SBI_DEFAULT_RELEASE_CONFIGRATION_ID)) {
+ buildtype = "Release";
+ } else {
+ buildtype = "";
+ }
+ return new BuildEnvVar("BUILD_TYPE", buildtype,
+ IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
}
- return new BuildEnvVar("SBI_SYSROOT", sysrootPath,
- IBuildEnvironmentVariable.ENVVAR_REPLACE, null);
+ return null;
}
@Override
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration,
IEnvironmentVariableProvider provider) {
- ArrayList<IBuildEnvironmentVariable> list = new ArrayList<IBuildEnvironmentVariable>();
+ List<IBuildEnvironmentVariable> list = new ArrayList<IBuildEnvironmentVariable>();
+ final String[] buildEnvs = { "SBI_SYSROOT", "BUILD_TYPE" };
+ String[] envs = buildEnvs;
- // set "SBI_SYSROOT" variable
- String basePath = PlatformConfigurationManager.getRootstrapPath(configuration);
- String sysrootPath = SmartBuildInterface.getInstance().getPlatformRootstrapPath(basePath);
- if (sysrootPath == null) {
- sysrootPath = "";
+ for (String env : envs) {
+ list.add(getVariable(env, configuration, provider));
}
- list.add(new BuildEnvVar("SBI_SYSROOT", sysrootPath,
- IBuildEnvironmentVariable.ENVVAR_REPLACE, null));
+
return list.toArray(new IBuildEnvironmentVariable[0]);
}