fix: broken gradle task

This commit is contained in:
Lucaskyy 2022-06-16 12:55:13 +02:00
parent c34c1be21f
commit 28e3f554ea
No known key found for this signature in database
GPG Key ID: 1530BFF96D1EEB89

View File

@ -22,18 +22,27 @@ dependencies {
}
tasks {
register<Exec>("generateDex") {
register<DefaultTask>("generateDex") {
description = "Generate dex files from build"
dependsOn(build)
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
val d8 = "${androidHome}/build-tools/32.0.0/d8"
val input = build.get().outputs.files.singleFile.absolutePath
val output = input.replace(".jar", ".dex")
doLast {
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
val d8 = "${androidHome}/build-tools/32.0.0/d8"
val input = build.get().outputs.files.singleFile.absolutePath
val output = input.replace(".jar", ".dex")
val work = File("${buildDir}/libs")
workingDir = File("${buildDir}/libs")
commandLine = listOf(d8, input)
commandLine = listOf("mv", "*.dex", output)
exec {
workingDir = work
commandLine = listOf(d8, input)
}
exec {
workingDir = work
commandLine = listOf("mv", "*.dex", output)
}
}
}
// Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only.