Erlang & Ant

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Erlang & Ant

François-Denis Gonthier-2
Yesterday, I've worked hard to get Ant to compile a little Erlang project.
It's only the second buildfile I've ever written so I might have missed some

I've decided to use a more standard way of building my projects (Emakefile)
but I think it's a waste to simply erase what took me hours of a perfectly
good Sunday night so I decided to send it to this mailing list, in hope that
interested people will find it.

<?xml version="1.0"?>
<project name="ErlangIRC" default="compile" basedir=".">

  <taskdef resource="net/sf/antcontrib/">
      <pathelement location=".\lib\ant-contrib-1.0b1.jar"/>

  <property name="outdir" value="ebin" />
  <property name="srcdir" value="src" />

  <property name="erlang.compiler" value="c:\Devel\Erlang\bin\erlc.exe" />
  <property name="erlang.runtime" value="c:\Devel\Erlang\bin\erl.exe" />

  <fileset id="srcfiles" dir="src" includes="*.erl" />
  <fileset id="outfiles" dir="ebin" includes="*.beam" />

  <target name="compile">
    <foreach target="erlang-compile" param="erlang.file">
        <fileset refid="srcfiles" />

  <target name="erlang-compile">
    <uptodate srcfile="${erlang.file}" property="">
      <mapper type="regexp"
        to="\1\\${outdir}\\\2.beam" />
    <if><not><istrue value="${}" /></not>
        <exec executable="${erlang.compiler}" dir=".">
          <arg value="+debug_info" />
          <arg value="-W" />
          <arg value="-oebin" />
          <arg value="${erlang.file}" />