import org.gradle.internal.os.OperatingSystem
apply plugin: 'java'

description = "A utility for doing compile or runtime code generation targeting Android's Dalvik VM"

targetCompatibility = '1.7'
sourceCompatibility = '1.7'

repositories {
    jcenter()
}

dependencies {
    compileOnly project(':dalvikdx')
}

task dexInJar(type: Jar) {
    dependsOn jar
    doFirst {
        exec {
            workingDir jar.destinationDir
            if (OperatingSystem.current().isWindows())
                executable "dx.bat"
            else
                executable "dx"
            args "--dex", "--output", "classes.dex", "${jar.archiveName}"
        }
    }
    from "${jar.destinationDir}/classes.dex"
    destinationDir jar.destinationDir
    baseName "eddexmaker"
    onlyIf {
        !jar.state.upToDate || !file(archiveName).exists()
    }
}
