import org.gradle.kotlin.dsl.support.listFilesOrdered plugins { kotlin("jvm") version "1.9.23" } group = "app.revanced" val githubUsername: String = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR") val githubPassword: String = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN") repositories { mavenCentral() mavenLocal() maven { url = uri("https://maven.pkg.github.com/revanced/multidexlib2") credentials { username = githubUsername password = githubPassword } } maven { url = uri("https://repo.sleeping.town") content { includeGroup("com.unascribed") } } } dependencies { implementation("app.revanced:revanced-patcher:8.0.0-arsclib") implementation("app.revanced:multidexlib2:2.5.3-a3836654") // Required for meta implementation("com.google.code.gson:gson:2.10.1") // Required for FlexVer-Java implementation("com.unascribed:flexver-java:1.1.1") } kotlin { jvmToolchain(17) } tasks { register("generateBundle") { description = "Generate dex files from build and bundle them in the jar file" dependsOn(build) doLast { val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools") .listFilesOrdered().last().resolve("d8").absolutePath val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath val workingDirectory = layout.buildDirectory.dir("libs").get().asFile exec { workingDir = workingDirectory commandLine = listOf(d8, "--release", patchesJar) } exec { workingDir = workingDirectory commandLine = listOf("zip", "-u", patchesJar, "classes.dex") } } } register("generateMeta") { description = "Generate metadata for this bundle" dependsOn(build) classpath = sourceSets["main"].runtimeClasspath mainClass.set("app.revanced.meta.PatchesFileGenerator") } // 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("publish") { group = "publish" description = "Dummy task" dependsOn(named("generateBundle"), named("generateMeta")) } }