2023-10-14 04:38:39 +02:00
|
|
|
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
|
|
|
|
2022-03-21 16:19:51 +01:00
|
|
|
plugins {
|
2023-10-22 16:14:46 +02:00
|
|
|
kotlin("jvm") version "1.9.10"
|
2023-12-02 22:35:13 +01:00
|
|
|
alias(libs.plugins.binary.compatibility.validator)
|
2023-10-14 04:38:39 +02:00
|
|
|
`maven-publish`
|
2022-03-21 16:19:51 +01:00
|
|
|
}
|
|
|
|
|
2022-03-21 22:06:24 +01:00
|
|
|
group = "app.revanced"
|
2022-03-21 16:19:51 +01:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2022-06-26 15:15:59 +02:00
|
|
|
mavenLocal()
|
2023-08-27 21:40:49 +02:00
|
|
|
google()
|
2023-10-09 18:54:59 +02:00
|
|
|
maven { url = uri("https://jitpack.io") }
|
2022-03-21 16:19:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-09-20 05:33:02 +02:00
|
|
|
implementation(libs.revanced.patcher)
|
|
|
|
implementation(libs.smali)
|
|
|
|
// TODO: Required because build fails without it. Find a way to remove this dependency.
|
|
|
|
implementation(libs.guava)
|
2023-08-27 21:40:49 +02:00
|
|
|
// Used in JsonGenerator.
|
2023-09-20 05:33:02 +02:00
|
|
|
implementation(libs.gson)
|
2023-10-14 04:38:39 +02:00
|
|
|
|
2023-09-20 05:33:02 +02:00
|
|
|
// A dependency to the Android library unfortunately fails the build, which is why this is required.
|
2023-06-12 01:15:16 +02:00
|
|
|
compileOnly(project("dummy"))
|
2022-06-16 11:54:39 +02:00
|
|
|
}
|
|
|
|
|
2023-05-08 01:15:26 +02:00
|
|
|
kotlin {
|
|
|
|
jvmToolchain(11)
|
|
|
|
}
|
|
|
|
|
2023-11-28 00:04:39 +01:00
|
|
|
tasks.withType(Jar::class) {
|
|
|
|
exclude("app/revanced/meta")
|
|
|
|
|
|
|
|
manifest {
|
|
|
|
attributes["Name"] = "ReVanced Patches"
|
|
|
|
attributes["Description"] = "Patches for ReVanced."
|
|
|
|
attributes["Version"] = version
|
|
|
|
attributes["Timestamp"] = System.currentTimeMillis().toString()
|
|
|
|
attributes["Source"] = "git@github.com:revanced/revanced-patches.git"
|
|
|
|
attributes["Author"] = "ReVanced"
|
|
|
|
attributes["Contact"] = "contact@revanced.app"
|
|
|
|
attributes["Origin"] = "https://revanced.app"
|
|
|
|
attributes["License"] = "GNU General Public License v3.0"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-06-16 11:54:39 +02:00
|
|
|
tasks {
|
2022-08-20 01:26:59 +02:00
|
|
|
register<DefaultTask>("generateBundle") {
|
|
|
|
description = "Generate dex files from build and bundle them in the jar file"
|
2023-10-14 04:38:39 +02:00
|
|
|
|
2022-06-16 12:47:49 +02:00
|
|
|
dependsOn(build)
|
|
|
|
|
2022-06-16 12:55:13 +02:00
|
|
|
doLast {
|
2023-10-14 04:38:39 +02:00
|
|
|
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
|
2022-06-16 12:47:49 +02:00
|
|
|
|
2022-06-16 12:55:13 +02:00
|
|
|
exec {
|
2023-10-14 04:38:39 +02:00
|
|
|
workingDir = workingDirectory
|
|
|
|
commandLine = listOf(d8, artifacts)
|
2022-06-16 12:55:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
2023-10-14 04:38:39 +02:00
|
|
|
workingDir = workingDirectory
|
|
|
|
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
|
2022-06-16 12:55:13 +02:00
|
|
|
}
|
|
|
|
}
|
2022-06-16 12:47:49 +02:00
|
|
|
}
|
2023-09-20 05:33:02 +02:00
|
|
|
|
2022-08-28 21:39:13 +02:00
|
|
|
register<JavaExec>("generateMeta") {
|
|
|
|
description = "Generate metadata for this bundle"
|
2023-10-14 04:38:39 +02:00
|
|
|
|
2022-07-08 21:17:39 +02:00
|
|
|
dependsOn(build)
|
|
|
|
|
|
|
|
classpath = sourceSets["main"].runtimeClasspath
|
2023-01-22 15:38:12 +01:00
|
|
|
mainClass.set("app.revanced.meta.PatchesFileGenerator")
|
2022-07-08 21:17:39 +02:00
|
|
|
}
|
2023-09-20 05:33:02 +02:00
|
|
|
|
2023-10-14 04:38:39 +02:00
|
|
|
// 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")
|
|
|
|
dependsOn("generateMeta")
|
2022-06-16 11:54:39 +02:00
|
|
|
}
|
2022-06-16 13:33:50 +02:00
|
|
|
}
|
2023-10-14 04:38:39 +02:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
create<MavenPublication>("revanced-patches-publication") {
|
|
|
|
from(components["java"])
|
|
|
|
|
|
|
|
pom {
|
|
|
|
name = "ReVanced Patches"
|
|
|
|
description = "Patches for ReVanced."
|
|
|
|
url = "https://revanced.app"
|
|
|
|
|
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name = "GNU General Public License v3.0"
|
|
|
|
url = "https://www.gnu.org/licenses/gpl-3.0.en.html"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id = "ReVanced"
|
|
|
|
name = "ReVanced"
|
|
|
|
email = "contact@revanced.app"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scm {
|
|
|
|
connection = "scm:git:git://github.com/revanced/revanced-patches.git"
|
|
|
|
developerConnection = "scm:git:git@github.com:revanced/revanced-patches.git"
|
|
|
|
url = "https://github.com/revanced/revanced-patches"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|