use of org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable in project arduino-eclipse-plugin by Sloeber.
the class SloeberBuildVariableSupplier method setValues.
private void setValues() {
// Build Time to set clock based on computer time
Date d = new Date();
GregorianCalendar cal = new GregorianCalendar();
long current = d.getTime() / 1000;
long timezone = cal.get(Calendar.ZONE_OFFSET) / 1000;
long daylight = cal.get(Calendar.DST_OFFSET) / 1000;
myValues = new IBuildEnvironmentVariable[4];
// $NON-NLS-1$
myValues[0] = (new BuildEnvironmentVariable("A.EXTRA.TIME.UTC", Long.toString(current)));
myValues[1] = (new // $NON-NLS-1$
BuildEnvironmentVariable(// $NON-NLS-1$
"A.EXTRA.TIME.LOCAL", Long.toString(current + timezone + daylight)));
// $NON-NLS-1$
myValues[2] = (new BuildEnvironmentVariable("A.EXTRA.TIME.ZONE", Long.toString(timezone)));
// $NON-NLS-1$
myValues[3] = (new BuildEnvironmentVariable("A.EXTRA.TIME.DTS", Long.toString(daylight)));
}
use of org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable in project arduino-eclipse-plugin by Sloeber.
the class SloeberConfigurationVariableSupplier method getVariables.
@Override
public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, IEnvironmentVariableProvider provider) {
Map<String, String> retVars = new HashMap<>();
Map<String, String> workbenchVars = BoardsManager.getEnvironmentVariables();
if (workbenchVars != null) {
retVars.putAll(workbenchVars);
}
SloeberProject sloeberProject = getSloeberProject(configuration);
if (sloeberProject != null) {
Map<String, String> boardEnvVars = sloeberProject.getEnvironmentVariables(configuration.getName());
if (boardEnvVars != null) {
retVars.putAll(boardEnvVars);
}
}
IBuildEnvironmentVariable[] ret = new BuildEnvironmentVariable[retVars.size()];
int i = 0;
for (Entry<String, String> curVar : retVars.entrySet()) {
ret[i++] = new BuildEnvironmentVariable(curVar.getKey(), curVar.getValue());
}
return ret;
}
use of org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable in project arduino-eclipse-plugin by Sloeber.
the class SloeberConfigurationVariableSupplier method getVariable.
@Override
public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, IEnvironmentVariableProvider provider) {
String ret = null;
SloeberProject sloeberProject = getSloeberProject(configuration);
if (sloeberProject == null) {
return null;
}
Map<String, String> boardEnvVars = sloeberProject.getEnvironmentVariables(configuration.getName());
if (null != boardEnvVars) {
ret = boardEnvVars.get(variableName);
}
if (ret == null) {
// when the configuration doesn't hold the env var maybe the workbench does
ret = BoardsManager.getEnvironmentVariables().get(variableName);
}
if (ret == null) {
return null;
}
return new BuildEnvironmentVariable(variableName, ret);
}
Aggregations