feat: generate dex files using gradle task

This commit is contained in:
Lucaskyy
2022-06-16 12:47:49 +02:00
parent 2c336e11b7
commit c34c1be21f
2 changed files with 15 additions and 11 deletions

View File

@ -22,12 +22,25 @@ dependencies {
}
tasks {
register<Exec>("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")
workingDir = File("${buildDir}/libs")
commandLine = listOf(d8, input)
commandLine = listOf("mv", "*.dex", output)
}
// Dummy task to fix the Gradle semantic-release plugin.
// Remove this if you forked it to support building only.
// Tracking issue: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
register<DefaultTask>("publish") {
group = "publish"
description = "Dummy task"
dependsOn(build)
dependsOn(named("generateDex"))
}
}