|Re: Any way to generate only one file? [message #515028 is a reply to message #515007]
||Wed, 17 February 2010 14:16
| Paul Elder
Registered: July 2009
Read on, this isn't really JET specific. I've tagged the JET specific
paragraphs with [JET] - you can skip those.
[JET] JET tries to be as efficient as possible when regenerating, so
that you don't have to make an investment in incremental building.
[JET] The main strategy is to verify that a file truly has changed
before writing it. While this incurs an extra read, this is typically
much cheaper than doing an unnecessary write. The savings is not only
from avoided I/O, you also get to avoid triggering Eclipse workspace
listeners and builders that may activate as part of a write.
[JET] To see this in action, run your JET transformation twice without
any intervening model changes. The second time through, the execution
log should contain no messages about file writes, unless your templates
inject things like timestamps into the output.
If you find that full re-build style executions are too expensive, you
would have to develop some mechanism for detecting incremental change in
the input model. I haven't really thought about this in detail, but
something like the following would work:
1) identify at the level in your input model at which you want to track
2) calculate some sort of hash code/signature on those elements
3) have the transformation write those hash codes (to a file) as part of
4) as part of each execution, compare current hash code values with
those saved in step 3 (from a previous execution), and flag the elements
that require regeneration
5) conditionally generate based on the calculation in step 4.
The hard part, by far, is deciding on an effective hash code/signature.
This requires actual THINKING ;-) . At a minimum, it should incorporate
all contained data/attributes. But, it may also need to include
referenced objects, as these may effect generated output, too.
I know all of this is possible, but I don't know of anyone who has done
it. (I may just lead a sheltered life.) I find the idea intriguing
enough to consider doing some experiments, but I'd be curious what
current experience is.
* Is anyone interested in doing incremental builds with code generators
like JET, XPand or Acceleo?
* Is anyone actually doing such builds? If so, how do you detect change?
* How many files are you writing (in a full build)?
* How big is your model (especially in terms of model elements that
would require signatures)?
* How long does it take to update a single file?
Powered by FUDForum
. Page generated in 0.01558 seconds