revanced-patches/build.gradle.kts

67 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-03-21 16:19:51 +01:00
plugins {
kotlin("jvm") version "1.7.0"
2022-03-21 16:19:51 +01:00
}
group = "app.revanced"
2022-03-21 16:19:51 +01: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 16:19:51 +01:00
repositories {
mavenCentral()
mavenLocal()
2022-03-21 16:19:51 +01:00
maven {
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
2022-03-21 16:19:51 +01:00
credentials {
username = githubUsername
password = githubPassword
2022-03-21 16:19:51 +01:00
}
}
}
dependencies {
2022-12-02 02:35:34 +01:00
implementation("app.revanced:revanced-patcher:6.2.0")
implementation("app.revanced:multidexlib2:2.5.2.r2")
2022-08-28 21:39:13 +02:00
// Required for meta
2022-11-23 00:34:18 +01:00
implementation("com.google.code.gson:gson:2.10")
}
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate dex files from build and bundle them in the jar file"
dependsOn(build)
2022-06-16 12:55:13 +02:00
doLast {
val androidHome = System.getenv("ANDROID_HOME") ?: throw GradleException("ANDROID_HOME not found")
val d8 = "${androidHome}/build-tools/32.0.0/d8"
2022-06-16 13:27:45 +02:00
val input = configurations.archives.get().allArtifacts.files.files.first().absolutePath
2022-06-16 12:55:13 +02:00
val work = File("${buildDir}/libs")
2022-06-16 12:55:13 +02:00
exec {
workingDir = work
commandLine = listOf(d8, input)
}
exec {
workingDir = work
commandLine = listOf("zip", "-u", input, "classes.dex")
2022-06-16 12:55:13 +02:00
}
}
}
2022-08-28 21:39:13 +02:00
register<JavaExec>("generateMeta") {
description = "Generate metadata for this bundle"
dependsOn(build)
classpath = sourceSets["main"].runtimeClasspath
2022-08-28 21:39:13 +02:00
mainClass.set("app.revanced.meta.Meta")
}
// 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 13:33:50 +02:00
}