views:

3985

answers:

2

With the GWT compiler, is it possible set pass in properties as arguments to the GWT compiler? I know you can pass in certain defined parameters such as -war and -style, but this is for passing in property values, such as "user.agents" or "locale".

From what I can see of the documentation, the properties can only be set using from within the module descriptor. But I want to be able to control these properties externally, from my build script.

I've tried looking for documentation on what arguments are supported by com.google.gwt.dev.Compile, but there doesn't appear to be any reference documentation for that class. The docs are long on how-tos, and distressingy short on detail.

+4  A: 

It does take arguments. An example from an ant build file I wrote:

<target name="compile.gwt" depends="compile">
    <java failonerror="true" classname="com.google.gwt.dev.Compiler" fork="true">
        <arg value="-war" />
        <arg value="${webcontent.dir}" />
        <arg value="-style" />
        <arg value="obfuscated" />
        <arg value="${module.name}" />
        <jvmarg value="-Xmx256m" />
        <jvmarg value="-Xss64M" />
        <classpath>
            <path refid="project.class.path" />
            <pathelement path="${gwt.home}/gwt-dev-windows.jar" />
        </classpath>
    </java>
</target>

I think this covers all the flags:

Debugging and Compiling - Google Web Toolkit - Google Code

As far as whether you pass user agents, I haven't seen it, but I haven't looked, either.

Don Branson
Thanks, I've clarified the question to be specific about passing in property values.
skaffman
+5  A: 

The answer is no!

I've asked the exact same question in the commiters newsgroup and currently there is nothing available.

They are thinking about adding support of supplying an extra .gwt.xml to override/configure things externally. This would cover what I wanted to do, but if you really want a generic access to the Properties at compile time then I'm afraid this is not possible.

Maybe you should create a Functional Request... let me know I'll put a start on it as well since it would be very usefull to switch on/off certain things from the compiler command line operation.

David Nouls
Such certainty is appreciated, even if it's not what I wanted to hear :)
skaffman
The feature is in the works already. The plan is to be able to pass property values like user.agent and locale on the command line. This will be equivalent to adding a set-property in your .gwt.xml file.
Kelly Norton