Compiles Kawa source files. There are two ways to specify the files to be compiled:
<javac>
.In either case, the destination directory will be scanned for
matching .class
files, and only Kawa files without
corresponding class files or which are newer than their class
files will be compiled.
Note: Ant uses only the names of the source and class files to find the classes that need to be rebuilt. It will not scan the source and therefore will have no knowledge about nested classes, classes that are named different from the source file, and so on.
See the <javac>
documentation for details on
how to use the implicit file set.
This task can compile source code in any language understood by
Kawa. A language can be specified using
the language
attribute. Valid values are:
scheme
(Scheme) –
.scm
and
.sc
can be used as aliases.krl
(Kawa Report Language) –
.krl
is an alias.brl
(KRL in BRL-compatibility mode) –
.brl
is an alias.emacs
(Emacs Lisp) –
elisp
and
emacs‑lisp
and
.el
can be used as aliases.xquery
(XQuery) –
.xquery
and
.xq
and
.xql
can be used as aliases.q2
(Q2) –
.q2
is an alias.xslt
(XML Stylesheet Language Transformations)
– xsl
and
.xsl
can be used as aliases.commonlisp
(Common Lisp) –
common‑lisp
and
clisp
and
lisp
and
.lisp
and
.lsp
and
.cl
can be used as aliases.When the third column is left blank, that means it is not applicable to FileSet style.
Attribute | Description | Required for FileSet Style | Required for Javac Style |
srcdir | Location of the Kawa files. | Yes | |
destdir | Location to store the class files. | Yes | No |
includes | Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all Kawa source files are included when omitted | No | |
includesfile | The name of a file that contains a list of files to include (may be specified using wildcard patterns). | No | |
excludes | Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted. | No | |
excludesfile | The name of a file that contains a list of files to exclude (may be specified using wildcard patterns). | No | |
classpath | The classpath to use. | No | No |
classpathref | The classpath to use, given as a reference to a path defined elsewhere. | No | No |
target | Generate class files for specific VM version
(e.g. 1.5 or 1.6 ). |
No | No |
failonerror | Indicates whether compilation errors will fail the build; defaults to true. | No | No |
errorProperty | The property to set (to the value "true") if compilation fails. | No | No |
listfiles | Indicates whether the source files to be
compiled will be listed; defaults to
no . (Note: kawa already lists
files as they are compiled, so this will print them
twice.) |
No | No |
updatedProperty | The property to set (to the value "true") if compilation has taken place and has been successful. | No | No |
includeDestClasses | This attribute controls whether to include the destination classes directory in the classpath given to the compiler. The default value of this is "true" and this means that previously compiled classes are on the classpath for the compiler. | No | No |
prefix | Prefix to prepend to class names. Typically the package name with a trailing period. | No | No |
main | If true, Kawa will create a static main
method. Defaults to false . |
No | No |
applet | If true, Kawa will generate an
applet. Defaults to false . |
No | No |
servlet | If true, Kawa will generate a
servlet. Defaults to false . |
No | No |
fulltailcalls | If true, Kawa will use full
tailcalls. Defaults to false . |
No | No |
modulestatic | One
of: yes or true or on
to pass ‑‑module‑static ,
no or false or off to
pass ‑‑no‑module‑static ,
or run to
pass ‑‑module‑static‑run . |
No | No |
warnundefinedvariable | If true, passes
‑‑warn‑undefined‑variable |
No | No |
warnaserror | If true, passes
‑‑warn‑as‑error |
No | No |
language | The Kawa language to use. Passes
‑‑<language> to the
compiler. If a language is specified, then only source files
for that language (as determined by file extension) will be
compiled. Otherwise, all source files understood by Kawa
will be eligible for compilation. (See the
above list of valid
languages.) |
No | No |
This task forms an implicit FileSet and supports most
attributes of <fileset>
(dir
becomes srcdir
) as well as the
nested <include>
, <exclude>
and <patternset>
elements.
srcdir
and classpath
<kawac>
’s srcdir and classpath attributes
are path-like structures and can also be set via
nested <src>
(note the different name!)
and <classpath>
elements, respectively.
To pass additional arguments to the compiler, use
nested <arg>
elements, which are specified
like Command-line Arguments. For instance, to pass
‑‑warn‑unknown‑member, use <arg
value="‑‑warn‑unknown‑member"/>
.
fileset
To use the explicit FileSet style, use
nested <fileset>
elements.
Note: for files in src/com/example which are
to be in the package com.example,
the <fileset>
must be defined in one of two
ways with regards to its dir
attribute in order for
the uptodate mechanism to match source and class files:
<fileset dir="src"
includes="com/example/*.scm"/>
, or<fileset dir="src/com/example"
includes="*.scm"/>
.The relative path corresponding to the package name must either be entirely within the directory part, or entirely within the include filename part. This will not work:
<fileset dir="src/com"
includes="example/*.scm"/>
<kawac>
TaskThe <kawac>
task is implemented by
the gnu.kawa.ant.Kawac
class. To use it in your
build.xml file, define the task with:
<taskdef name="kawac" classname="gnu.kawa.ant.Kawac"
classpath="${build.tools}"/>
where ${build.tools}
is the path to the Kawa tools
directory.
The following examples all
compile src/com/example/foo.scm
to the
class com.example.foo
in the classes
directory
(i.e. to classes/com/example/foo.class
).
Using an explicit FileSet:
<kawac destdir="classes" language="scheme" prefix="com.example."> <fileset dir="src" includes="com/example/foo.scm"/> </kawac>
or
<kawac destdir="classes" language="scheme" prefix="com.example."> <fileset dir="src/com/example" includes="foo.scm"/> </kawac>
Using the implicit FileSet:
<kawac destdir="classes" srcdir="src" language="scheme" prefix="com.example." includes="com/example/foo.scm"/>
or
<kawac destdir="classes" srcdir="src" language="scheme" prefix="com.example."> <include name="com/example/foo.scm"/> </kawac>