This repository was archived by the owner on Jul 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle.kts
145 lines (124 loc) · 4.16 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
143
144
145
import org.jetbrains.dokka.Platform
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.net.URL
plugins {
id("org.jlleitschuh.gradle.ktlint") version "9.4.1"
id("org.jetbrains.dokka") version "1.4.10.2"
id("org.jetbrains.kotlin.jvm") version "1.4.10"
id("maven")
id("maven-publish")
id("signing")
}
group = "org.llvm4j"
version = "0.2.0-SNAPSHOT"
kotlin.explicitApi()
val isStaging = true
val isCI = System.getenv("CI") == "true"
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31")
testImplementation(platform("org.junit:junit-bom:5.7.0"))
testImplementation("org.jetbrains.kotlin:kotlin-test:1.4.31")
testImplementation("org.junit.jupiter:junit-jupiter")
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
}
}
dokkaHtml.configure {
outputDirectory.set(file("$buildDir/javadoc"))
moduleName.set("optional")
dokkaSourceSets.configureEach {
skipDeprecated.set(false)
includeNonPublic.set(false)
reportUndocumented.set(true)
skipEmptyPackages.set(true)
displayName.set("JVM")
platform.set(Platform.jvm)
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/llvm4j/optional/blob/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
jdkVersion.set(8)
noStdlibLink.set(false)
noJdkLink.set(false)
}
}
}
val sourcesJar by tasks.creating(Jar::class) {
archiveClassifier.set("sources")
from(sourceSets["main"].allSource)
}
val javadocJar by tasks.creating(Jar::class) {
group = JavaBasePlugin.DOCUMENTATION_GROUP
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
dependsOn(tasks.dokkaHtml)
}
publishing {
publications {
create<MavenPublication>("sonatype") {
from(components["kotlin"])
artifact(sourcesJar)
artifact(javadocJar)
repositories {
maven {
url = if (isStaging) {
uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
} else {
uri("https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/")
}
credentials {
username = System.getenv("DEPLOY_USERNAME")
password = System.getenv("DEPLOY_PASSWORD")
}
}
}
pom {
name.set("optional")
description.set("Optional<T> and Result<T, E> types for Kotlin")
url.set("https://github.com/llvm4j/optional")
licenses {
license {
name.set("LLVM Exception")
url.set("https://foundation.llvm.org/relicensing/LICENSE.txt")
}
}
developers {
developer {
id.set("supergrecko")
name.set("Mats Larsen")
email.set("me@supergrecko.com")
}
}
scm {
connection.set("scm:git:ssh://github.com/llvm4j/optional.git")
developerConnection.set("scm:git:ssh://git@github.com:llvm4j/optional.git")
url.set("https://github.com/llvm4j/optional")
}
}
}
signing {
signing {
if (isCI) {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
} else {
useGpgCmd()
}
sign(publishing.publications["sonatype"])
}
}
}
}