Okay, I found a pretty good solution. Solved the problem by adding a method isSourceMapsEnabled to CompilationResult, which gets passed all the way from Link to SelectionScriptLinker. The value is set in Link via the permutation's property oracles. I tested this and it works well!
Now, how can I contribute this patch? Long time user, first time contributor. I signed the CLA many years ago, but haven't submitted anything until now. Are the instructions on https://developers.google.com/web-toolkit/makinggwtbetter still valid? I'm a little confused because that document says "Upload the patch to the Rietveld instance at http://gwt-code-reviews.appspot.com/" whereas I'm seeing all the messages in this group coming from a system called Gerrit at https://gwt-review.googlesource.com/ On Apr 10, 2:39 am, Alex Epshteyn <[email protected]> wrote: > I'm trying to fix a bug > (https://code.google.com/p/google-web-toolkit/issues/detail?id=8100 > ), and I could use some expert advice. I'm a long time GWT user (7 > years), but only recently started hacking the internals, and I need > help on this one. > > Background: > > SelectionScriptLinker.splitPrimaryJavaScript attempts to check whether > the property "compiler.useSourceMaps" is "true" and if it is, the > method avoids splitting the javascript into chunks (which would > destroy the accuracy of the line numbers in the source map). > > The Problem: > > This method tries to get the property value from > LinkerContext.getProperties, which is not a PropertyOracle, and hence > it can't return the correct property value for the current > permutation. In fact, it will return a null value unless the property > has a static value for all permutations (e.g. <set-property > name="compiler.useSourceMaps" value="true"/>) > > However, something like > > <set-property name="compiler.useSourceMaps" value="true"> > <when-property-is name="user.agent" value="safari"/> > </set-property> > > will not work because SelectionScriptLinker.splitPrimaryJavaScript can > only read static property values. > > Could someone advise me on how to fix this bug? > > Here's is there relevant source code for quick reference: > > public static String splitPrimaryJavaScript(StatementRanges ranges, > String js, > int charsPerChunk, String scriptChunkSeparator, LinkerContext > context) { > boolean useSourceMaps = false; > for (SelectionProperty prop : context.getProperties()) { > if (USE_SOURCE_MAPS_PROPERTY.equals(prop.getName())) { > String str = prop.tryGetValue(); > useSourceMaps = str == null ? false : > Boolean.parseBoolean(str); > break; > } > } > > // TODO(cromwellian) enable chunking with sourcemaps > if (charsPerChunk < 0 || ranges == null || useSourceMaps) { > return js; > } > ... -- -- http://groups.google.com/group/Google-Web-Toolkit-Contributors --- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
