-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
137 lines (116 loc) · 4.25 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
import org.gradle.jvm.tasks.Jar
import java.net.URL
plugins {
kotlin("jvm") version "1.8.10"
`maven-publish`
signing
id("io.github.gradle-nexus.publish-plugin") version "1.1.0"
// we can not switch to 3.x.x because we want to keep it compatible with JVM 8
id("net.nemerosa.versioning") version "2.15.1"
id("org.jetbrains.dokka") version "1.7.20"
id("io.gitlab.arturbosch.detekt") version "1.21.0"
}
group = "dev.forst"
base.archivesName.set("exposed-upsert")
version = (versioning.info?.tag ?: versioning.info?.lastTag ?: versioning.info?.build) ?: "SNAPSHOT"
version = (versioning.info?.tag ?: versioning.info?.lastTag ?: versioning.info?.build) ?: "SNAPSHOT"
repositories {
mavenCentral()
}
dependencies {
detektPlugins("io.gitlab.arturbosch.detekt:detekt-formatting:1.21.0")
compileOnly(kotlin("reflect"))
compileOnly(kotlin("stdlib-jdk8"))
compileOnly("org.jetbrains.exposed:exposed-core:0.41.1")
}
detekt {
parallel = true
source = files("$rootDir/src")
config = files(rootDir.resolve("detekt-config.yml"))
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "1.8"
}
test {
useJUnitPlatform()
}
dokkaHtml {
outputDirectory.set(File("$buildDir/docs"))
dokkaSourceSets {
configureEach {
displayName.set("Exposed Upsert")
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/LukasForst/exposed-upsert/tree/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
}
}
// ------------------------------------ Deployment Configuration ------------------------------------
// deployment configuration - deploy with sources and documentation
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets.main.get().allSource)
}
val javadocJar by tasks.creating(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.javadoc)
}
// name the publication as it is referenced
val publication = "mavenJava"
publishing {
// create jar with sources and with javadoc
publications {
create<MavenPublication>(publication) {
from(components["java"])
artifact(sourcesJar)
artifact(javadocJar)
pom {
name.set("exposed-upsert")
description.set("Simple upsert implementation for Exposed and PostgreSQL.")
url.set("https://exposed.forst.dev")
packaging = "jar"
licenses {
license {
name.set("MIT")
url.set("https://github.com/LukasForst/exposed-upsert/blob/master/LICENSE")
}
}
developers {
developer {
id.set("lukasforst")
name.set("Lukas Forst")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:git://github.com/LukasForst/exposed-upsert.git")
url.set("https://github.com/LukasForst/exposed-upsert")
}
}
}
}
}
signing {
val signingKeyId = project.findProperty("gpg.keyId") as String? ?: System.getenv("GPG_KEY_ID")
val signingKey = project.findProperty("gpg.key") as String? ?: System.getenv("GPG_KEY")
val signingPassword = project.findProperty("gpg.keyPassword") as String? ?: System.getenv("GPG_KEY_PASSWORD")
useInMemoryPgpKeys(signingKeyId, signingKey, signingPassword)
sign(publishing.publications[publication])
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
username.set(project.findProperty("ossrh.username") as String? ?: System.getenv("OSSRH_USERNAME"))
password.set(project.findProperty("ossrh.password") as String? ?: System.getenv("OSSRH_PASSWORD"))
}
}
}