Uploaded image for project: 'Pig'
  1. Pig
  2. PIG-2362

Rework Ant build.xml to use macrodef instead of antcall

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.12.0
    • Component/s: None
    • Labels:
      None

      Description

      Antcall is evil: http://www.build-doctor.com/2008/03/13/antcall-is-evil/
      We'd better use macrodef and let Ant build a clean dependency graph.
      http://ant.apache.org/manual/Tasks/macrodef.html

      Right now we do like this:

      <target name="buildAllJars">
        <antcall target="buildJar">
          <param name="build.dir" value="jar-A"/>
        </antcall>
        <antcall target="buildJar">
          <param name="build.dir" value="jar-B"/>
        </antcall>
        <antcall target="buildJar">
          <param name="build.dir" value="jar-C"/>
        </antcall>
      </target>
      <target name="buildJar">
        <jar destfile="target/${build.dir}.jar" basedir="${build.dir}/classfiles"/>
      </target>
      

      But it would be better if we did like this:

      <target name="buildAllJars">
        <buildJar build.dir="jar-A"/>
        <buildJar build.dir="jar-B"/>
        <buildJar build.dir="jar-C"/>
      </target>
      
      <macrodef name="buildJar">
        <attribute name="build.dir"/>
        <jar destfile="target/${build.dir}.jar" basedir="${build.dir}/classfiles"/>
      </macrodef>
      

        Attachments

        1. PIG-2362.1.patch
          14 kB
          Gianmarco De Francisci Morales
        2. PIG-2362.2.patch
          29 kB
          Gianmarco De Francisci Morales
        3. PIG-2362.3.patch
          29 kB
          Gianmarco De Francisci Morales
        4. PIG-2362.4.patch
          29 kB
          Gianmarco De Francisci Morales
        5. PIG-2362.5.patch
          30 kB
          Gianmarco De Francisci Morales
        6. PIG-2362.6.patch
          29 kB
          Gianmarco De Francisci Morales
        7. PIG-2362.7.patch
          31 kB
          Cheolsoo Park
        8. PIG-2362.8.patch
          31 kB
          Cheolsoo Park
        9. PIG-2362.9.patch
          76 kB
          Cheolsoo Park
        10. PIG-2362.9.patch.nowhitespace
          28 kB
          Cheolsoo Park
        11. PIG-2362.10.patch
          75 kB
          Cheolsoo Park

          Issue Links

            Activity

              People

              • Assignee:
                azaroth Gianmarco De Francisci Morales
                Reporter:
                azaroth Gianmarco De Francisci Morales
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: