Kotlin Ant DSL allows using Ant tasks from Kotlin.
Ant {
echo("Hello World")
mkdir("dir1")
copy(todir = "dir1") {
fileset(dir = "dir2")
include(name = "**/*.txt")
}
}
}
Define a function to use a custom Ant task:
fun Ant.myanttask(attr1: String, attr2: String) {
MyAntTask().execute("myanttask") { task ->
task.setAttr1(attr1)
task.setAttr2(attr2)
}
}
Execute custom Ant Task:
Ant {
myanttask("value1", "value2")
}
- bunzip2
- bzip2
- checksum
- chgrp
- chmod
- chown
- copy
- delete
- echo
- exec
- fixcrlf
- gunzip
- gzip
- jar
- java
- javac
- javadoc
- manifest
- manifestclasspath
- mkdir
- move
- property
- record
- replace
- replaceregexp
- tar
- touch
- unjar
- untar
- unwar
- unzip
- zip
- DirSet
- FileList
- FileSet
- MultiRootFileSet
- Path-like Structures
- Permissions
- PatternSet
- Regexp
- Selectors
- TarFileSet
- ZipFileSet
The Converter
converts Ant XML files to Kotlin Ant DSL.
Note that Kotlin Ant DSL does not support some Ant tags (e.g. <project>
and <target>
).
So you can not compile/run the output, but you can copy the parts that you need.
The primary goal is support migration of Ant builds to Kotlin based build systems (e.g. Kobalt)
The Kotlin code for the Ant tasks DSL is generated.
See generator.
If you miss some tasks, you can add them to
generator/Main.kt
and use ./kobaltw generator:run
to generate the DSL.
Then use ./kobaltw assemble
to compile the DSL.
For Maven, Gradle or Kobalt use:
Repository: jcenter (or https://dl.bintray.com/devcharly/maven/)
Group: com.devcharly
Artifact: kotlin-ant-dsl
Version: (latest)
Ant 1.9.7 or later