Previous Up Next

Chapter 11  Using Gom

11.1  Command line tool

People interested in using Gom as a standalone tool can use the Gom command line interface.

gom [options] filename [... filename]

Options:
-X <file> Defines an alternate XML configuration file
--destdir <dir> | -d Specify where to place generated files
--verbose | -v Display compilation information
--debug | -vv Display debugging information
--intermediate | -i Leave generated ADT file for all compilation phases
--import <path> | -I Path for searching included modules
--package <pack> | -p Specify a prefix package name (optional)
--wall | -W Print warnings
--version | -V Print version
--help | -h Show this help

11.2  Ant task

Gom can also be used within ant, and has its own ant tasks.

To use the Gom ant task, you have to first declare it the same way as the Tom ant task.
<taskdef name="gom" classname="tom.gom.tools.ant.GomTask" classpathref="tom.classpath"/>


Once the task is defined, you can use them to compile a Gom file.

The Gom ant task has to be able to find a configuration file for Gom. It can either use the tom.home property to find its configuration file, or use the value of the config attribute. Since the tom.home property is also used when Gom has to process hooks, it is a good practice to always define the tom.home property to the installation path of the Tom system.

The default configuration file for Gom is included in the Tom distribution as Gom.xml.
<gom config="${stable.gomconfigfile}" package="tom.gom.adt" destdir="${src.gen}"> <include name="tom/gom/adt/*.gom"/> </gom>


The Gom task takes the following arguments:
Attribute Description Required
config Location of the Gom configuration file. No
options Custom options to pass to the Gom compiler. No
package Package for the generated Java files. No
destdir Location of the generated files. No
The set of .gom files to compile is specified with a nested include element.


Previous Up Next