Scala Ant Tasks
来源:百度文库 编辑:神马文学网 时间:2024/04/27 21:35:00
The Scala distribution contains several tasks for building software projects using Apache Ant, a Java-based build tool. The tasks described below require Apache Ant version 1.6 or newer.
The Scala tasks are: scalac
, fsc
and scaladoc
scalac
DescriptionCompiles a Scala source tree.
The source and destination directory will be recursively scanned for Scala source files to compile. Only Scala files that have no corresponding .class
file or where the class file is older than the .scala
file will be compiled.
Note: Ant uses only the names of the source and class files to find the classes that need a rebuild. 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.
It is possible to refine the set of files that are being compiled. This can be done with the includes
, includesfile
, excludes
, and excludesfile
attributes. With the includes
or includesfile
attribute, you specify the files you want to have included. The exclude
or excludesfile
attribute is used to specify the files you want to have excluded. In both cases, the list of files can be specified by either the filename, relative to the directory(s) specified in the srcdir
attribute or nested
element(s), or by using wildcard patterns. See the Ant documentation on directory-based tasks, for information on how the inclusion/exclusion of files works, and how to write wildcard patterns.
elements or srcref are present. srcref Location of the Scala files, given as a reference to a path defined elsewhere. Yes, unless nested
elements or srcdir are present. destdir Location to store the class files. No classpath The classpath to use. No classpathref The classpath to use, given as a reference to a path defined elsewhere. No sourcepath The sourcepath to use; defaults to the value of the srcdir attribute (or nested
elements). To suppress the sourcepath switch, use sourcepath="". No sourcepathref The sourcepath to use, given as a reference to a path defined elsewhere. No bootclasspath Location of bootstrap class files. No bootclasspathref Location of bootstrap class files, given as a reference to a path defined elsewhere. No extdirs Location of installed extensions. No extdirsref Location of installed extensions, given as a reference to a path defined elsewhere. No target Specifies which backend to use; defaults to jvm-1.4
(accepted values are: jvm-1.5
, jvm-1.4
, msil
). No deprecation Indicates whether source should be compiled with deprecation information; defaults to no
(accepted values are: on
, off
,yes
and no
). Available since Scala version 2.3. No unchecked Indicates whether source should be compiled with unchecked information; defaults to
no
(accepted values are: on
, off
, yes
and no
). Available since Scala version 2.3. No encoding Encoding of source files. No logging Asks the compiler for verbose output; defaults to
none
(accepted values are: none
, verbose
, and debug
). No usepredefs Asks the compiler to use predefined values for compilation; defaults to yes
. No force Whether to force the compilation of all files; possible values are false
(only compile modified files), and true
(always recompile all files); defaults to false
. No addparams Specifies additional command line arguments to be passed to the Scala tool. The user may for example specify advanced options (eg.
-Xresident
) as well as private options (eg. -Ydebug
) not available as Ant attributes. No failonerror Indicates whether compilation errors will fail the build; defaults to true
. Available since Scala version 2.6. No scalacdebugging If set to
true
, the scalac Ant taks will print the filenames being compiled, instead of only the number of files. No assemname The assembly name. Only relevant if the target is "msil". No assemrefs References to external assemblies. Only relevat if the target is "msil" No Parameters specified as nested elementsThis task forms an implicit FileSet and supports all attributes of
(dir
becomes srcdir
) as well as the nested
,
and
elements.
src
, classpath
, sourcepath
, bootclasspath
and extdirs
Scalac's srcdir
, classpath
, sourcepath
, bootclasspath
, and extdirs
attributes are path-like structures and can also be set via nested
,
,
,
and
elements, respectively.
- Ant 1.6 or higher
- Scala 2.2 or higher
In the above target "init
" the task taskdef
defines the Scala ant tasks fsc
, sbaz
, scalac
and scalascript
.
Compiles all Scala files in sources/compile/
(not in sources/forget
) to build/
with given classpath. Files in sources/forget/
will not necessarily be compiled, but might be as they are in the sourcepath. All modified files are re-compiled.
fsc
(fast Scala compiler)DescriptionCompiles a Scala source tree.
The fsc
Ant task supports the same set of parameters as the scalac
Ant task with the following additional parameters:
- Ant 1.6 or higher
- Scala 2.2 or higher
scaladoc
DescriptionGenerates the API documentation in HTML format for the given source files.
The scaladoc
Ant task supports the same set of parameters as the scalac
Ant task with the following additional parameters:
Default value:
"Scala 2"
. No doctitle Specify the text to appear in the main frame title.Default value:
"Scala 2
API Specification"
No, HTML code is supported. stylesheetfile File to change style of the generated documentation.NB. The file name is system-dependent.
Available since Scala version 2.5. No header Include header text for each page.
Available since Scala version 2.5. No, HTML code is supported. footer Include footer text for each page.
Available since Scala version 2.5. No, HTML code is supported. top Include top text for each page.
Available since Scala version 2.5. No, HTML code is supported. bottom Include bottom text for each page.
Available since Scala version 2.5. No, HTML code is supported. Requirements
- Ant 1.6 or higher
- Scala 2.2 or higher
java
(Ant core task)DescriptionExecutes a Java class within the running (Ant) VM or forks another VM if specified.
The task java
belongs the core tasks of the Ant distribution.
Note: The Scala library scala-library.jar
must be present in the Java class path. The actors
and dbc
libraries are available as separate JAR files: scala-actors.jar
and scala-dbc.jar
.
source: http://www.scala-lang.org/node/98