From 1d084917aeeddedca06eca327d4c0bf07b21c38f Mon Sep 17 00:00:00 2001 From: Alberto Ponces Date: Sat, 20 Aug 2022 00:26:59 +0100 Subject: [PATCH] feat: bundle `dex` file into `jar` file (#359) --- .releaserc | 3 --- build.gradle.kts | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.releaserc b/.releaserc index 49170c0a..ae403adb 100644 --- a/.releaserc +++ b/.releaserc @@ -31,9 +31,6 @@ "assets": [ { "path": "build/libs/*.jar" - }, - { - "path": "build/libs/*.dex" } ] } diff --git a/build.gradle.kts b/build.gradle.kts index d0585832..d288793b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -27,15 +27,14 @@ dependencies { } tasks { - register("generateDex") { - description = "Generate dex files from build" + register("generateBundle") { + description = "Generate dex files from build and bundle them in the jar file" dependsOn(build) doLast { val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found") val d8 = "${androidHome}/build-tools/32.0.0/d8" val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath - val output = input.replace(".jar", ".dex") val work = File("${buildDir}/libs") exec { @@ -45,7 +44,7 @@ tasks { exec { workingDir = work - commandLine = listOf("mv", "classes.dex", output) + commandLine = listOf("zip", "-u", input, "classes.dex") } } } @@ -62,6 +61,6 @@ tasks { register("publish") { group = "publish" description = "Dummy task" - dependsOn(named("generateDex"), named("generateReadme")) + dependsOn(named("generateBundle"), named("generateReadme")) } }