Posted By

alces on 02/06/13


Tagged

closure target AntBuilder


Versions (?)

AntBuilder pseudo-targets


 / Published in: Groovy
 

URL: groovy_ant_builder_target

Way to make ant-like pseudo-targets in groovy AntBuilder

  1. DEFAULT = 'jar'
  2. DEST = 'target'
  3. JAR = "$DEST/myapp.jar"
  4. SRC = 'src'
  5.  
  6. ant = new groovy.util.AntBuilder()
  7. ant.taskdef(name: 'groovyc', classname: 'org.codehaus.groovy.ant.Groovyc')
  8. compile = {
  9. println '\ncompile:'
  10. ant.mkdir(dir: DEST)
  11. ant.groovyc(destdir: DEST, srcdir: SRC, includes: '**/*.groovy')
  12. }
  13. jar = {
  14. compile()
  15. println '\njar:'
  16. ant.jar(destfile: JAR, basedir: DEST, includes: '**/*.class')
  17. }
  18.  
  19. if (args) for (t in args) this[t]() else this[DEFAULT]()

Report this snippet  

You need to login to post a comment.