val texturePackerSource = "src/main/textures"
val texturePackerResources = "$buildDir/generated/sources/texturePacker/resources/main"
val texturePackerGeneratedSources = "$buildDir/generated/sources/texturePacker/java/main"

sourceSets.main.get().java.srcDir(texturePackerGeneratedSources)
sourceSets.main.get().resources.srcDir(texturePackerResources)

tasks {
    val packTextures = register<TexturePackerTask>("packTextures") {
        input.set(file(texturePackerSource))
        resourceOutput.set(file(texturePackerResources))
        generatedSourceOutput.set(file(texturePackerGeneratedSources))
    }

    processResources {
        dependsOn(packTextures)
    }

    compileJava {
        dependsOn(packTextures)
    }
}