@Override public void handleEvent(CProjectDescriptionEvent event) { // we are only interested in about to apply if (event.getEventType() != CProjectDescriptionEvent.ABOUT_TO_APPLY) return; ICProjectDescription projDesc = event.getNewCProjectDescription(); IEnvironmentVariableManager envManager = CCorePlugin.getDefault().getBuildEnvironmentManager(); IContributedEnvironment contribEnv = envManager.getContributedEnvironment(); if (projDesc.getActiveConfiguration() != null) { IEnvironmentVariable var = contribEnv.getVariable( ArduinoConst.ENV_KEY_JANTJE_PLATFORM_FILE, projDesc.getActiveConfiguration()); if (var != null) { IPath platformPath = new Path(var.getValue()); ArduinoHelpers.setProjectPathVariables( projDesc.getProject(), platformPath.removeLastSegments(1)); ArduinoHelpers.setTheEnvironmentVariables( projDesc.getProject(), projDesc.getActiveConfiguration(), false); try { ArduinoHelpers.addArduinoCodeToProject( projDesc.getProject(), projDesc.getActiveConfiguration()); } catch (CoreException e1) { Common.log( new Status( IStatus.ERROR, ArduinoConst.CORE_PLUGIN_ID, "Error adding the arduino code", e1)); } ArduinoLibraries.reAttachLibrariesToProject(projDesc.getActiveConfiguration()); } } }
@Override public IPath[] getOutputNames( IProject project, IConfiguration cConf, ITool tool, IPath[] primaryInputNames) { IPath[] outputNames = new IPath[primaryInputNames.length]; boolean bUseArchiver = Common.getBuildEnvironmentVariable( project, cConf.getName(), ArduinoConst.ENV_KEY_use_archiver, "TRUE") .toUpperCase() .equals("TRUE"); for (int curPath = 0; curPath < primaryInputNames.length; curPath++) { if (primaryInputNames[curPath].toString().startsWith("arduino") && (bUseArchiver)) { outputNames[curPath] = ArduinoHelpers.GetOutputName(primaryInputNames[curPath]).addFileExtension("o"); } else { return null; } } return outputNames; }