-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
118 lines (97 loc) · 3.29 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
val versionMockk: String by project
plugins {
kotlin("jvm") version "1.6.10"
id("org.jetbrains.dokka") version "1.6.10"
id("org.jetbrains.kotlinx.kover") version "0.5.0"
id("signing")
id("maven-publish")
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
}
group = "io.github.jcechace"
version = "0.1.1-SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10")
implementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testImplementation(kotlin("test"))
testImplementation("io.mockk:mockk:$versionMockk")
}
java {
withSourcesJar()
}
val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
}
val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-doc")
}
kover {
coverageEngine.set(kotlinx.kover.api.CoverageEngine.INTELLIJ)
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
}
}
}
publishing {
publications {
register<MavenPublication>("Fixture5") {
from(components["java"])
artifact(dokkaJavadocJar)
artifact(dokkaHtmlJar)
pom {
name.set("${project.group}:${project.name}")
description.set("Declarative fixtures for JUnit 5")
url.set("http://github.com/jcechace/fixture5")
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
developers {
developer {
id.set("jcechace")
name.set("Jakub Cechacek")
email.set("jcechace@gmail.com")
}
}
scm {
connection.set("scm:git:https://github.com/jcechace/fixture5.git")
developerConnection.set("scm:git:ssh://github.com/jcechace/fixture5.git")
url.set("http://github.com/jcechace/fixture5")
}
}
}
}
}
signing {
val signingKeyId: String? = System.getenv("SIGN_KEY_ID")
val signingKey: String? = System.getenv("SIGN_KEY")
val signingKeyPassphrase: String? = System.getenv("SIGN_KEY_PASSPHRASE")
if (!signingKey.isNullOrBlank()) {
if (signingKeyId?.isNotBlank() == true) {
useInMemoryPgpKeys(signingKeyId, signingKey, signingKeyPassphrase)
} else {
useInMemoryPgpKeys(signingKey, signingKeyPassphrase)
}
publishing.publications.forEach { sign(it) }
}
}
tasks.test {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
kotlinOptions.freeCompilerArgs += "-opt-in=kotlin.RequiresOptIn"
}