Reputation: 139
As far as I know it is not posssible to have an array of values in a property file. What would be the best solution to store multiple values in a property?
e.g. part of property file
# directory definitions
# containing e.g. CSS, Javascript, ...
project.dirname_css = css
project.dirname_js = javascript
What I want is an array of properties like:
# directory definitions
# containing e.g. CSS, Javascript, ...
project.dirname_css = [css,portal_specific]
project.dirname_js = [javascript,portal_specific]
to loop them in the build.xml
Any suggestions how to do this?
I could imagine to do divide values by ; and explode them in the build.xml.
Any better suggestions?
Upvotes: 4
Views: 2569
Reputation: 2752
project.dirname_css = foo,bar,baz
And you will be able to iterate them with the phing forearch task :)
See: https://www.phing.info/guide/chunkhtml/ForeachTask.html
Upvotes: 8
Reputation: 5003
Coming across this a few years down the road. The provided link in Christoph's answer has changed to: https://www.phing.info/docs/guide/trunk/ForeachTask.html
Also here is my solution, using Christoph's idea. In my case, I had certain shell script files I needed to make sure where owner/group read/writeable:
// In the properties file:
project.perm775files = app/blocker.sh,app/tester.sh
// In the build xml file
<foreach list="${project.perm775files}" delimiter="," param="filepath" target="perm775" />
<target name="perm775">
<exec command="sudo chmod 775 ${filepath}" />
</target>
Upvotes: -1