phingofficial / phing

PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.
https://www.phing.info
GNU Lesser General Public License v3.0
1.16k stars 319 forks source link

FileSet erroronmissingdir attribute does not work #1856

Closed demiankatz closed 2 months ago

demiankatz commented 3 months ago

Describe the bug In version 3.0.0, the erroronmissingdir of FileSet does not work. It is a documented setting, but when I add the attribute to my FileSet, Phing fails with Phing\Type\FileSet doesn't support the 'erroronmissingdir' attribute. I took a look at the code and found that there is an errorOnMissingDir property in the AbstractFileSet class; the error seems to be caused by a missing getter. I tried editing the class to add this getter:

    public function setErrorOnMissingDir($errorOnMissingDir)
    {
        $this->errorOnMissingDir = $errorOnMissingDir;
    }

This eliminates the error message, but the property seems to have no effect -- even though it defaults to false, I seem to always get the "true" behavior. I want to be able to get an empty file set if pointing at a non-existent directory.

Steps To Reproduce This is the task in my build.xml that is failing.

  <target name="import_authorities" description="import all authority test records">
    <foreach param="relfilename" absparam="filename" target="importauthrec">
      <fileset dir="${marc_authority_dir}" erroronmissingdir="false">
          <include name="*.mrc" />
      </fileset>
    </foreach>
  </target>

Expected behavior

I expected the attribute to be supported and to work as documented, instead of to be unsupported and not work at all.

Additional context

Please let me know if I can do anything more to help, and thanks for Phing, which has been a valuable tool for my project. This is not an emergency as I'm sure I can work around the limitation -- but it would be nice to have all documented features working correctly in future.

mrook commented 2 months ago

Thanks for the report @demiankatz ! If you'd like to contribute, there are other issues currently open and looking for pull requests :-)

demiankatz commented 2 months ago

Thanks for the report @demiankatz ! If you'd like to contribute, there are other issues currently open and looking for pull requests :-)

Have you considered adding a "good first issue" tag to help point people to reasonable starting points for contribution? That might be helpful for newcomers!

I'm working through my own backlog at the moment, but I'm certainly open to contributing in future, especially if it helps to ensure the project remains active and healthy. Feel free to call on me if there's ever an issue that needs attention and isn't getting enough. :-)

mrook commented 2 months ago

Good suggestion.