forked from UnitTestBot/UTBotJava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
160 lines (140 loc) · 5.46 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import java.text.SimpleDateFormat
import org.gradle.api.JavaVersion.VERSION_11
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
group = "org.utbot"
val kotlinVersion: String by project
val semVer: String? by project
val coroutinesVersion: String by project
val collectionsVersion: String by project
val junit5Version: String by project
val dateBasedVersion: String = SimpleDateFormat("YYYY.MM").format(System.currentTimeMillis()) // CI proceeds the same way
version = semVer ?: "$dateBasedVersion-SNAPSHOT"
plugins {
`java-library`
kotlin("jvm") version "1.7.10"
`maven-publish`
}
configure<JavaPluginExtension> {
sourceCompatibility = VERSION_11
targetCompatibility = VERSION_11
}
allprojects {
apply {
plugin("maven-publish")
plugin("kotlin")
}
tasks {
withType<JavaCompile> {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
options.encoding = "UTF-8"
options.compilerArgs = options.compilerArgs + "-Xlint:all"
}
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = freeCompilerArgs + listOf("-Xallow-result-return-type", "-Xsam-conversions=class", "-Xcontext-receivers")
allWarningsAsErrors = false
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = freeCompilerArgs + listOf("-Xallow-result-return-type", "-Xsam-conversions=class", "-Xcontext-receivers")
allWarningsAsErrors = false
}
}
withType<Test> {
// uncomment if you want to see loggers output in console
// this is useful if you debug in docker
// testLogging.showStandardStreams = true
// testLogging.showStackTraces = true
// set heap size for the test JVM(s)
minHeapSize = "128m"
maxHeapSize = "3072m"
jvmArgs = listOf("-XX:MaxHeapSize=3072m")
useJUnitPlatform {
excludeTags = setOf("slow", "IntegrationTest")
}
addTestListener(object : TestListener {
override fun beforeSuite(suite: TestDescriptor) {}
override fun beforeTest(testDescriptor: TestDescriptor) {}
override fun afterTest(testDescriptor: TestDescriptor, result: TestResult) {
println("[$testDescriptor.classDisplayName] [$testDescriptor.displayName]: $result.resultType, length - ${(result.endTime - result.startTime) / 1000.0} sec")
if (result.resultType == TestResult.ResultType.FAILURE) {
println("Exception: " + result.exception?.stackTraceToString())
}
}
override fun afterSuite(testDescriptor: TestDescriptor, result: TestResult) {
if (testDescriptor.parent == null) { // will match the outermost suite
println("Test summary: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)")
}
}
})
}
}
repositories {
mavenCentral()
maven("https://s01.oss.sonatype.org/content/repositories/orgunittestbotsoot-1004/")
maven("https://plugins.gradle.org/m2")
maven("https://www.jetbrains.com/intellij-repository/releases")
maven("https://cache-redirector.jetbrains.com/maven-central")
}
dependencies {
implementation(group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-core", version = coroutinesVersion)
implementation(
group = "org.jetbrains.kotlinx",
name = "kotlinx-collections-immutable-jvm",
version = collectionsVersion
)
implementation(group = "org.jetbrains.kotlin", name = "kotlin-stdlib-jdk8", version = kotlinVersion)
implementation(group = "org.jetbrains.kotlin", name = "kotlin-reflect", version = kotlinVersion)
testImplementation("org.junit.jupiter:junit-jupiter") {
version {
strictly(junit5Version)
}
}
}
}
subprojects {
group = rootProject.group
version = rootProject.version
publishing {
publications {
create<MavenPublication>("jar") {
from(components["java"])
groupId = "org.utbot"
artifactId = project.name
}
}
}
}
dependencies {
implementation(group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version = kotlinVersion)
implementation(group = "org.jetbrains.kotlin", name = "kotlin-allopen", version = kotlinVersion)
}
configure(
listOf(
project(":utbot-api"),
project(":utbot-core"),
project(":utbot-framework"),
project(":utbot-framework-api"),
project(":utbot-fuzzers"),
project(":utbot-instrumentation"),
project(":utbot-rd"),
project(":utbot-summary")
)
) {
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/UnitTestBot/UTBotJava")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}