-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
158 lines (144 loc) · 4.54 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.gradle.DokkaTask
plugins {
kotlin("multiplatform")
id("maven-publish")
id("signing")
id("org.jetbrains.dokka")
}
kotlin {
jvm {
withJava()
mavenPublication {
artifactId = "graph-jvm"
}
}
js {
nodejs()
}
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
implementation(kotlin("reflect"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
val jsMain by getting {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
val jsTest by getting {
dependencies {
implementation(kotlin("test-js"))
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("stdlib"))
}
}
val jvmTest by getting {
dependencies {
implementation(kotlin("test-junit"))
}
}
}
}
dependencies {
dokkaHtmlPlugin("org.jetbrains.dokka:kotlin-as-java-plugin:1.7.10")
}
tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets.all {
sourceRoots.from(file("src/commonMain/kotlin"))
}
}
val dokkaJavadocCommonJar by tasks.register("dokkaJavadocCommonJar", Jar::class.java) {
archiveClassifier.set("javadoc")
from("$buildDir/dokka/html")
}
val dokkaJavadocJvmJar by tasks.register("dokkaJavadocJvmJar", Jar::class.java) {
archiveClassifier.set("javadoc")
from("$buildDir/dokka/html")
}
val dokkaJavadocJsJar by tasks.register("dokkaJavadocJsJar", Jar::class.java) {
archiveClassifier.set("javadoc")
from("$buildDir/dokka/html")
}
val POM_DESCRIPTION: String by project
val POM_NAME: String by project
val POM_URL: String by project
val POM_SCM_URL: String by project
val POM_SCM_CONNECTION: String by project
val POM_SCM_DEV_CONNECTION: String by project
val POM_LICENCE_NAME: String by project
val POM_LICENCE_URL: String by project
val POM_LICENCE_DIST: String by project
val POM_DEVELOPER_ID: String by project
val POM_DEVELOPER_NAME: String by project
val POM_DEVELOPER_EMAIL: String by project
val POM_DEVELOPER_ORGANIZATION: String by project
val POM_DEVELOPER_ORGANIZATION_URL: String by project
publishing {
publications {
withType<MavenPublication> {
pom {
description.set(POM_DESCRIPTION)
name.set(POM_NAME)
url.set(POM_URL)
scm {
url.set(POM_SCM_URL)
connection.set(POM_SCM_CONNECTION)
developerConnection.set(POM_SCM_DEV_CONNECTION)
}
licenses {
license {
name.set(POM_LICENCE_NAME)
url.set(POM_LICENCE_URL)
distribution.set(POM_LICENCE_DIST)
}
}
developers {
developer {
id.set(POM_DEVELOPER_ID)
name.set(POM_DEVELOPER_NAME)
email.set(POM_DEVELOPER_EMAIL)
organization.set(POM_DEVELOPER_ORGANIZATION)
organizationUrl.set(POM_DEVELOPER_ORGANIZATION_URL)
}
}
}
}
}
publications.getByName("js", MavenPublication::class) {
artifact(dokkaJavadocJsJar)
}
publications.getByName("jvm", MavenPublication::class) {
artifact(dokkaJavadocJvmJar)
}
publications.getByName("kotlinMultiplatform", MavenPublication::class) {
artifact(dokkaJavadocCommonJar)
}
repositories {
val releaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
val snapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots"
maven {
setUrl(if (!project.version.toString().contains("SNAPSHOT")) releaseUrl else snapshotUrl)
credentials {
username = System.getenv("SONATYPE_USERNAME") ?: ""
password = System.getenv("SONATYPE_PASSWORD") ?: ""
}
}
}
}
signing {
isRequired = false
sign(publishing.publications)
}
tasks.getByName("publish").dependsOn("assemble")
tasks.getByName("publishToMavenLocal").dependsOn("assemble")