2023-10-14 02:38:39 +00:00
|
|
|
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
2024-03-04 17:09:57 +00:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
2023-10-14 02:38:39 +00:00
|
|
|
|
2022-03-21 15:19:51 +00:00
|
|
|
plugins {
|
2024-02-15 03:38:06 +00:00
|
|
|
alias(libs.plugins.kotlin)
|
2023-12-02 21:35:13 +00:00
|
|
|
alias(libs.plugins.binary.compatibility.validator)
|
2023-10-14 02:38:39 +00:00
|
|
|
`maven-publish`
|
2024-02-15 03:38:06 +00:00
|
|
|
signing
|
2022-03-21 15:19:51 +00:00
|
|
|
}
|
|
|
|
|
2022-03-21 21:06:24 +00:00
|
|
|
group = "app.revanced"
|
2022-03-21 15:19:51 +00:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
mavenCentral()
|
2022-06-26 13:15:59 +00:00
|
|
|
mavenLocal()
|
2023-08-27 19:40:49 +00:00
|
|
|
google()
|
2024-02-15 03:38:06 +00:00
|
|
|
maven {
|
2024-04-05 19:17:40 +00:00
|
|
|
// A repository must be specified for some reason. "registry" is a dummy.
|
2024-02-15 03:38:06 +00:00
|
|
|
url = uri("https://maven.pkg.github.com/revanced/registry")
|
|
|
|
credentials {
|
|
|
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
|
|
|
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
|
|
|
|
}
|
|
|
|
}
|
2022-03-21 15:19:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-09-20 03:33:02 +00: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 19:40:49 +00:00
|
|
|
// Used in JsonGenerator.
|
2023-09-20 03:33:02 +00:00
|
|
|
implementation(libs.gson)
|
2022-06-16 09:54:39 +00:00
|
|
|
}
|
|
|
|
|
2023-05-07 23:15:26 +00:00
|
|
|
kotlin {
|
2024-03-04 17:09:57 +00:00
|
|
|
compilerOptions {
|
|
|
|
jvmTarget.set(JvmTarget.JVM_11)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
java {
|
|
|
|
targetCompatibility = JavaVersion.VERSION_11
|
2023-05-07 23:15:26 +00:00
|
|
|
}
|
|
|
|
|
2024-02-15 03:38:06 +00: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"
|
|
|
|
}
|
2023-11-27 23:04:39 +00:00
|
|
|
}
|
|
|
|
|
2024-02-15 03:38:06 +00:00
|
|
|
register("buildDexJar") {
|
|
|
|
description = "Build and add a DEX to the JAR file"
|
|
|
|
group = "build"
|
2023-10-14 02:38:39 +00:00
|
|
|
|
2022-06-16 10:47:49 +00:00
|
|
|
dependsOn(build)
|
|
|
|
|
2022-06-16 10:55:13 +00:00
|
|
|
doLast {
|
2023-10-14 02:38:39 +00:00
|
|
|
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
|
|
|
.listFilesOrdered().last().resolve("d8").absolutePath
|
|
|
|
|
2024-02-15 03:38:06 +00:00
|
|
|
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
2023-10-14 02:38:39 +00:00
|
|
|
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
|
2022-06-16 10:47:49 +00:00
|
|
|
|
2022-06-16 10:55:13 +00:00
|
|
|
exec {
|
2023-10-14 02:38:39 +00:00
|
|
|
workingDir = workingDirectory
|
2024-02-21 02:46:34 +00:00
|
|
|
commandLine = listOf(d8, "--release", patchesJar)
|
2022-06-16 10:55:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
2023-10-14 02:38:39 +00:00
|
|
|
workingDir = workingDirectory
|
2024-02-15 03:38:06 +00:00
|
|
|
commandLine = listOf("zip", "-u", patchesJar, "classes.dex")
|
2022-06-16 10:55:13 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-16 10:47:49 +00:00
|
|
|
}
|
2023-09-20 03:33:02 +00:00
|
|
|
|
2024-02-15 03:38:06 +00:00
|
|
|
register<JavaExec>("generatePatchesFiles") {
|
|
|
|
description = "Generate patches files"
|
2023-10-14 02:38:39 +00:00
|
|
|
|
2022-07-08 19:17:39 +00:00
|
|
|
dependsOn(build)
|
|
|
|
|
|
|
|
classpath = sourceSets["main"].runtimeClasspath
|
2024-02-15 03:38:06 +00:00
|
|
|
mainClass.set("app.revanced.generator.MainKt")
|
2022-07-08 19:17:39 +00:00
|
|
|
}
|
2023-09-20 03:33:02 +00:00
|
|
|
|
2024-02-15 03:38:06 +00:00
|
|
|
// Needed by gradle-semantic-release-plugin.
|
2023-10-14 02:38:39 +00:00
|
|
|
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
2024-02-15 03:38:06 +00:00
|
|
|
publish {
|
|
|
|
dependsOn("buildDexJar")
|
|
|
|
dependsOn("generatePatchesFiles")
|
2022-06-16 09:54:39 +00:00
|
|
|
}
|
2022-06-16 11:33:50 +00:00
|
|
|
}
|
2023-10-14 02:38:39 +00:00
|
|
|
|
|
|
|
publishing {
|
2024-02-15 03:43:40 +00:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = "GitHubPackages"
|
|
|
|
url = uri("https://maven.pkg.github.com/revanced/revanced-patches")
|
|
|
|
credentials {
|
|
|
|
username = System.getenv("GITHUB_ACTOR")
|
|
|
|
password = System.getenv("GITHUB_TOKEN")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-10-14 02:38:39 +00:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-02-13 01:58:24 +00:00
|
|
|
}
|
2024-02-15 03:38:06 +00:00
|
|
|
|
|
|
|
signing {
|
|
|
|
useGpgCmd()
|
|
|
|
|
|
|
|
sign(publishing.publications["revanced-patches-publication"])
|
|
|
|
}
|