This repository has been archived by the owner on Jul 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.gradle.kts
158 lines (135 loc) · 4.83 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
146
147
148
149
150
151
152
153
154
155
156
157
158
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.31"
id("maven")
id("maven-publish")
id("signing")
}
group = "org.llvm4j"
version = "0.1.0-SNAPSHOT"
val isRelease = !version.toString().endsWith("-SNAPSHOT")
val isCI = System.getenv("CI") == "true"
kotlin.explicitApi()
repositories {
mavenCentral()
mavenLocal()
jcenter()
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
api("org.bytedeco:llvm-platform:11.1.0-1.5.6-SNAPSHOT")
api("org.llvm4j:optional:0.2.0-SNAPSHOT")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.31")
testImplementation("org.jetbrains.kotlin:kotlin-test:1.4.31")
testImplementation("org.junit.jupiter:junit-jupiter:5.7.0")
}
tasks {
withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
withType<Test>().configureEach {
useJUnitPlatform()
testLogging {
afterTest(
KotlinClosure2<TestDescriptor, TestResult, Unit>({ desc, result ->
val resultText = result.resultType.name.padEnd(7, ' ')
val timeText = (result.endTime - result.startTime).toString().padStart(4, '0')
println("$resultText | ($timeText ms) | ${desc.className} :: ${desc.name}")
})
)
}
}
dokkaHtml.configure {
outputDirectory.set(file("$buildDir/javadoc"))
moduleName.set("llvm4j")
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/llvm4j/blob/master/src/main/kotlin"))
remoteLineSuffix.set("#L")
}
jdkVersion.set(8)
noStdlibLink.set(false)
noJdkLink.set(false)
externalDocumentationLink {
url.set(URL("http://bytedeco.org/javacpp-presets/llvm/apidocs/"))
}
}
}
}
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 (isCI || !isRelease) {
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("llvm4j")
description.set("LLVM FFI bindings for the Java Platform")
url.set("https://github.com/llvm4j/llvm4j")
licenses {
license {
name.set("LLVM Exception, Version 2.0")
url.set("https://foundation.llvm.org/relicensing/LICENSE.txt")
}
}
developers {
developer {
id.set("supergrecko")
name.set("Mats Larsen")
email.set("[email protected]")
}
}
scm {
connection.set("scm:git:ssh://github.com/llvm4j/llvm4j.git")
developerConnection.set("scm:git:ssh://[email protected]:llvm4j/llvm4j.git")
url.set("https://github.com/llvm4j/llvm4j")
}
}
}
signing {
if (isCI) {
val signingKey: String? by project
val signingPassword: String? by project
useInMemoryPgpKeys(signingKey, signingPassword)
} else {
useGpgCmd()
}
sign(publishing.publications["sonatype"])
}
}
}