forked from pascal-lab/Tai-e
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
108 lines (98 loc) · 3.66 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
plugins {
application
id("tai-e.conventions")
id("maven-publish.conventions")
}
group = projectGroupId
description = projectArtifactId
version = projectVersion
dependencies {
// Process options
implementation("info.picocli:picocli:4.7.3")
// Logger
implementation("org.apache.logging.log4j:log4j-api:2.20.0")
implementation("org.apache.logging.log4j:log4j-core:2.20.0")
// Process YAML configuration files
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.15.0")
// Use Soot as frontend
implementation(files("lib/sootclasses-modified.jar"))
"org.soot-oss:soot:4.4.1".let {
// Disable transitive dependencies from Soot in compile classpath
compileOnly(it) { isTransitive = false }
testCompileOnly(it) { isTransitive = false }
runtimeOnly(it)
}
// Use ASM to read Java class files
implementation("org.ow2.asm:asm:9.4")
// Eliminate SLF4J warning
implementation("org.slf4j:slf4j-nop:2.0.7")
// JSR305, for javax.annotation
implementation("com.google.code.findbugs:jsr305:3.0.2")
testImplementation(platform("org.junit:junit-bom:5.10.0"))
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.junit.platform:junit-platform-suite")
}
application {
mainClass.set("pascal.taie.Main")
}
task("fatJar", type = Jar::class) {
group = "build"
description = "Creates a single jar file including Tai-e and all dependencies"
manifest {
attributes["Main-Class"] = "pascal.taie.Main"
attributes["Tai-e-Version"] = projectVersion
attributes["Tai-e-Commit"] = projectCommit
}
archiveBaseName.set("tai-e-all")
from(
configurations.runtimeClasspath.get().map {
if (it.isDirectory) it else zipTree(it)
}
)
from("COPYING", "COPYING.LESSER")
destinationDirectory.set(rootProject.layout.buildDirectory)
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
with(tasks["jar"] as CopySpec)
}
tasks.jar {
from("COPYING", "COPYING.LESSER")
from(zipTree("lib/sootclasses-modified.jar"))
destinationDirectory.set(rootProject.layout.buildDirectory)
manifest {
attributes["Tai-e-Version"] = projectVersion
attributes["Tai-e-Commit"] = projectCommit
}
}
tasks.withType<Test> {
// Uses JUnit5
useJUnitPlatform()
// Increases the maximum heap memory of JUnit test process. The default is 512M.
// (see org.gradle.process.internal.worker.DefaultWorkerProcessBuilder.build)
maxHeapSize = "2G"
// Sets the maximum number of test processes to start in parallel.
maxParallelForks = (Runtime.getRuntime().availableProcessors() / 2).takeIf { it > 0 } ?: 1
// Sets the default classpath for test execution.
// (see https://docs.gradle.org/current/userguide/upgrading_version_8.html#test_task_default_classpath)
val test by testing.suites.existing(JvmTestSuite::class)
testClassesDirs = files(test.map { it.sources.output.classesDirs })
classpath = files(test.map { it.sources.runtimeClasspath })
}
tasks.test {
// Excludes test suites from the default test task
// to avoid running some tests multiple times.
filter {
excludeTestsMatching("*TestSuite")
}
}
task("testTaieTestSuite", type = Test::class) {
group = "verification"
description = "Runs the Tai-e test suite"
filter {
includeTestsMatching("TaieTestSuite")
}
}
// Automatically agree the Gradle ToS when running gradle with '--scan' option
extensions.findByName("buildScan")?.withGroovyBuilder {
setProperty("termsOfServiceUrl", "https://gradle.com/terms-of-service")
setProperty("termsOfServiceAgree", "yes")
}