-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
133 lines (111 loc) · 3.67 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
import net.thebugmc.gradle.sonatypepublisher.PublishingType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
idea
kotlin("jvm") version "1.9.22"
id("antlr")
id("net.thebugmc.gradle.sonatype-central-portal-publisher") version "1.2.2"
signing
`java-library`
jacoco
}
description = "Unit-tests generation library for Kotlin language."
version = System.getenv("GIT_TAG") ?: "1.0.0-SNAPSHOT"
group = "io.github.divinenickname.kotlin.utgen"
java.targetCompatibility = JavaVersion.VERSION_17
java.sourceCompatibility = JavaVersion.VERSION_17
dependencies {
antlr("org.antlr:antlr4:4.13.1")
api("org.antlr:antlr4:4.13.1")
api("com.squareup:kotlinpoet:1.16.0")
api("org.junit.jupiter:junit-jupiter-api:5.10.2")
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testImplementation("io.kotest:kotest-assertions-core-jvm:5.8.0")
testImplementation("org.mockito:mockito-core:5.11.0")
}
repositories {
mavenLocal()
mavenCentral()
maven("https://jitpack.io")
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict")
jvmTarget = "17"
}
}
tasks.withType<KotlinCompile>().configureEach {
dependsOn(tasks.withType<AntlrTask>())
}
tasks.withType<Jar>().configureEach {
dependsOn(tasks.withType<AntlrTask>())
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.generateGrammarSource {
val pkg = "io.github.divinenickname.kotlin.utgen.core.antlr"
arguments = arguments + listOf("-package", pkg)
outputDirectory = outputDirectory.resolve(pkg.split(".").joinToString("/"))
}
tasks.test {
finalizedBy(tasks.jacocoTestReport) // report is always generated after tests run
}
tasks.jacocoTestReport {
dependsOn(tasks.test) // tests are required to run before generating the report
reports {
csv.required.set(true)
xml.required.set(true)
}
classDirectories.setFrom(files(classDirectories.files.map {
fileTree(it) {
setExcludes(listOf(
"**/antlr/**",
))
}
}
))
}
signing {
useGpgCmd()
}
centralPortal {
publishingType.set(PublishingType.USER_MANAGED)
username.set(System.getenv("SONATYPE_USER"))
password.set(System.getenv("SONATYPE_PASSWORD"))
pom {
name.set("UTGen core")
url.set("https://github.com/divinenickname/utgen-kotlin-core")
developers {
developer {
name.set("Alexander Ilinykh")
email.set("[email protected]")
}
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/license/apache-2-0")
}
}
scm {
connection.set("scm:git:[email protected]:divinenickname/utgen-kotlin-core.git")
developerConnection.set("scm:git:[email protected]:divinenickname/utgen-kotlin-core.git")
url.set("https://github.com/divinenickname/utgen-kotlin-core")
}
withXml {
asNode().appendNode("dependencies").let {
for (dependency in configurations["api"].dependencies) {
it.appendNode("dependency").apply {
appendNode("groupId", dependency.group)
appendNode("artifactId", dependency.name)
appendNode("version", dependency.version)
}
}
}
}
}
}