-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
82 lines (65 loc) · 1.88 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
configurations {
create("r8")
}
plugins {
application
kotlin("jvm") version "1.9.10"
}
group = "net.cafesalam"
version = "0.0.3"
application {
mainClass.set("net.cafesalam.profilerutil.MainKt")
}
repositories {
mavenCentral()
google()
}
dependencies {
"r8"("com.android.tools:r8:8.1.56")
implementation("com.squareup.okio:okio:3.5.0")
implementation("com.github.ajalt.clikt:clikt:3.5.0")
implementation("com.google.apis:google-api-services-sheets:v4-rev20230815-2.0.0")
implementation("com.google.auth:google-auth-library-oauth2-http:1.19.0")
testImplementation(kotlin("test"))
}
val fatJar = task("fatJar", type = Jar::class) {
dependsOn(project.configurations["runtimeClasspath"])
dependsOn(tasks.named("jar"))
archiveClassifier.set("fat")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes["Main-Class"] = "net.cafesalam.profilerutil.MainKt"
}
val sourceClasses = sourceSets.main.get().output.classesDirs
inputs.files(sourceClasses)
doFirst {
from(sourceClasses)
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
}
}
val r8File = File("$buildDir/libs/profiler-util-$version-r8.jar")
val r8Jar = task("r8Jar", type = JavaExec::class) {
dependsOn(project.configurations["runtimeClasspath"])
inputs.files(fatJar.outputs.files)
outputs.file(r8File)
classpath = project.configurations["r8"]
mainClass.set("com.android.tools.r8.R8")
val arguments = mutableListOf(
"--release",
"--classfile",
"--output", r8File.toString(),
"--pg-conf", "src/main/rules.txt",
"--lib", System.getProperty("java.home").toString()
)
doFirst {
arguments.add(fatJar.archiveFile.get().asFile.absolutePath)
args = arguments
}
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlin.jvmToolchain(8)
}