Limit generator invocation count

2010-05-26 Thread Matt
Hi,

I've written a custom generator, which functionally works fine. The
only slightly nagging point is that the generator generates the same
source code for all permutations, but still gets invoked once per
permutation (which means quite a few times for an app with i18n...).
This increases build time - is there any way to only invoke the
generator once, or to somehow cache the generated code so speed things
up?

Thanks for any help,
Matt

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.



Re: Limit generator invocation count

2010-05-26 Thread Olivier Monaco
Matt,

You generator is called for each permutation but it may not generate
the same code each time. You generator must include the following
code:

PrintWriter printer = context.tryCreate(logger, packageName,
className);
if (printer != null) {
// Create a ClassSourceFileComposerFactory and generate
the code
}

The context.tryCreate method returns a PrintWriter if the class named
packageName.className does not exists, null otherwise. The first
call to your generator creates the class, the subsequents not. Better,
if the class already exists before the compilation (ie. you created
that class by hand), your generator don't create it.

Olivier

On 26 mai, 08:48, Matt mydevmailingli...@gmail.com wrote:
 Hi,

 I've written a custom generator, which functionally works fine. The
 only slightly nagging point is that the generator generates the same
 source code for all permutations, but still gets invoked once per
 permutation (which means quite a few times for an app with i18n...).
 This increases build time - is there any way to only invoke the
 generator once, or to somehow cache the generated code so speed things
 up?

 Thanks for any help,
 Matt

-- 
You received this message because you are subscribed to the Google Groups 
Google Web Toolkit group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.