Monday, September 26, 2011

Permutation, code splitting and deferred property

Hi,

I got an issue with deferred property and code splitting.

In my GWT configuration file, I have defined the following property:
<define-property name="myProperty" values="value1,value2" />
<set-property name="myProperty" value="value1">
<when-property-is name="user.agent" value="gecko1_8" />
</set-property>
<set-property name="myProperty" value="value1">
<none>
<when-property-is name="user.agent" value="gecko1_8" />
</none>
</set-property>

and I have a generator with the following code that generates one
implementation depending on this deferred property value:

public String generate( TreeLogger logger, GeneratorContext context,
String typeName ) throws UnableToCompleteException {
String value = propertyOracle.getSelectionProperty( logger,
"myProperty" );
if("value1".equals(value)){
return generateImpl1();
} else {
return generateImpl2();
}
}

According to my settings for each browser, you can have only one
value, ie for each permutation my generator should generate either
Impl1 or Impl2 but not both. However in my soyc report, I noticed that
for each browser/permutation, both implementations are generated.

The issue I have is that my generator generates the same GWT.runAsync
call for both implementation and since the 2 implementations are
generated for each permutation (even if only one can be used for each
permutation), GWT believes there are 2 split points and since it's the
same code inside the 2 split points, all the code is added to the left
fragment code.

My question is how come my generator is called twice for each
permutation? Since only one value is possible for each permutation
shouldn't it be called only once? Am I doing something wrong in my
configuration which could explain why my generator is called twice?

Thanks for your help,
Pierre

--
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-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment