Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Temporary replacement of the current configurations environment (Linux eclipse plugin)

Hi,

I am having some issues with integrating my plugin with the CDT environment.

The essential premise of my tool is that it is a drop in replacement
for gcc.  As such instead of running a build, when my tool runs, it
clones the current projects configuration, modifies it, sets it as the
active configuration, builds, and then reverts the changes it made.

Here is the snippet of code that does the cloning.

"""
ICProjectDescription projectDesc =
	CoreModel.getDefault().getProjectDescription(project);

ICConfigurationDescription previousConfDesc =
	projectDesc.getActiveConfiguration();

IConfiguration previousConf =
	ManagedBuildManager.getConfigurationForDescription(
	previousConfDesc);

final IManagedBuildInfo info =
	ManagedBuildManager.getBuildInfo(project);

final IManagedProject managedProject = info.getManagedProject();
IConfiguration newConf = managedProject.createConfigurationClone(
	previousConf, NewConfigurationID);

// update newConf's environment // *need help at this step.*

// update newConf as required

ICConfigurationDescription confDesc = projectDesc.createConfiguration(
	ManagedBuildManager.CFG_DATA_PROVIDER_ID, newConf.getConfigurationData());

confDesc.setActive();

// save changes
CoreModel.getDefault().setProjectDescription(project,
	projectDesc);

// do build step

// remove new configuration
previousConfDesc.setActive();
projectDesc.removeConfiguration(confDesc);

// revert changes
CoreModel.getDefault().setProjectDescription(project,
	projectDesc);

"""

I have successfully updated newConf and performed the build step,
however the tool i am using this configuration to invoke requires some
environment variables to be set (to a dynamic value, so a global
definition outside of eclipse will not do).  As such I have found no
way to modify the configurations EnvironmentVariableSupplier.

Any information that might help me is appreciated.

Regards,
Mark


Back to the top