compiled file ending with *.htm instead of *.html

85 views
Skip to first unread message

James

unread,
Sep 5, 2012, 10:59:05 AM9/5/12
to google-we...@googlegroups.com
Is there a possible way to pass some parameter to compiler so the compiler can generate javascript file ending with *.htm instead of *.html? So far I just manually edit the generated javascript files and change the file extension.

Thanks,

James

Chris Lercher

unread,
Sep 6, 2012, 11:56:23 AM9/6/12
to google-we...@googlegroups.com
I assume it should be possible by extending IFrameLinker, and overriding getCompilationExtension(...) to return ".cache.htm". Then define and add your linker as in /com/google/gwt/core/Core.gwt.xml

I haven't tried it though, so you may encounter some difficulties (?)

James

unread,
Oct 4, 2012, 2:32:13 PM10/4/12
to google-we...@googlegroups.com
I extended IFrameLinker to return ".cache.htm" in getCompilationExtension. GWT compiler generates all js files ending with "cache.htm" as expected. But nocache.js still has "cache.html" in one place such as "$intern_62 = '.cache.html'". It work fine after I change "cache.html" to "cache.htm" in nocache.js file. I can not find any files containing "cache.html" in gwt-user.jar and gwt-dev.jar.  Any help will be appreciated.

Chris Lercher

unread,
Oct 4, 2012, 2:46:29 PM10/4/12
to google-we...@googlegroups.com
On Thursday, October 4, 2012 8:32:13 PM UTC+2, James wrote:
I extended IFrameLinker to return ".cache.htm" in getCompilationExtension. GWT compiler generates all js files ending with "cache.htm" as expected. But nocache.js still has "cache.html" in one place such as "$intern_62 = '.cache.html'". It work fine after I change "cache.html" to "cache.htm" in nocache.js file. I can not find any files containing "cache.html" in gwt-user.jar and gwt-dev.jar.  Any help will be appreciated.

It's probably in /com/google/gwt/core/linker/IFrameTemplate.js 

This file is used as a template to create the nocache.js. You can specify a different template by overriding getSelectionScriptTemplate(TreeLogger logger, LinkerContext context) That would however require you to copy and paste that template file (each time you upgrade to a new version of GWT).

So maybe it's a better idea to override SelectionScriptLinker.generateSelectionScript(TreeLogger logger, LinkerContext context, ArtifactSet artifacts, CompilationResult result) instead, and replace ".cache.html" with ".cache.htm" in the resulting string - a little bit hacky, but the chances that it will break are small.
Reply all
Reply to author
Forward
0 new messages