How to iterate (loop) through directories in phing?

I want to create a phing task for some plugins, so the directory structure is something like

root - plugin1 - index.php - plugin2 - index.php 

etc..

I want to run the same tasks in every subdirectory - for example

  • create doc for plugin1
  • run unit tests for plugin1
  • deploy plugin1 somewhere
  • create doc for plugnin2 ...

Is it possible? I need something like

 <foreach param="filename" absparam="absfilename" target="subtask"> <fileset dir="."> <include name="*.php"/> </fileset> </foreach> 

but for directories.

Or do I need to write build.xml for each individual plugin?

Thank you very much.

+4
source share
1 answer

Finally, I found selectors that can solve my query:

 <foreach param="dirname" absparam="absname" target="subtask"> <fileset dir="${ws}/source/"> <type type="dir" /> <depth max="0" min="0" /> </fileset> </foreach> 

and challenge some task to do things

 <target name="subtask"> <echo msg="${dirname} ${absname}" /> </target> 
+13
source

Source: https://habr.com/ru/post/1332226/


All Articles