-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathbuild.gradle.kts
115 lines (99 loc) · 2.99 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
kotlin("jvm")
kotlin("kapt")
id("org.jetbrains.dokka")
signing
`maven-publish`
id("org.jmailen.kotlinter")
}
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable")
kapt("com.google.auto.service:auto-service:1.0.1")
compileOnly("com.google.auto.service:auto-service-annotations:1.0.1")
testImplementation(kotlin("test-junit5"))
testImplementation("org.jetbrains.kotlin:kotlin-compiler-embeddable")
testImplementation("com.github.tschuchortdev:kotlin-compile-testing:1.5.0")
testImplementation(enforcedPlatform("org.junit:junit-bom:5.9.1"))
}
tasks.withType<KotlinCompile> {
kotlinOptions.freeCompilerArgs += listOf(
"-opt-in=org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi",
)
}
tasks.withType<Test> {
enabled = false
useJUnitPlatform()
}
tasks.register("sourcesJar", Jar::class) {
group = "build"
description = "Assembles Kotlin sources"
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
dependsOn(tasks.classes)
}
tasks.register("dokkaJar", Jar::class) {
group = "documentation"
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
dependsOn(tasks.dokkaHtml)
}
signing {
setRequired(provider { gradle.taskGraph.hasTask("publish") })
sign(publishing.publications)
}
publishing {
publications {
create<MavenPublication>("default") {
from(components["java"])
artifact(tasks["sourcesJar"])
artifact(tasks["dokkaJar"])
pom {
name.set(project.name)
description.set("Kotlin compiler plugin to enable power assertions in the Kotlin programming language")
url.set("https://github.com/bnorm/kotlin-power-assert")
licenses {
license {
name.set("Apache License 2.0")
url.set("https://github.com/bnorm/kotlin-power-assert/blob/master/LICENSE.txt")
}
}
scm {
url.set("https://github.com/bnorm/kotlin-power-assert")
connection.set("scm:git:git://github.com/bnorm/kotlin-power-assert.git")
}
developers {
developer {
name.set("Brian Norman")
url.set("https://github.com/bnorm")
}
}
}
}
}
repositories {
if (
hasProperty("sonatypeUsername") &&
hasProperty("sonatypePassword") &&
hasProperty("sonatypeSnapshotUrl") &&
hasProperty("sonatypeReleaseUrl")
) {
maven {
val sonatypeUrlProperty = when {
version.toString().endsWith("-SNAPSHOT") -> "sonatypeSnapshotUrl"
else -> "sonatypeReleaseUrl"
}
setUrl(property(sonatypeUrlProperty) as String)
credentials {
username = property("sonatypeUsername") as String
password = property("sonatypePassword") as String
}
}
}
maven {
name = "test"
url = uri(rootProject.layout.buildDirectory.dir("localMaven"))
}
}
}