You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Klaus Alfert <al...@udo.cs.uni-dortmund.de> on 2000/11/03 07:25:04 UTC

Ant and LaTeX

Hi Folks,

I like using ANT and as I use also LaTeX in our projects, I hacked a
small LaTeX-Target together. It works for easy things and is my first
attempt to write an extension to ANT. You can download it at 

  http://ls10-www.cs.uni-dortmund.de/~alfert/ant-extension/

It runs (and is tested) with ANT 1.2, Java 1.3.0 and teTeX 1.0 on
Linux. I assume that there is currently a dependency on Java 1.3.0 as
I have a an exec call in java.lang.Runtime which does not exist in
1.2.2. The next step in my plan is to understand the various
Exec-Classes in org.apache.ant.taskdefs to make anttex at least
independent from the JVM version. So, I'm interested in any feedback,
suggestions for a better code structures, other features, etc. 

Have fun,
Klaus.
-- 
--------------------------------------------------------------------
Klaus Alfert                          alfert@ls10.cs.uni-dortmund.de
Software Technology                   +49+231+755-4812
CS Department, University Dortmund

Re: Problems with filesets and ant..

Posted by Stefan Bodewig <bo...@bost.de>.
<ro...@elastica.com> wrote:

> Why doesn't this do what I think
> 
> My rule is
> 
> <execon executable="jspc.bat" os"Windows NT">
> 	<fileset dir="." includes="**/*.jsp"/>
> </execon>
> 
> These generates paths such as
> 
> C:\plymediadev\html\aboutus\aboutus\history.jsp
> 

You are the second person reporting that Ant repeats part of the path
on Windows sometimes, I cannot reproduce it myself, sorry. The obvious
question would be "which version of Ant".

Furthermore, what is your project's basedir set to and are you
invoking Ant from the same directory or are you using ant -f somepath.

Stefan

Problems with filesets and ant..

Posted by ro...@elastica.com.
Why doesn't this do what I think

My rule is

<execon executable="jspc.bat" os"Windows NT">
	<fileset dir="." includes="**/*.jsp"/>
</execon>

These generates paths such as

C:\plymediadev\html\aboutus\aboutus\history.jsp

Why does it repeat the aboutus path? history.jsp should be under
the first one. There is no aboutus in aboutus.





Re: Ant and LaTeX

Posted by Klaus Alfert <al...@udo.cs.uni-dortmund.de>.
Hi Stefan,

it works now (and out of the box: that was cool). 

>>>>> "S" == Stefan Bodewig <bo...@bost.de> writes:

>>>>> "KA" == Klaus Alfert <al...@udo.cs.uni-dortmund.de> writes:
KA> My problem was that I want to change the directory before tex is
KA> called. The easiest way was just to use the new API - I just
KA> didn't recognize that this call is not the older API.

S> This is exactly what Execute tries to hide. Basically you do something
S> like

S>   // Create an Execute instance and make sure output gets to Ant's
S>   // logging system. No timeout.
S>   Execute execute = 
S>     new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), null);

I see. My attempt was to use simply new Execute();, but this it is at
least clearer what is happening.  

S>   execute.setCommandline(YOUR_COMMAND_HERE);

S>   // set your working directory
S>   execute.setWorkingDirectory(dir);
S>   // allow Ant to find the antRun script if necessary
S>   execute.setAntRun(project);

This is a nice hint. Thanks.

S>   // run your command
S>   exitValue = execute.execute();

S> This will go a long way to avoid using a helper script (antRun does a
S> cd dir and than invokes the command), taking special measures on JDK
S> 1.3, MacOS (where you can change user.dir), Windows NT/2000 and OS/2.

Thanks for your advice. I will publish the next release this
afternoon. 

Klaus.
-- 
--------------------------------------------------------------------
Klaus Alfert                          alfert@ls10.cs.uni-dortmund.de
Software Technology                   +49+231+755-4812
CS Department, University Dortmund

Re: Ant and LaTeX

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "KA" == Klaus Alfert <al...@udo.cs.uni-dortmund.de> writes:

 KA> My problem was that I want to change the directory before tex is
 KA> called. The easiest way was just to use the new API - I just
 KA> didn't recognize that this call is not the older API.

This is exactly what Execute tries to hide. Basically you do something
like

  // Create an Execute instance and make sure output gets to Ant's
  // logging system. No timeout.
  Execute execute = 
    new Execute(new LogStreamHandler(this, Project.MSG_INFO, Project.MSG_WARN), null);

  execute.setCommandline(YOUR_COMMAND_HERE);

  // set your working directory
  execute.setWorkingDirectory(dir);
  // allow Ant to find the antRun script if necessary
  execute.setAntRun(project);

  // run your command
  exitValue = execute.execute();

This will go a long way to avoid using a helper script (antRun does a
cd dir and than invokes the command), taking special measures on JDK
1.3, MacOS (where you can change user.dir), Windows NT/2000 and OS/2.

Stefan

Re: Ant and LaTeX

Posted by Klaus Alfert <al...@udo.cs.uni-dortmund.de>.
>>>>> "S" == Stefan Bodewig <bo...@bost.de> writes:

>>>>> "PD" == Peter Donald <do...@apache.org> writes:
PD> It needs to be able to run on a 1.1 vm if you want it to be
PD> chucked into CVS.

S> But the good news is that org.apache.tools.ant.taskdefs.Execute will
S> hide the RuntimeExec call for you and use the 1.3 version if you
S> happen to be running on JDK 1.3.

I have seen it in the API but I have to figure out how it works. It
take quite a lot of time to understand how to use the delete task, but
with this knowledge it should be easier. I will give it try at the
weekend. 

My problem was that I want to change the directory before tex is
called. The easiest way was just to use the new API  - I just didn't
recognize that this call is not the older API. 

Klaus.
-- 
--------------------------------------------------------------------
Klaus Alfert                          alfert@ls10.cs.uni-dortmund.de
Software Technology                   +49+231+755-4812
CS Department, University Dortmund

Re: Ant and LaTeX

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "PD" == Peter Donald <do...@apache.org> writes:

 PD> It needs to be able to run on a 1.1 vm if you want it to be
 PD> chucked into CVS.

But the good news is that org.apache.tools.ant.taskdefs.Execute will
hide the RuntimeExec call for you and use the 1.3 version if you
happen to be running on JDK 1.3.

Stefan

Re: Ant and LaTeX

Posted by Peter Donald <do...@apache.org>.
At 07:25  3/11/00 +0100, you wrote:
>Hi Folks,
>
>I like using ANT and as I use also LaTeX in our projects, I hacked a
>small LaTeX-Target together. It works for easy things and is my first
>attempt to write an extension to ANT. You can download it at 
>
>  http://ls10-www.cs.uni-dortmund.de/~alfert/ant-extension/
>
>It runs (and is tested) with ANT 1.2, Java 1.3.0 and teTeX 1.0 on
>Linux. I assume that there is currently a dependency on Java 1.3.0 as
>I have a an exec call in java.lang.Runtime which does not exist in
>1.2.2. The next step in my plan is to understand the various
>Exec-Classes in org.apache.ant.taskdefs to make anttex at least
>independent from the JVM version. So, I'm interested in any feedback,
>suggestions for a better code structures, other features, etc. 

kewl ;)

This would have been useful a couple of weeks ago when I was writing my
thesis ;) Oh well. It needs to be able to run on a 1.1 vm if you want it to
be chucked into CVS.

Cheers,

Pete

*------------------------------------------------------*
| "Nearly all men can stand adversity, but if you want |
| to test a man's character, give him power."          |
|       -Abraham Lincoln                               |
*------------------------------------------------------*