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

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
}

sourceCompatibility = "7"
targetCompatibility = "7"


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 "eddalvikdx"
    onlyIf {
        !jar.state.upToDate || !file(archiveName).exists()
    }
}