You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Russ Atkind <ru...@tempest.com> on 2000/04/03 18:50:37 UTC

Other Java compilers?

I was wondering if it's possible to have Ant use a Java compiler other than
javac and jikes.  I'm using an object database that requires use of its own
compiler to do preprocessing before passing it off to javac.  If the current
code doesn't support this, perhaps I could make the change myself; would it
be difficult?

Thanks for the help.

Russ


-----------------------
Russ Atkind
Tempest Software
(212) 797-9550 ext. 121
russ@tempest.com


Parser(s)?

Posted by Pierpaolo Fumagalli <pi...@apache.org>.
Can we get rid of all parser classes and use JAXP (Sun's JSR-5?)...
Both XERCES and Project-X/Crimson support it... So, it might be a good
idea to get rid of that legacy...

	Pier

-- 
----------------------------------------------------------------------
pier: stable structure erected over water to allow docking of seacraft
<ma...@betaversion.org>      <http://www.betaversion.org/~pier/>
----------------------------------------------------------------------



Re: include construct?

Posted by Michel CASABIANCA <ca...@sdv.fr>.
Hi

"Craig R. McClanahan" <Cr...@eng.sun.com> writes:
> Scott M Stark wrote:
> 
> > Is there a mechanism like the gnumake include or -include in Ant?
> > I tried using an xml:link hoping the parser would just magically
> > include it but Ant sees the include element and wants to treat it
> > as a task.
> 
> There is not an "include" mechanism like what you're describing in
> Ant right now.  However, it would not be hard using some of the
> shell tools that manipulate text files to construct a buildfile on
> the fly by copying in standard components, before feeding the
> resulting file to Ant.  You could do this with the C preprocessor
> (cpp), or the m4 utility, for example.

Using shell tools is not a good solution as the purpose of Ant
is independancy against platform.

But build.xml files are XML files (obviously), so you can use
entities to include another XML file, like that :

file build.xml
----------------------------------------------------------------
<?xml version="1.0" encoding="iso-8859-1"?>

<!DOCTYPE project PUBLIC "-//ANT//DTD project//EN" "project.dtd" [
<!ENTITY include SYSTEM "message.xml">
]>

<project name="test" default="task" basedir=".">

 <target name="task">
  <echo message="Hello"/>
  &include;
 </target>

</project>
----------------------------------------------------------------

This file includes the following :

file message.xml
----------------------------------------------------------------
<echo message="World !"/>
----------------------------------------------------------------

Thus when running ant, you get :

  [casa test]$ ant
  Buildfile: build.xml
  Project base dir set to: /home/casa/tmp/test
  Executing Target: task
  Hello
  World !
  Completed in 2 seconds

But you must have a DTD for project files :o)

-- 
+---------------------------+--------------------------------+ 
| Michel CASABIANCA         | http://www.sdv.fr/pages/casa   | 
| mailto:casa@sdv.fr        | Articles sur Java et XML       | 
| Développement Java et XML | Applications et Applets de Jeu |
+---------------------------+--------------------------------+

Re: include construct?

Posted by "Craig R. McClanahan" <Cr...@eng.sun.com>.
Scott M Stark wrote:

> Is there a mechanism like the gnumake include or -include in Ant? I tried using an xml:link
> hoping the parser would just magically include it but Ant sees the include element
> and wants to treat it as a task.
>

There is not an "include" mechanism like what you're describing in Ant right now.  However, it would not be hard using some of
the shell tools that manipulate text files to construct a buildfile on the fly by copying in standard components, before feeding
the resulting file to Ant.  You could do this with the C preprocessor (cpp), or the m4 utility, for example.

Craig McClanahan



include construct?

Posted by Scott M Stark <st...@attglobal.net>.
Is there a mechanism like the gnumake include or -include in Ant? I tried using an xml:link
hoping the parser would just magically include it but Ant sees the include element
and wants to treat it as a task.

<project name="RACSJava" default="compile-test" basedir="/usr/local/src/scott_home_rips/packages">

 <target name="init">
  <include xml:link="simple" href="build.defs" inline="true" actuate="auto"/>
..
</project>

bash-2.02$ ant.bat  -f tstbuild.xml
Buildfile: tstbuild.xml
Project base dir set to: D:\usr\local\src\scott_home_rips\packages
BUILD CONFIG ERROR: Could not create task of type: include because I can't find
it in the list of task class definitions
org.apache.tools.ant.BuildException: Could not create task of type: include because I can't find it in the list of task class
definitions
        at org.apache.tools.ant.Project.createTask(Project.java:359)
        at org.apache.tools.ant.ProjectHelper.configureTasks(ProjectHelper.java:187)
        at org.apache.tools.ant.ProjectHelper.configureTargets(ProjectHelper.java:164)
        at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:127)
        at org.apache.tools.ant.Main.runBuild(Main.java:223)
        at org.apache.tools.ant.Main.main(Main.java:191)
bash-2.02$


Re: Other Java compilers?

Posted by Kevin Riff <ke...@earthling.net>.
Michel CASABIANCA wrote:

> Kevin Riff <ke...@earthling.net> writes:
> > Would it make sense to add an attribute to the JavaC task that
> > allows you to enter the path to an arbitrary compiler? It could
> > be implemented using Runtime.exec(..) similarly to how the Jikes
> > compiler is done.
>
> This should be possible, but it would be *very* slow compared to
> running this compiler in the same VM. VM boot is time consuming
> (about 2 or 3 sec.) and can be greater than time to compile.
>
> For small projects you can run faster by disabling JIT because in
> these situations boot time is greater than the amount of time
> saved with JIT.

That would be true if the compiler was a Java application. But Jikes
(and presumably other compilers) is implemented in native C code which
makes it *much* faster than JavaC. When the "jikes" option is used, Ant
uses Runtime.exec(..) to invoke the compiler as a separate process. All
that would be needed is to create another compiler option that's similar
to the existing Jikes code but without anything that's specific to
Jikes.


Re: Other Java compilers?

Posted by Michel CASABIANCA <ca...@sdv.fr>.
Kevin Riff <ke...@earthling.net> writes:
> Would it make sense to add an attribute to the JavaC task that 
> allows you to enter the path to an arbitrary compiler? It could 
> be implemented using Runtime.exec(..) similarly to how the Jikes 
> compiler is done.

This should be possible, but it would be *very* slow compared to
running this compiler in the same VM. VM boot is time consuming
(about 2 or 3 sec.) and can be greater than time to compile.

For small projects you can run faster by disabling JIT because in
these situations boot time is greater than the amount of time
saved with JIT.

-- 
+---------------------------+--------------------------------+
| Michel CASABIANCA         | http://www.sdv.fr/pages/casa   |
| mailto:casa@sdv.fr        | Articles sur Java et XML       |
| Développement Java et XML | Applications et Applets de Jeu |
+---------------------------+--------------------------------+

Re: Other Java compilers?

Posted by Kevin Riff <ke...@earthling.net>.
"Kevin A. Burton" wrote:

> Russ Atkind wrote:
> >
> > I was wondering if it's possible to have Ant use a Java compiler other than
> > javac and jikes.  I'm using an object database that requires use of its own
> > compiler to do preprocessing before passing it off to javac.  If the current
> > code doesn't support this, perhaps I could make the change myself; would it
> > be difficult?
>
> At the very minimum you have 'exec'

Would it make sense to add an attribute to the JavaC task that allows you to
enter the path to an arbitrary compiler? It could be implemented using
Runtime.exec(..) similarly to how the Jikes compiler is done.


Re: Other Java compilers?

Posted by "Kevin A. Burton" <bu...@relativity.yi.org>.
Russ Atkind wrote:
> 
> I was wondering if it's possible to have Ant use a Java compiler other than
> javac and jikes.  I'm using an object database that requires use of its own
> compiler to do preprocessing before passing it off to javac.  If the current
> code doesn't support this, perhaps I could make the change myself; would it
> be difficult?

At the very minimum you have 'exec'
-- 
Kevin A Burton (burton@apache.org)
http://relativity.yi.org
Message to SUN:  "Please Open Source Java!"
"For evil to win is for good men to do nothing."