-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
131 lines (107 loc) · 4.35 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
plugins {
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.dokka) apply false
alias(libs.plugins.publish) apply false
signing
}
allprojects {
version = "1.4.1-SNAPSHOT"
group = "com.github.rnett.krosstalk"
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots"){
mavenContent{ snapshotsOnly() }
}
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven")
}
val isRoot = this == rootProject
val generateDocs = parent != rootProject || isRoot
val willPublish = childProjects.isEmpty()
if (generateDocs)
apply(plugin = "org.jetbrains.dokka")
if (willPublish)
afterEvaluate {
apply(plugin = "org.gradle.maven-publish")
val project = this
apply(plugin = "com.vanniktech.maven.publish")
extensions.getByType<com.vanniktech.maven.publish.MavenPublishBaseExtension>().apply {
if (!version.toString().toLowerCase().endsWith("snapshot")) {
val stagingProfileId = project.findProperty("sonatypeRepositoryId")?.toString()
publishToMavenCentral(com.vanniktech.maven.publish.SonatypeHost.DEFAULT, stagingProfileId)
}
pom {
name.set(project.niceModuleName)
description.set(project.description ?: "Krosstalk module")
inceptionYear.set("2021")
url.set("https://github.com/rnett/krosstalk/")
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
}
}
scm {
url.set("https://github.com/rnett/krosstalk.git")
connection.set("scm:git:git://github.com/rnett/krosstalk.git")
developerConnection.set("scm:git:ssh://git@github.com/rnett/krosstalk.git")
}
developers {
developer {
id.set("rnett")
name.set("Ryan Nett")
url.set("https://github.com/rnett/")
}
}
}
}
}
afterEvaluate {
val project = this
if (this.parent?.name != "compiler") {
try {
extensions.configure<org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension> {
explicitApi()
}
} catch (e: UnknownDomainObjectException) {
}
}
if (generateDocs) {
val docs = preprocessDocs("README.md")
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaLeafTask>() {
moduleName.set(niceModuleName)
moduleVersion.set(version.toString())
dokkaSourceSets.configureEach {
if (!isRoot && "compiler" !in project.path) {
includes.from(docs)
}
includeNonPublic.set(false)
suppressObviousFunctions.set(true)
suppressInheritedMembers.set(true)
skipDeprecated.set(true)
skipEmptyPackages.set(true)
jdkVersion.set(8)
val sourceSet = this.sourceSetID.sourceSetName
val localDir = file("src/$sourceSet/kotlin")
if(localDir.exists()) {
sourceLink {
localDirectory.set(localDir)
remoteUrl.set(java.net.URL("$githubRoot/src/$sourceSet/kotlin"))
remoteLineSuffix.set("#L")
}
}
}
}
}
}
}
val header = "Krosstalk: A pure Kotlin pluggable RPC library"
tasks.create<Copy>("generateReadme"){
from("README.md")
into(buildDir)
filter{
it.replace("# $header",
"# [$header](https://github.com/rnett/krosstalk)")
}
}