My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
Reference  
SAnt reference
Featured
Updated Feb 4, 2010 by stepan.k...@gmail.com

Introduction

SAnt is a Scala-based build tool. In theory, it is kind of like Ant, without Ant's wrinkles.

Why?

Why another build tool when there is already Ant? Ant have limitations that SAnt's original author couldn't live with when developing software across multiple platforms. Ant does not allow scripting easily.

Concepts

Reader should be familiar with Ant and Scala.

SAnt build script is a Scala script that defines Ant project.

Targets

Targets are defined with invocation of method def target(name: String, args: AntParam*)(p: => Unit). Example:

target("complie", "depends" -> "prepare", "default" -> true, "description" -> "Compile classes") {
  ...
}

This statements created target and register it in the current project.

Tasks

Ant target is a sequence of tasks. Our target content is any code. Example:

target("hello") {
  (1 to 3) map (_ * 2) foreach (println _)
}

However, we've made ability to use any Ant task.

Because of some Scala limitations, we've explicitly defined most frequently used tasks in the Ant object, and if we missed something everyone can similary define any task himself, like:

val typedef = Ant.task("typedef")

Ant.task(name) returns function that invokes task with specified paramters.

Tuple name-value parameters to this function is converted to task attributes, example:

Ant.javac("srcdir" -> "src/java", "destdir" -> "target/classes")

XXX: describe tricks to declare nested elements.

Links

Example build file: build.scala is used to build SAnt itself.

Minimal build file: build.scala.

What builtin tasks, like Ant.javac or Ant.scalac are: Ant.scala.


Sign in to add a comment
Powered by Google Project Hosting