build.xml
現在使用中の ImportTaskに、ディレクトリ内のすべての xml ファイルを含める必要があります (ファイルの名前と数はわかりません) 。
これは私のbuild.xml
ファイルです:
<?xml version="1.0" encoding="utf-8"?>
<project name="New Project" basedir="." default="myimport">
<target name="myimport" description="dummy to import other build files">
<if>
<isset property="file" />
<then>
<echo msg="Importing ${file}" />
<import file="${file}" />
</then>
</if>
</target>
<if>
<not>
<isset property="dummy.property" />
</not>
<then>
<echo msg="Now include all files in ./dev/build directory" />
<property name="dummy.property" value="true" />
<foreach param="msg" absparam="file" target="myimport">
<fileset dir="./dev/build/">
<include name="*.xml"/>
</fileset>
</foreach>
</then>
</if>
</project>
およびターゲット ディレクトリのサンプル ファイル:
<?xml version="1.0" encoding="utf-8"?>
<project name="test" basedir="." default="dummy">
<target name="dummy" description="Dummy task">
<echo msg="Dummy task, just for test" />
</target>
<echo msg="Imported!" />
</project>
私が実行したとき phing -l
の結果は次のとおりです。
Buildfile: /home/f0rud/workspace/s/build.xml
[echo] Now include all files in ./dev/build directory
[foreach] Calling Buildfile '/home/f0rud/workspace/s/build.xml' with target 'myimport'
New Project > myimport:
[echo] Importing ./dev/build/test.xml
[echo] Imported!
Default target:
----------------------------------------------------------------------------
myimport dummy to import other build files
Main targets:
----------------------------------------------------------------------------
myimport dummy to import other build files
しかし、ダミー (または test.dummy) ターゲットがないのはなぜですか?
注:if部分を削除すると、面白いバグがありますが、それMaximum function nesting level of '100' reached, aborting! error
は私の問題ではありません(ifはその問題を解決します)。