users@jaxb.java.net

Re: What would you like to see in tools.

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Thu, 12 Dec 2002 00:28:42 -0500

> 2) The Ant task should do dependancy checking rather than regenerate
> (and hence recompile) every execution.

Thanks for your feedback. I was aware of this problem, but what I found
is that doing the correct dependency check is sometimes impossible. For
example, a schema could pull in other schemas from other web servers
(which don't give us timestamp information.)

Also, the compiler needs to almost fully compile a schema to determine
the exact set of files it is going to produce. So just doing an
up-to-date check requires quite a lot of computation.



The simple but not-so-nice workaround that I thought is to ask
developers to write the dependency for a compiler:

<xjc target="src">
  <schema dir="src" includes="*.xsd"/>
  <!-- other dependencies -->
  <depends dir="src" includes="*.xsdmod"/>
  <produces dir="src/org/acme/foo" includes="*.java"/>
</xjc>

With this information, up-to-date check can be done quite efficiently.


Another simple solution is to modify the compiler to check if the output
exists before it overwrites the file. If the existing file and the new
file is exactly the same, it can keep the current file untouched.

This requires XJC to compile the schema everytime an ant task is
executed, but at least it doesn't require javac to run every time.


How do you think?

regards,
--
Kohsuke KAWAGUCHI
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com