{toc:style=disc|indent=20px}
h1. Ant

To define an Ant's {{*<kotlinc>*}} task you need to define a {{*KOTLIN_HOME*}} environment variable and reference it in your Ant build:

{code}
<property environment="env"/>
<taskdef resource    = "org/jetbrains/jet/buildtools/ant/antlib.xml">
    <classpath>
        <fileset dir = "${env.KOTLIN_HOME}/lib" includes = "*.jar"/>
    </classpath>
</taskdef>
{code}


Alternatively, you can copy all jar files from Kotlin distribution to Ant's {{"lib"}} folder.


h2. {{*<kotlinc>*}} attributes


|| {align:center}Name{align} || {align:center}Description{align} || {align:center}Required{align} || {align:center}Default Value{align} ||
| {align:center}{{*src*}}{align} | Kotlin source file or directory to compile | {{"src"}} or {{"module"}} needs to be specified |  &nbsp; |
| {align:center}{{*module*}}{align} | Kotlin [module|http://confluence.jetbrains.net/display/Kotlin/Modules+and+Compilation] to compile | {{"src"}} or {{"module"}} needs to be specified |  &nbsp; |
| {align:center}{{*output*}}{align} | Destination directory | If {{"src"}} is used - {{"output"}} or {{"jar"}} needs to be specified |  &nbsp; |
| {align:center}{{*jar*}}{align} | Destination jar file | If {{"src"}} is used - {{"output"}} or {{"jar"}} needs to be specified
If {{"module"}} is used - only {{"jar"}} can be specified or it can be omitted | {align:center}{{"moduleName.jar"}}{align} |
| {align:center}{{*stdlib*}}{align} | Path to {{"kotlin-runtime.jar"}} | {align:center}{{false}}{align} |  {align:center}{{""}}{align} |
| {align:center}{{*includeRuntime*}}{align} | If {{"jar"}} is used - whether Kotlin runtime library is included | {align:center}{{false}}{align} | {align:center}{{true}}{align} |


h2. Examples


{code}
<kotlinc src = "test/longer-examples/Bottles.kt" output = "dist"/>
<kotlinc src = "test/longer-examples"            output = "dist"/>

<kotlinc src = "test/longer-examples/Bottles.kt" jar = "dist.jar"/>
<kotlinc src = "test/longer-examples"            jar = "dist.jar"/>

<kotlinc module = "test/modules/smoke/Smoke.kts" jar =  "dist.jar"/>
<kotlinc module = "test/modules/smoke/Smoke.kts"/>   => "smoke.jar"
{code}

{{"Smoke.kts"}}:

{code}
import kotlin.modules.*

fun project() {
    module("smoke") {
        sources += "Smoke.kt"
    }
}
{code}
{{"Smoke.kt"}}:

{code}
package Smoke

fun main(args: Array<String>) {
    print("${args[0]}|${args[1]}|${args[2]}")
}
{code}
