-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
149 lines (127 loc) · 4.5 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
import java.io.FileInputStream
import java.net.URL
import java.util.Properties
plugins {
alias(libs.plugins.kotlinMultiplatform).apply(false)
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.ktlint)
alias(libs.plugins.dokka)
id("maven-publish")
id("signing")
}
repositories {
mavenCentral()
}
java {
withSourcesJar()
withJavadocJar()
}
dependencies {
implementation(libs.kotlin.stdlib)
}
val versionProperties = Properties()
versionProperties.load(FileInputStream("$projectDir/version.properties"))
allprojects {
group = "com.atlassian.prosemirror"
version = versionProperties["projectVersion"] as String
}
subprojects {
apply(plugin = "maven-publish")
apply(plugin = "signing")
apply(plugin = "org.jetbrains.dokka") // TODO: use alias
val srcUrl = "https://github.com/atlassian-labs/prosemirror-kotlin/tree/main/${project.name}/"
afterEvaluate { // afterEvaluate so that project.ext values will be available
project.tasks.dokkaHtml {
dokkaSourceSets {
val commonMain by getting {
sourceLink {
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
localDirectory.set(file("src/commonMain/kotlin"))
// URL showing where the source code can be accessed through the web browser
remoteUrl.set(URL("${srcUrl}src/main/src/commonMain/kotlin"))
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#lines-")
}
}
val jvmMain by getting {
sourceLink {
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
localDirectory.set(file("src/jvmMain/kotlin"))
// URL showing where the source code can be accessed through the web browser
remoteUrl.set(URL("${srcUrl}src/main/src/jvmMain/kotlin"))
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#lines-")
}
}
val nativeMain by getting {
sourceLink {
// Unix based directory relative path to the root of the project (where you execute gradle respectively).
localDirectory.set(file("src/nativeMain/kotlin"))
// URL showing where the source code can be accessed through the web browser
remoteUrl.set(URL("${srcUrl}src/main/src/nativeMain/kotlin"))
// Suffix which is used to append the line number to the URL. Use #L for GitHub
remoteLineSuffix.set("#lines-")
}
}
}
}
publishing {
publications {
publications.withType<MavenPublication> {
pom {
name.set(project.name)
description.set(project.ext.get("pomDescription") as String)
url.set(srcUrl)
scm {
connection.set("[email protected]:atlassian-labs/prosemirror-kotlin.git")
url.set("https://github.com/atlassian-labs/prosemirror-kotlin.git")
}
developers {
developer {
id.set("dmarques")
name.set("Douglas Marques")
email.set("[email protected]")
}
developer {
id.set("achernykh")
name.set("Aleksei Chernykh")
email.set("[email protected]")
}
}
licenses {
license {
name.set("Apache License 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0")
distribution.set("repo")
}
}
}
}
}
repositories {
maven {
url = uri("https://packages.atlassian.com/maven-central")
credentials {
username = System.getenv("ARTIFACTORY_USERNAME")
password = System.getenv("ARTIFACTORY_API_KEY")
}
}
}
}
signing {
setRequired { System.getenv("SIGNING_KEY") == "" } // only sign if the key is available (usually on CI)
useInMemoryPgpKeys(
System.getenv("SIGNING_KEY"),
System.getenv("SIGNING_PASSWORD"),
)
sign(publishing.publications)
}
}
}
val javaVersion = JavaVersion.VERSION_17
tasks.withType<JavaCompile> {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
}