Note that there are some explanatory texts on larger screens.

plurals
  1. POAnt macrodef compilation task
    primarykey
    data
    text
    <p>I have a compiler (and language) I am building that is normally invoked thus:</p> <pre><code>java -jar nc.jar \ -p some/referenced/package.nc \ -p framework.nc \ source1.ns source2.ns sourceN.ns \ -o output/package.nc </code></pre> <p>I'd like to include a task in my ANT build file that invokes the compiler to compile the standard library and all test cases, but specifying each separate compiler invocation as a <code>&lt;java&gt;</code> task is painful:</p> <pre><code>&lt;target name="framework" depends="compiler" description="Build the n framework"&gt; &lt;!-- More compile steps --&gt; &lt;java jar="nc.jar" fork="true"&gt; &lt;arg value="-p"/&gt; &lt;arg path="../nframework/build/n.core.nc"/&gt; &lt;arg path="../nframework/n/debug/DebugPrint.ns"/&gt; &lt;arg path="../nframework/n/debug/Trace.ns"/&gt; &lt;arg value="-o"/&gt; &lt;arg path="../nframework/build/n.debug.nc"/&gt; &lt;/java&gt; &lt;!-- More compile steps --&gt; &lt;/target&gt; </code></pre> <p>I would like to create an ANT task of some sort that can simplify this into something like:</p> <pre><code>&lt;target name="framework" depends="compiler" description="Build the n framework"&gt; &lt;!-- More compile steps --&gt; &lt;nc output="../nframework/build/n.debug.nc"&gt; &lt;link-package path="../nframework/build/n.core.nc"/&gt; &lt;src&gt; &lt;fileset dir="../nframework/n/debug" includes="**/*.ns"/&gt; &lt;/src&gt; &lt;/nc&gt; &lt;!-- More compile steps --&gt; &lt;/target&gt; </code></pre> <p>To this end, I tried macrodef:</p> <pre><code>&lt;macrodef name="nc"&gt; &lt;attribute name="output"/&gt; &lt;element name="link-package"/&gt; &lt;element name="src"/&gt; &lt;sequential&gt; &lt;java jar="nc.jar" fork="true"&gt; &lt;arg value="-p"/&gt; &lt;!-- This doesn't do what I want --&gt; &lt;link-package/&gt; &lt;!-- Neither does this --&gt; &lt;src/&gt; &lt;arg value="-o"/&gt; &lt;arg path="@{output}"/&gt; &lt;/java&gt; &lt;/sequential&gt; &lt;/macrodef&gt; </code></pre> <p>I've tried several variations on the above, but each errors out with something like: /home/jwarner/code/nlang/nc/build.xml:55: java doesn't support nested "fileset" element.</p> <p>Is there a way to do this without extending ANT itself? Alternatively, would it be fairly easy to add an ant task to my compiler? I'm not terribly picky about the syntax of the final <code>&lt;nc&gt;</code> task.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload