-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathbuild.gradle.kts
132 lines (113 loc) · 4.37 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
import org.jetbrains.kotlin.gradle.dsl.jvm.JvmTargetValidationMode.WARNING
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
kotlin("multiplatform") apply false
id("org.jetbrains.dokka") apply false
}
println("project: $path")
println("version: $version")
println("group: $group")
allprojects {
repositories {
mavenCentral()
maven("https://maven.tryformation.com/releases") {
content {
includeGroup("com.jillesvangurp")
}
}
}
}
subprojects {
tasks.register("versionCheck") {
doLast {
if (rootProject.version == "unspecified") {
error("call with -Pversion=x.y.z to set a version and make sure it lines up with the current tag")
}
}
}
tasks.withType<PublishToMavenRepository> {
dependsOn("versionCheck")
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging.exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
testLogging.events = setOf(
org.gradle.api.tasks.testing.logging.TestLogEvent.FAILED,
org.gradle.api.tasks.testing.logging.TestLogEvent.PASSED,
org.gradle.api.tasks.testing.logging.TestLogEvent.SKIPPED,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_ERROR,
org.gradle.api.tasks.testing.logging.TestLogEvent.STANDARD_OUT
)
addTestListener(object : TestListener {
val failures = mutableListOf<String>()
override fun beforeSuite(desc: TestDescriptor) {
}
override fun afterSuite(desc: TestDescriptor, result: TestResult) {
}
override fun beforeTest(desc: TestDescriptor) {
}
override fun afterTest(desc: TestDescriptor, result: TestResult) {
if (result.resultType == TestResult.ResultType.FAILURE) {
val report =
"""
TESTFAILURE ${desc.className} - ${desc.name}
${
result.exception?.let { e ->
"""
${e::class.simpleName} ${e.message}
""".trimIndent()
}
}
-----------------
""".trimIndent()
failures.add(report)
}
}
})
}
apply(plugin = "maven-publish")
apply(plugin = "org.jetbrains.dokka")
afterEvaluate {
tasks.register<Jar>("dokkaJar") {
from(tasks["dokkaHtml"])
dependsOn(tasks["dokkaHtml"])
archiveClassifier.set("javadoc")
}
configure<PublishingExtension> {
publications {
withType<MavenPublication> {
pom {
name.set("KtSearch")
url.set("https://github.com/jillesvangurp/kt-search")
licenses {
license {
name.set("MIT License")
url.set("https://github.com/jillesvangurp/kt-search/blob/master/LICENSE")
}
}
developers {
developer {
id.set("jillesvangurp")
name.set("Jilles van Gurp")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/jillesvangurp/kt-search.git")
developerConnection.set("scm:git:ssh://github.com:jillesvangurp/kt-search.git")
url.set("https://github.com/jillesvangurp/kt-search")
}
}
}
}
repositories {
maven {
// GOOGLE_APPLICATION_CREDENTIALS env var must be set for this to work
// public repository is at https://maven.tryformation.com/releases
url = uri("gcs://mvn-public-tryformation/releases")
name = "FormationPublic"
}
}
}
}
}