2022-03-21 16:19:51 +01:00
|
|
|
plugins {
|
2023-07-05 22:38:39 +02:00
|
|
|
kotlin("jvm") version "1.8.20"
|
2023-09-20 05:33:02 +02:00
|
|
|
alias(libs.plugins.ksp)
|
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") }
|
2023-05-08 01:43:06 +02:00
|
|
|
// Required for FlexVer-Java
|
|
|
|
maven {
|
|
|
|
url = uri("https://repo.sleeping.town")
|
|
|
|
content {
|
|
|
|
includeGroup("com.unascribed")
|
|
|
|
}
|
|
|
|
}
|
2022-03-21 16:19:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2023-09-20 05:33:02 +02:00
|
|
|
implementation(libs.revanced.patcher)
|
|
|
|
implementation(libs.smali)
|
|
|
|
implementation(libs.revanced.patch.annotation.processor)
|
|
|
|
// 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)
|
|
|
|
// 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"))
|
2023-09-20 05:33:02 +02:00
|
|
|
|
|
|
|
ksp(libs.revanced.patch.annotation.processor)
|
2022-06-16 11:54:39 +02:00
|
|
|
}
|
|
|
|
|
2023-05-08 01:15:26 +02:00
|
|
|
kotlin {
|
|
|
|
jvmToolchain(11)
|
|
|
|
}
|
|
|
|
|
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"
|
2022-06-16 12:47:49 +02:00
|
|
|
dependsOn(build)
|
|
|
|
|
2022-06-16 12:55:13 +02:00
|
|
|
doLast {
|
|
|
|
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
|
2022-12-05 23:03:48 +01:00
|
|
|
val d8 = "${androidHome}/build-tools/33.0.1/d8"
|
2022-06-16 13:27:45 +02:00
|
|
|
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
2023-09-11 11:54:06 +02:00
|
|
|
val work = layout.buildDirectory.dir("libs").get().asFile
|
2022-06-16 12:47:49 +02:00
|
|
|
|
2022-06-16 12:55:13 +02:00
|
|
|
exec {
|
|
|
|
workingDir = work
|
|
|
|
commandLine = listOf(d8, input)
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
workingDir = work
|
2022-08-20 01:26:59 +02:00
|
|
|
commandLine = listOf("zip", "-u", input, "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"
|
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
|
|
|
|
2022-06-16 11:54:39 +02:00
|
|
|
// 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<DefaultTask>("publish") {
|
|
|
|
group = "publish"
|
|
|
|
description = "Dummy task"
|
2022-08-28 21:39:13 +02:00
|
|
|
dependsOn(named("generateBundle"), named("generateMeta"))
|
2022-06-16 11:54:39 +02:00
|
|
|
}
|
2022-06-16 13:33:50 +02:00
|
|
|
}
|