Reputation: 5444
It seems the only reliably provided property by ant is the "os.name" property. However this name has variants ;lie "Windows 8" "Windows 7" etc
But for my purposes both are "Windows" -
Is there a way to conditionally set a property based on a partial string match of another property value like the pseudo code below? specifically the os.name as the source value? using the default task set provided with a generic ant install?
if(a.property 'contains' "Windows")
another.property = "windows value"
else if(a.property contains 'Linux')
another.property = "linux value"
endif
Upvotes: 0
Views: 641
Reputation: 21192
You can use os family
<condition property="another.property" value="windows value" >
<os family="windows" />
</condition>
<condition property="another.property" value="linux value" >
<os family="unix" name="Linux"/>
</condition>
Upvotes: 2