-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Antelese is designed to enable the use of Ant tasks inside a Scala program. It uses some language features of Scala to make calling Ant tasks in a Scala program as painless as possible.
1. Download latest antelese-X.X.jar from the Downloads page
2. Minimum dependency: ant-1.7.1.jar, ant-launcher-1.7.1.jar
3. Optional dependency: ant-apache-regexp-1.7.1.jar if you need regexp
1. Download and install sbt
2. Download Antelese source via git
3. cd <antelese dir>
4. sbt
After sbt has finished its initial setup which might take some time, at the “>” prompt:
5. update
6. test
7. console
scala> import com.netgents.antelese.Antelese._ import com.netgents.antelese.Antelese._ scala> echo('message -> "Hello World") [null] Hello World res1: com.netgents.antelese.AntElement[org.apache.tools.ant.Task] = com.netgents.antelese.RichTask@3c3af80, antElement = org.apache.tools.ant.taskdefs.Echo@2221edfa scala> mkdir('dir -> "tmp") [null] Created dir: /Users/walter/Personal/projects/scala/antelese/tmp res2: com.netgents.antelese.AntElement[org.apache.tools.ant.Task] = com.netgents.antelese.RichTask@7b587649, antElement = org.apache.tools.ant.taskdefs.Mkdir@6cbdf1e2 scala> delete('dir -> "tmp") [null] Deleting directory /Users/walter/Personal/projects/scala/antelese/tmp res3: com.netgents.antelese.AntElement[org.apache.tools.ant.Task] = com.netgents.antelese.RichTask@498e3b14, antElement = org.apache.tools.ant.taskdefs.Delete@18c8c3c6 scala>
It’s that simple!
Please look at the specs tests located in the test source directory for some examples of calling Ant tasks. To wrap your own Ant task, use the following code:
import com.netgents.antelese.Antelese._ val mytask = initTask(new MyTask)
Take a look at Antelese.scala for more examples on wrapping Ant tasks and other Ant data types or use “taskdef” Ant task and “task()” to create tasks.
I’ve implemented most of the features related to core Ant task including core tasks, core data types, filters and mappers. Conditions were left out on purpose since I thought there is little need for defining coditional logic using Ant when we can write Scala instead. Defining other Ant artifacts like project, targets, etc. is out of this project’s scope.
Optional Ant tasks are not implemented but it is pretty simple to add them yourselves. (see above)