Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] How to obtain the existing environment in an environment variable supplier

Hi all,

 

I’m trying to create an environment variable supplier which should mostly do the same as the default but modify certain elements of the environment based upon some rules. Reading the javadoc for IConfigurationEnvironmentVariableSupplier I had expected to do something like this:

 

public IBuildEnvironmentVariable getVariable(String varName, IConfiguration cfg, IEnvironmentVariableProvider provider) {

                IEnvironmentVariable envVar = provider.getVariable(varName, cfg, true);

                If(envVar.getValue().equals(“SOMETEST”)) {

                //code to transform environment variable here

}

                IBuildEnvironmentVariable bEnvVar = new BuildEnvVar(envVar);

                return bEnvVar;

}

 

But the call to provider.getVariable always returns null, even for variables I’ve added to the configuration. How should I go about getting the environment from within an environmentsupplier whilst avoiding infinite loops?

 

Thanks in advance

 

Phil Mason

 


Back to the top