-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle.kts
142 lines (127 loc) · 4.41 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 de.marcphilipp.gradle.nexus.NexusPublishPlugin
import org.jetbrains.dokka.Platform
import java.time.Duration
plugins {
kotlin("jvm") version "1.5.10"
id("com.github.ben-manes.versions") version "0.39.0"
id("io.codearte.nexus-staging") version "0.30.0"
id("de.marcphilipp.nexus-publish") version "0.4.0"
id("org.jetbrains.dokka") version "1.4.32"
signing
}
repositories {
mavenCentral()
jcenter()
}
val libVersion: String by project
val coroutinesVersion: String by project
val serializationVersion: String by project
val kluentVersion: String by project
val junitVersion: String by project
val sonatypeUsername: String? = System.getenv("sonatypeUsername")
val sonatypePassword: String? = System.getenv("sonatypePassword")
group = "com.apurebase"
version = libVersion
kotlin {
explicitApi()
}
dependencies {
implementation(kotlin("stdlib-common"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion")
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
testImplementation("org.amshove.kluent:kluent:$kluentVersion")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
}
tasks {
test {
useJUnitPlatform()
}
wrapper {
distributionType = Wrapper.DistributionType.ALL
}
closeRepository {
mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray())
}
closeAndReleaseRepository {
mustRunAfter(subprojects.map { it.tasks.getByName("publishToSonatype") }.toTypedArray())
}
dokkaHtml {
outputDirectory.set(buildDir.resolve("javadoc"))
dokkaSourceSets {
configureEach {
jdkVersion.set(8)
reportUndocumented.set(true)
platform.set(Platform.jvm)
}
}
}
}
apply<NexusPublishPlugin>()
nexusPublishing {
repositories { sonatype() }
clientTimeout.set(Duration.parse("PT10M"))
}
nexusStaging {
packageGroup = "com.apurebase"
username = sonatypeUsername
password = sonatypePassword
numberOfRetries = 360 // 1 hour if 10 seconds delay
delayBetweenRetriesInMillis = 10000 // 10 seconds
}
val sourcesJar by tasks.creating(Jar::class) {
classifier = "sources"
from(sourceSets.main.get().allSource)
}
val dokkaJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
classifier = "javadoc"
from(tasks.dokkaHtml)
}
publishing {
publications {
create<MavenPublication>("maven") {
artifactId = project.name
from(components["java"])
artifact(sourcesJar)
artifact(dokkaJar)
pom {
name.set("Deferred JSON Builder")
description.set("Deferred JSON Builder is a coroutine based pattern to split the fields and field value computation execution for generating JSON objects")
url.set("https://github.com/aPureBase/DeferredJsonBuilder")
organization {
name.set("aPureBase")
url.set("https://apurebase.com/")
}
licenses {
license {
name.set("MIT License")
url.set("https://github.com/aPureBase/DeferredJsonBuilder/blob/master/LICENSE")
}
}
developers {
developer {
id.set("jeggy")
name.set("Jógvan Olsen")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:https://github.com/aPureBase/DeferredJsonBuilder.git")
developerConnection.set("scm:git:https://github.com/aPureBase/DeferredJsonBuilder.git")
url.set("https://github.com/aPureBase/DeferredJsonBuilder/")
tag.set("HEAD")
}
}
}
}
}
signing {
isRequired = !version.toString().endsWith("SNAPSHOT")
useInMemoryPgpKeys(
System.getenv("ORG_GRADLE_PROJECT_signingKey"),
System.getenv("ORG_GRADLE_PROJECT_signingPassword")
)
sign(publishing.publications["maven"])
}