generated from ReVanced/revanced-patches-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
110 lines (93 loc) · 3.33 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import org.gradle.kotlin.dsl.support.listFilesOrdered
plugins {
kotlin("jvm") version "1.9.10"
`maven-publish`
}
group = "app.renanced"
repositories {
mavenCentral()
mavenLocal()
google()
maven { url = uri("https://jitpack.io") }
}
dependencies {
implementation(libs.revanced.patcher)
implementation(libs.smali)
// TODO: Required because build fails without it. Find a way to remove this dependency.
implementation(libs.guava)
// Used in JsonGenerator.
implementation(libs.gson)
// A dependency to the Android library unfortunately fails the build, which is why this is required.
compileOnly(project("dummy"))
}
kotlin {
jvmToolchain(11)
}
tasks.withType(Jar::class) {
manifest {
attributes["Name"] = "Nizi Patches"
attributes["Description"] = "Patches for ReNanced."
attributes["Version"] = version
attributes["Timestamp"] = System.currentTimeMillis().toString()
attributes["Source"] = "git@github.com:Pamilg8/nizi-patches.git"
attributes["Author"] = "Pamilg8"
attributes["Contact"] = "contact@your.homepage"
attributes["Origin"] = "https://your.homepage"
attributes["License"] = "GNU General Public License v3.0"
}
}
tasks {
register<DefaultTask>("generateBundle") {
description = "Generate DEX files and add them in the JAR file"
dependsOn(build)
doLast {
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
.listFilesOrdered().last().resolve("d8").absolutePath
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
exec {
workingDir = workingDirectory
commandLine = listOf(d8, artifacts)
}
exec {
workingDir = workingDirectory
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
}
}
}
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
named("publish") {
dependsOn("generateBundle")
}
}
publishing {
publications {
create<MavenPublication>("revanced-patches-publication") {
from(components["java"])
pom {
name = "Your Patches"
description = "Patches for ReVanced."
url = "https://your.homepage"
licenses {
license {
name = "GNU General Public License v3.0"
url = "https://www.gnu.org/licenses/gpl-3.0.en.html"
}
}
developers {
developer {
id = "Your ID"
name = "Your Name"
email = "contact@your.homepage"
}
}
scm {
connection = "scm:git:git://github.com/you/revanced-patches.git"
developerConnection = "scm:git:git@github.com:you/revanced-patches.git"
url = "https://github.com/you/revanced-patches"
}
}
}
}
}