[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [buckminster-dev] Property Expansion for Environment Variables

Hi Johannes,

There are two ways of resolving this. Either you add all properties to the property sets that you want to use like you suggest, or you let the ExpandingProperties recognize the ${env_var: prefix}. The advantage with the former is that it is simple and that the environment is included when iterating over the keys in the map. The advantage of the latter is that it will keep the map small (there's some copying going on) and is in line with current Eclipse functionality. My vote is on the latter because the use of env_var is uncommon (you're the first one asking for it the four years Buckminster has been active ;-) ) and we might have an urge to enable more prefixes.

Perhaps we should even consider having the ExpandingProperties consult the Eclipse property expander when we encounter a prefix? That way all the eclipse specific properties would work. What do you think?

- thomas

On 11/04/2010 07:19 PM, Johannes Utzig wrote:
Hi again,

I was having a look at the sources and was wondering what's the right
place to add these environment variables.
Would the static initializer of the RMContext be sufficient? It creates
the staticAdditions for the globalPropertyAdditions.
I was thinking of adding something like this to the initializer:
Map<String, String> env = System.getenv();
for (Entry<String, String> environmentVariable : env.entrySet()) {
additions.put("env_var:" + environmentVariable.getKey(),
environmentVariable.getValue()); //$NON-NLS-1$
}

Would that be the right place and right way to enable environment
variables for script files?

Best regards,
Johannes