0

I've tried to create a symlink like:

<symlink link="${basedir}/docroot" resource="${basedir}/drupal-7.*" overwrite="true"/>

however, the line doesn't expand the wildcard but creates a link which points literally to drupal-7.*, not to drupal-7.56.

I've tried to use examples with fileset on this page, but it doesn't really cover my scenario.

How can I create an Ant's symlink which points to a dynamic folder (the one expanded by drupal-7.*)?

kenorb
  • 155,785
  • 88
  • 678
  • 743

2 Answers2

1

You should use dirset instead of fileset to include directories, not files. Also, it would probably be a good idea to check for an unexpected number of directories as well.

Here is the example:

<dirset dir="${basedir}" includes="drupal-7.*" id="link.target" />

<fail message="Multiple or zero drupal-7.* directories found.">
    <condition>
        <not>
            <resourcecount refid="link.target" when="equal" count="1" />
        </not>
    </condition>
</fail>

<symlink link="${basedir}/docroot" resource="${toString:link.target}" />
kenorb
  • 155,785
  • 88
  • 678
  • 743
CAustin
  • 4,525
  • 13
  • 25
0

Here is the solution by invoking shell command:

<exec executable="sh" failonerror="true" dir="${basedir}" outputproperty="drupaldir">
  <arg value="-c"/>
  <arg value="echo drupal-7*"/>
</exec>
<symlink link="${basedir}/docroot" resource="${basedir}/${drupaldir}" overwrite="true"/>
kenorb
  • 155,785
  • 88
  • 678
  • 743