-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
108 lines (93 loc) · 3.32 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
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm") version "2.0.10"
`maven-publish`
signing
}
allprojects {
group = "com.github.mvysny.dynatest"
version = "0.26-SNAPSHOT"
repositories {
mavenCentral()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
}
defaultTasks("clean", "build")
subprojects {
apply {
plugin("maven-publish")
plugin("kotlin")
plugin("org.gradle.signing")
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
// creates a reusable function which configures proper deployment to Maven Central
ext["publishing"] = { artifactId: String ->
java {
withJavadocJar()
withSourcesJar()
}
tasks.withType<Javadoc> {
isFailOnError = false
}
publishing {
repositories {
maven {
setUrl("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
credentials {
username = project.properties["ossrhUsername"] as String? ?: "Unknown user"
password = project.properties["ossrhPassword"] as String? ?: "Unknown user"
}
}
}
publications {
create("mavenJava", MavenPublication::class.java).apply {
groupId = project.group.toString()
this.artifactId = artifactId
version = project.version.toString()
pom {
description = "Simple Dynamic Testing Framework piggybacking on JUnit5"
name = artifactId
url = "https://github.com/mvysny/dynatest"
licenses {
license {
name = "The Apache Software License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
}
}
developers {
developer {
id = "mavi"
name = "Martin Vysny"
email = "martin@vysny.me"
}
}
scm {
url = "https://github.com/mvysny/dynatest"
}
}
from(components["java"])
}
}
}
signing {
sign(publishing.publications["mavenJava"])
}
}
tasks.withType<Test> {
useJUnitPlatform()
testLogging {
// to see the stacktraces of failed tests in the CI console.
exceptionFormat = TestExceptionFormat.FULL
}
}
}
if (JavaVersion.current() > JavaVersion.VERSION_11 && gradle.startParameter.taskNames.contains("publish")) {
throw GradleException("Release this library with JDK 11 or lower, to ensure JDK8 compatibility; current JDK is ${JavaVersion.current()}")
}