revanced-patches-tasker/build.gradle.kts

80 lines
2.4 KiB
Plaintext
Raw Normal View History

2022-03-21 15:19:51 +00:00
plugins {
2023-03-31 15:18:34 +00:00
kotlin("jvm") version "1.8.10"
2022-03-21 15:19:51 +00:00
}
group = "app.revanced"
2022-03-21 15:19:51 +00:00
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")
2022-03-21 15:19:51 +00:00
repositories {
mavenCentral()
mavenLocal()
2022-03-21 15:19:51 +00:00
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
2022-03-21 15:19:51 +00:00
credentials {
username = githubUsername
password = githubPassword
2022-03-21 15:19:51 +00:00
}
}
// Required for FlexVer-Java
maven {
url = uri("https://repo.sleeping.town")
content {
includeGroup("com.unascribed")
}
}
2022-03-21 15:19:51 +00:00
}
dependencies {
2023-05-23 23:28:22 +00:00
implementation("app.revanced:revanced-patcher:9.0.0")
implementation("app.revanced:multidexlib2:2.5.3-a3836654")
2022-08-28 19:39:13 +00:00
// Required for meta
implementation("com.google.code.gson:gson:2.10.1")
// Required for FlexVer-Java
implementation("com.unascribed:flexver-java:1.0.2")
}
2023-05-07 23:15:26 +00:00
kotlin {
jvmToolchain(11)
}
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate dex files from build and bundle them in the jar file"
dependsOn(build)
2022-06-16 10:55:13 +00:00
doLast {
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
2022-12-05 22:03:48 +00:00
val d8 = "${androidHome}/build-tools/33.0.1/d8"
2022-06-16 11:27:45 +00:00
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
2022-06-16 10:55:13 +00:00
val work = File("${buildDir}/libs")
2022-06-16 10:55:13 +00:00
exec {
workingDir = work
commandLine = listOf(d8, input)
}
exec {
workingDir = work
commandLine = listOf("zip", "-u", input, "classes.dex")
2022-06-16 10:55:13 +00:00
}
}
}
2022-08-28 19:39:13 +00:00
register<JavaExec>("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<DefaultTask>("publish") {
group = "publish"
description = "Dummy task"
2022-08-28 19:39:13 +00:00
dependsOn(named("generateBundle"), named("generateMeta"))
}
2022-06-16 11:33:50 +00:00
}