import org.gradle.kotlin.dsl.support.listFilesOrdered plugins { alias(libs.plugins.kotlin) alias(libs.plugins.binary.compatibility.validator) `maven-publish` } group = "your.org" repositories { mavenCentral() mavenLocal() google() maven { url = uri("https://jitpack.io") } } dependencies { implementation(libs.revanced.patcher) implementation(libs.smali) } kotlin { jvmToolchain(11) } tasks.withType(Jar::class) { manifest { attributes["Name"] = "Your Patches" attributes["Description"] = "Patches for ReVanced." attributes["Version"] = version attributes["Timestamp"] = System.currentTimeMillis().toString() attributes["Source"] = "git@github.com:you/revanced-patches.git" attributes["Author"] = "You" attributes["Contact"] = "contact@your.homepage" attributes["Origin"] = "https://your.homepage" attributes["License"] = "GNU General Public License v3.0" } } tasks { register("generateBundle") { description = "Generate DEX files and add them in the JAR file" dependsOn(build) doLast { val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools") .listFilesOrdered().last().resolve("d8").absolutePath val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath val workingDirectory = layout.buildDirectory.dir("libs").get().asFile exec { workingDir = workingDirectory commandLine = listOf(d8, artifacts) } exec { workingDir = workingDirectory commandLine = listOf("zip", "-u", artifacts, "classes.dex") } } } // Required to run tasks because Gradle semantic-release plugin runs the publish task. // Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435 named("publish") { dependsOn("generateBundle") } } publishing { publications { create("revanced-patches-publication") { from(components["java"]) pom { name = "Your Patches" description = "Patches for ReVanced." url = "https://your.homepage" licenses { license { name = "GNU General Public License v3.0" url = "https://www.gnu.org/licenses/gpl-3.0.en.html" } } developers { developer { id = "Your ID" name = "Your Name" email = "contact@your.homepage" } } scm { connection = "scm:git:git://github.com/you/revanced-patches.git" developerConnection = "scm:git:git@github.com:you/revanced-patches.git" url = "https://github.com/you/revanced-patches" } } } } }