-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
126 lines (107 loc) · 3.89 KB
/
build.gradle.kts
File metadata and controls
126 lines (107 loc) · 3.89 KB
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
import org.jetbrains.dokka.gradle.*
group = "net.typedrest"
repositories.mavenCentral()
plugins {
kotlin("jvm") version "2.3.21"
kotlin("plugin.serialization") version "2.3.21" apply false
id("org.jetbrains.dokka") version "2.2.0"
id("org.jetbrains.dokka-javadoc") version "2.2.0"
id("maven-publish")
id("signing")
id("io.github.gradle-nexus.publish-plugin") version "2.0.0"
}
subprojects {
group = "net.typedrest"
version = System.getenv("VERSION") ?: "1.0-SNAPSHOT"
repositories.mavenCentral()
fun kotlin(module: String) = "org.jetbrains.kotlin.${module}"
apply(plugin = kotlin("jvm"))
apply(plugin = kotlin("plugin.serialization"))
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "org.jetbrains.dokka-javadoc")
apply(plugin = "maven-publish")
apply(plugin = "signing")
kotlin {
compilerOptions.allWarningsAsErrors = true
}
dokka {
dokkaSourceSets.configureEach {
// Package-level documentation
val mdFiles = fileTree("src/main") {
include("**/_doc.md")
}
mdFiles.files.forEach { mdFile ->
// Avoid duplicate file name conflicts
val relativePath = mdFile.relativeTo(project.file("src/main")).path.replace("/", "-").replace("\\", "-")
val uniqueFile = project.layout.buildDirectory.file("tmp/dokka-includes/$relativePath").get().asFile
uniqueFile.parentFile.mkdirs()
mdFile.copyTo(uniqueFile, overwrite = true)
includes.from(uniqueFile)
}
}
}
java {
withSourcesJar()
withJavadocJar()
}
tasks.named<Jar>("javadocJar") {
from(tasks.dokkaGeneratePublicationJavadoc.flatMap { it.outputDirectory })
}
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
from(components["java"])
pom {
name.set(project.name)
description.set(provider { project.description })
url.set("https://typedrest.net/")
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
}
}
developers {
developer {
name.set("Bastian Eicher")
url.set("https://github.com/bastianeicher")
}
}
scm {
connection.set("scm:git:https://github.com/TypedRest/TypedRest-Java.git")
developerConnection.set("scm:git:git@github.com:TypedRest/TypedRest-Java.git")
url.set("https://github.com/TypedRest/TypedRest-Java")
}
}
}
}
configure<SigningExtension> {
val gpgKey = System.getenv("GPG_KEY")
if (gpgKey != null) {
useInMemoryPgpKeys(gpgKey, "")
sign(the<PublishingExtension>().publications["maven"])
}
}
repositories {
maven {
name = "GitHub"
url = uri("https://maven.pkg.github.com/TypedRest/TypedRest-Java")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
dependencies {
subprojects.forEach { dokka(it) }
}
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://ossrh-staging-api.central.sonatype.com/service/local/"))
snapshotRepositoryUrl.set(uri("https://central.sonatype.com/repository/maven-snapshots/"))
}
}
}