Will
unread,Nov 16, 2007, 5:20:28 AM11/16/07Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Web Toolkit
Thanks, Reinier, but it didn't work. Based on some reading and
experimenting, I've come up with my understanding of a module's
<source path="path"/> element, which I hope I've nailed-down correctly
(corrections/thoughts welcome):
<source path="pkgPattern"/>
===============================
A module is a ".gwt.xml" file. A module has a package prefix. It may
be funny to think of a module as having a Java package prefix because
after all, a module is a ".gwt.xml" file, not a Java source file.
Nevertheless, a module has a prefix and this prefix is found relative
to the classpath that is passed to the GWTCompiler. So if the
GWTCompiler's classpath is "-cp someDir" and your module is located at
someDir/foo/goo/MyModule.gwt.xml, then your module's logical name is
"foo.goo.MyModule" and its pkgPrefix is "foo.goo". This classpath can
include dirs or JAR files (thus, your module can live inside a JAR, if
you wish, along with other Java source files). It's possible that a
module has no prefix (for example, if the module is located at someDir/
MyModule.gwt.xml instead).
A module associates itself with Java source files that are
translatable (Java->JS) by specifying a pkgPattern for those source
files. The pkgPattern is relative to the module's pkgPrefix (if any)
and is specified in a single <source...> element. When a logical
module name is passed to the GWTCompiler, then all Java source files
found on the GWTCompiler's classpath that match the fully-qualified
"pkgPrefix.pkgPattern" pattern will be translated. For example, if my
module's pkgPrefix is "foo.goo" and I specify the pkgPattern
"hoo" (<source path="hoo">), then all source files found on the
GWTCompiler's classpath that match the "foo.goo.hoo.*" pattern
(including subpackages) are associated with the module, and are thus
translated to JS when I pass "foo.goo.MyModule" as an arg to
GWTCompiler.
There are some restrictions. The module's <source path="pkgPattern"/>
must specify a _non-empty_ pkgPattern that is relative to (ie,
appended to) the module's pkgPrefix. So for example, path="" is not
allowed because it's empty. The "." (curDir) and ".." (parentDir)
markers are also not allowed, so ".", "./hoo" and "../hoo" are not
allowable patterns. This means that a module can never be associated
with a Java source file that is contained within the default package,
so be sure to never place your Java source files in the default
package since they will never be translatable by GWTCompiler in that
case.
Regards,
Will