2022-03-21 15:19:51 +00:00
|
|
|
plugins {
|
2022-06-13 23:03:27 +00:00
|
|
|
kotlin("jvm") version "1.7.0"
|
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
|
|
|
|
2022-06-26 13:15:59 +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()
|
2022-06-26 13:15:59 +00:00
|
|
|
mavenLocal()
|
2022-03-21 15:19:51 +00:00
|
|
|
maven {
|
2022-06-13 23:03:27 +00:00
|
|
|
url = uri("https://maven.pkg.github.com/revanced/revanced-patcher")
|
2022-03-21 15:19:51 +00:00
|
|
|
credentials {
|
2022-06-26 13:15:59 +00:00
|
|
|
username = githubUsername
|
|
|
|
password = githubPassword
|
2022-03-21 15:19:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
2022-09-08 14:59:29 +00:00
|
|
|
implementation("app.revanced:revanced-patcher:4.2.2")
|
2022-06-26 13:15:59 +00:00
|
|
|
implementation("app.revanced:multidexlib2:2.5.2.r2")
|
2022-08-28 19:39:13 +00:00
|
|
|
|
|
|
|
// Required for meta
|
|
|
|
implementation("com.google.code.gson:gson:2.9.1")
|
2022-06-16 09:54:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tasks {
|
2022-08-19 23:26:59 +00:00
|
|
|
register<DefaultTask>("generateBundle") {
|
|
|
|
description = "Generate dex files from build and bundle them in the jar file"
|
2022-06-16 10:47:49 +00:00
|
|
|
dependsOn(build)
|
|
|
|
|
2022-06-16 10:55:13 +00: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 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:47:49 +00:00
|
|
|
|
2022-06-16 10:55:13 +00:00
|
|
|
exec {
|
|
|
|
workingDir = work
|
|
|
|
commandLine = listOf(d8, input)
|
|
|
|
}
|
|
|
|
|
|
|
|
exec {
|
|
|
|
workingDir = work
|
2022-08-19 23:26:59 +00:00
|
|
|
commandLine = listOf("zip", "-u", input, "classes.dex")
|
2022-06-16 10:55:13 +00:00
|
|
|
}
|
|
|
|
}
|
2022-06-16 10:47:49 +00:00
|
|
|
}
|
2022-08-28 19:39:13 +00:00
|
|
|
register<JavaExec>("generateMeta") {
|
|
|
|
description = "Generate metadata for this bundle"
|
2022-07-08 19:17:39 +00:00
|
|
|
dependsOn(build)
|
|
|
|
|
|
|
|
classpath = sourceSets["main"].runtimeClasspath
|
2022-08-28 19:39:13 +00:00
|
|
|
mainClass.set("app.revanced.meta.Meta")
|
2022-07-08 19:17:39 +00:00
|
|
|
}
|
2022-06-16 09:54:39 +00: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 19:39:13 +00:00
|
|
|
dependsOn(named("generateBundle"), named("generateMeta"))
|
2022-06-16 09:54:39 +00:00
|
|
|
}
|
2022-06-16 11:33:50 +00:00
|
|
|
}
|