Skip to main content

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

Hi Mark,

In the org.eclipse.cdt.core.tests plugin have a look at
IEnvironmentVariableManagerTests.java.

Creating and destroying build configurations seems like a pretty
heavyweight way of achieving tool substitution. Would hooking in a
command line generator for the tool you're intending to override (see
the commandLineGenerator attribute in <tool) work?

Cheers,
James

On 11 February 2010 23:49, Mark Bradley <mark.bradley@xxxxxxxxxxxxxx> wrote:
> 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
> _______________________________________________
> cdt-dev mailing list
> cdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/cdt-dev
>


Back to the top