forked from neeffect/kure-potlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
142 lines (119 loc) · 4.08 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
134
135
136
137
138
139
140
141
142
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
`maven-publish`
kotlin("jvm") version "1.4.31"
signing
id("org.jetbrains.dokka") version "0.10.1"
}
repositories {
mavenCentral()
jcenter()
}
val componentVersion = "0.5.0"
val spekVersion = "2.0.15"
val detektVersion = "1.16.0"
dependencies {
compileOnly("io.gitlab.arturbosch.detekt:detekt-api:$detektVersion")
compileOnly("io.gitlab.arturbosch.detekt:detekt-psi-utils:$detektVersion")
implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.31")
testImplementation("io.gitlab.arturbosch.detekt:detekt-api:$detektVersion")
testImplementation("io.gitlab.arturbosch.detekt:detekt-test:$detektVersion")
testImplementation("org.assertj:assertj-core:3.19.0")
testImplementation("org.spekframework.spek2:spek-dsl-jvm:$spekVersion")
testRuntimeOnly("org.spekframework.spek2:spek-runner-junit5:$spekVersion")
}
tasks.withType<Test> {
useJUnitPlatform {
includeEngines("spek2")
}
}
publishing {
publications {
create<MavenPublication>("maven") {
groupId = "pl.setblack"
artifactId = "kure-potlin"
version = componentVersion
from(components["java"])
}
}
}
val ossrhUsername: String? by project
val ossrhPassword: String? by project
val signingKey: String? by project
val signingPassword: String? by project
val isRelease = !componentVersion.endsWith("-SNAPSHOT")
val publications: PublicationContainer = (extensions.getByName("publishing") as PublishingExtension).publications
signing {
if (signingKey != null && signingPassword != null) {
@Suppress("UnstableApiUsage")
useInMemoryPgpKeys(signingKey, signingPassword)
}
useGpgCmd()
sign(publications)
}
val dokka = tasks.named("dokka")
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
description = "Assembles Kotlin docs with Dokka"
archiveClassifier.set("javadoc")
from(dokka)
}
val compileKotlin: KotlinCompile by tasks
compileKotlin.kotlinOptions.apply {
jvmTarget = "1.8"
javaParameters = true
allWarningsAsErrors = true
}
publishing {
repositories {
maven {
val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/")
name = "deploy"
println("isRelease: $isRelease")
url = if (isRelease) releasesRepoUrl else snapshotsRepoUrl
credentials {
username = System.getenv("OSSRH_USERNAME") ?: ossrhUsername
password = System.getenv("OSSRH_PASSWORD") ?: ossrhPassword
}
}
}
publications.forEach {
println("publication $it")
}
publications.withType<MavenPublication>().forEach {
it.apply {
if (isRelease) {
artifact(tasks["dokkaJar"])
}
artifact(tasks["kotlinSourcesJar"])
pom {
name.set("kure-potlin")
description.set("kure-potlin")
url.set("https://github.com/neeffect/kure-potlin")
scm {
connection.set("scm:git:https://github.com/neeffect/kure-potlin.git")
developerConnection.set("scm:git:http://github.com/jarekratajski/")
url.set("https://github.com/neeffect/kure-potlin")
}
licenses {
license {
name.set("Apache-2.0")
url.set("https://opensource.org/licenses/Apache-2.0")
}
}
developers {
developer {
id.set("jarekratajski")
name.set("Jarek Ratajski")
email.set("jratajski@gmail.com")
}
}
}
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}