Scala Ant Tasks
来源:互联网 发布:挂号用什么软件 编辑:程序博客网 时间:2024/06/05 20:50
Scala Ant Tasks
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
Compiles 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. Theexclude
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 <src>
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.
<src>
elements or srcref are present.srcrefLocation of the Scala files, given as a reference to a path defined elsewhere.Yes, unless nested<src>
elements or srcdir are present.destdirLocation to store the class files.NoclasspathThe classpath to use.NoclasspathrefThe classpath to use, given as a reference to a path defined elsewhere.NosourcepathThe sourcepath to use; defaults to the value of the srcdir attribute (or nested<src>
elements). To suppress the sourcepath switch, use sourcepath="".NosourcepathrefThe sourcepath to use, given as a reference to a path defined elsewhere.NobootclasspathLocation of bootstrap class files.NobootclasspathrefLocation of bootstrap class files, given as a reference to a path defined elsewhere.NoextdirsLocation of installed extensions.NoextdirsrefLocation of installed extensions, given as a reference to a path defined elsewhere.NotargetSpecifies which backend to use; defaults to jvm-1.4
(accepted values are:jvm-1.5
, jvm-1.4
, msil
).NodeprecationIndicates 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.NouncheckedIndicates 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.NoencodingEncoding of source files.NologgingAsks the compiler for verbose output; defaults to
none
(accepted values are:none
, verbose
, and debug
).NousepredefsAsks the compiler to use predefined values for compilation; defaults to yes
.NoforceWhether to force the compilation of all files; possible values are false
(only compile modified files), and true
(always recompile all files); defaults tofalse
.NoaddparamsSpecifies 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.NofailonerrorIndicates whether compilation errors will fail the build; defaults to true
. Available since Scala version 2.6.NoscalacdebuggingIf set to
true
, the scalac Ant taks will print the filenames being compiled, instead of only the number of files.NoassemnameThe assembly name. Only relevant if the target is "msil".NoassemrefsReferences to external assemblies. Only relevat if the target is "msil"NoThis task forms an implicit FileSet and supports all attributes of <fileset>
(dir
becomes srcdir
) as well as the nested<include>
, <exclude>
and <patternset>
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 <src>
, <classpath>
, <sourcepath>
,<bootclasspath>
and <extdirs>
elements, respectively.
- Ant 1.6 or higher
- Scala 2.2 or higher
<property name="sources.dir" value="${base.dir}/sources" /> <property name="build.dir" value="${base.dir}/build" /> <target name="init"> <property name="scala-library.jar" value="${scala.home}/lib/scala-library.jar" /> <path id="build.classpath"> <pathelement location="${scala-library.jar}" /> <!--<pathelement location="${your.path}" />--> <pathelement location="${build.dir}" /> </path> <taskdef resource="scala/tools/ant/antlib.xml"> <classpath> <pathelement location="${scala.home}/lib/scala-compiler.jar" /> <pathelement location="${scala-library.jar}" /> </classpath> </taskdef> </target>
In the above target "init
" the task taskdef
defines the Scala ant tasks fsc
, sbaz
, scalac
and scalascript
.
<target name="build" depends="init"> <mkdir dir="${build.dir}" /> <scalac srcdir="${sources.dir}" destdir="${build.dir}" classpathref="build.classpath"> <include name="compile/**/*.scala" /> <exclude name="forget/**/*.scala" /> </scalac> </target>
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)Compiles 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
Generates 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"
.NodoctitleSpecify the text to appear in the main frame title.Default value:
"Scala 2<br />API Specification"
No, HTML code is supported.stylesheetfileFile to change style of the generated documentation.NB. The file name is system-dependent.
Available since Scala version 2.5.NoheaderInclude header text for each page.
Available since Scala version 2.5.No, HTML code is supported.footerInclude footer text for each page.
Available since Scala version 2.5.No, HTML code is supported.topInclude top text for each page.
Available since Scala version 2.5.No, HTML code is supported.bottomInclude bottom text for each page.
Available since Scala version 2.5.No, HTML code is supported.
- Ant 1.6 or higher
- Scala 2.2 or higher
<target name="docs" depends="init"> <mkdir dir="${docs.dir}" /> <scaladoc srcdir="${sources.dir}" destdir="${docs.dir}" deprecation="yes" unchecked="yes" windowtitle="liftweb Library Documentation" doctitle="<div>liftweb 0.1.0</div>" classpathref="build.classpath"> <include name="compile/**/*.scala" /> </scaladoc> </target>
java
(Ant core task)Executes 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
.
<target name="run" depends="build"> <java classname="examples.sort" classpathref="build.classpath"> </java> </target>
- Scala Ant Tasks
- Tomcat Ant Tasks
- Ant有用的tasks
- Flex Ant Tasks详解
- WebLogic 10 Ant Tasks Location
- Overview of Apache Ant Tasks
- Ant生成JunitReport(Writing Tasks )
- Ant: 使用外部的tasks
- Use Jython to Write Ant Tasks
- Use Jython to Write Ant Tasks
- Invalid implementation version between Ant core and Ant optional tasks
- ant中使用maven-ant-tasks下载maven的依赖
- [Ant] How the tasks are called in Ant?
- 利用ant和maven-ant-tasks使用Hibernate链接数据库
- tasks
- http://ant.apache.org/manual/Tasks/copy.html
- http://maven.apache.org/ant-tasks/usage.html
- 使用 Flex Ant Tasks 构建 Flex 项目-第 I 部分:为 Flex 创建构建脚本
- rhel6安装配置iscsi并实现自动挂载
- paip.提升用户体验----表格显示及控件布局错乱的问题
- C第一个程序helloworld (有图有真相)
- c++第一个程序helloworld (有图有真相)
- AndEngine-----CardinalSplineMoveModifierExample学习
- Scala Ant Tasks
- 线索二叉树
- 图的BFS - HDU 1241/HDU 2612/POJ 3984
- 使用Lua脚本为wireshark编写自定义通信协议解析器插件
- paip.提升用户体验---免维护列表字段
- HDU 4329
- 使用lua脚本编写wireshark协议插件
- 工厂设计模式之工厂方法与抽象工厂
- iphone第一个程序helloworld(有图有真相)