-
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathbuild.gradle.kts
210 lines (181 loc) · 6.12 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
import org.gradle.api.tasks.testing.logging.TestLogEvent.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import java.net.URL
plugins {
signing
`maven-publish`
id("shipshape")
idea
kotlin("multiplatform")
// kotlin("jupyter.api") version "0.11.0-225"
id("com.xcporter.metaview") version "0.0.6"
id("org.jetbrains.dokka")
}
// Stub secrets to let the project sync and build without the publication values set up
ext["signing.keyId"] = null
ext["signing.password"] = null
ext["signing.secretKeyRingFile"] = null
ext["ossrhUsername"] = null
ext["ossrhPassword"] = null
val keyId = providers.gradleProperty("signing.gnupg.keyId")
val password = providers.gradleProperty("signing.gnupg.password")
val secretKey = providers.gradleProperty("signing.gnupg.key")
val sonatypeApiUser = providers.gradleProperty("sonatypeApiUser")
val sonatypeApiKey = providers.gradleProperty("sonatypeApiKey")
if (keyId.isPresent && password.isPresent && secretKey.isPresent) {
ext["signing.keyId"] = keyId
ext["signing.password"] = password
ext["signing.key"] = secretKey
ext["ossrhUsername"] = sonatypeApiUser
ext["ossrhPassword"] = sonatypeApiKey
}
val generatedSourcesPath = file("src/commonMain/gen")
shipshape {
maxVal = 12
generatePseudoConstructors = true
outputDir = "${generatedSourcesPath.path}/ai/hypergraph/kotlingrad"
}
idea.module { generatedSourceDirs.add(generatedSourcesPath) }
generateUml {
projectDir.resolve("src/commonMain/kotlin/ai/hypergraph/kotlingrad/api/")
.listFiles()!!.forEach {
classTree {
target = it
outputFile = it.nameWithoutExtension + ".md"
}
}
}
tasks.withType<KotlinCompile> { dependsOn("genShapes") }
kotlin {
jvm {
tasks {
// processJupyterApiResources {
// libraryProducers = listOf("ai.hypergraph.kotlingrad.notebook.Integration")
// }
named<Test>("jvmTest") {
minHeapSize = "1024m"
maxHeapSize = "4096m"
useJUnitPlatform()
testLogging {
events = setOf(
FAILED,
PASSED,
SKIPPED,
STANDARD_OUT
)
exceptionFormat = FULL
showExceptions = true
showCauses = true
showStackTraces = true
showStandardStreams = true
}
}
}
val keyId = providers.gradleProperty("signing.gnupg.keyId")
val password = providers.gradleProperty("signing.gnupg.password")
val secretKey = providers.gradleProperty("signing.gnupg.key")
// fun getExtraString(name: String) = ext(name).toString()
signing {
useGpgCmd()
if (keyId.isPresent && password.isPresent) {
useInMemoryPgpKeys(keyId.get(), secretKey.get(), password.get())
sign(publishing.publications)
} else {
logger.info("PGP signing key not defined, skipping signing configuration")
}
}
val javadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") }
/*
* Publishing instructions:
*
* (1) ./gradlew publishAllPublicationsToSonatypeRepository
* (2) Visit https://s01.oss.sonatype.org/index.html#stagingRepositories
* (3) Close and check content tab.
* (4) Release.
*
* Adapted from: https://dev.to/kotlin/how-to-build-and-publish-a-kotlin-multiplatform-library-going-public-4a8k
*/
publishing.publications.withType<MavenPublication> {
artifact(javadocJar.get())
pom {
name.set("Kotlin∇")
description.set("Differentiable Functional Programming with Algebraic Data Types")
url.set("https://github.com/breandan/kotlingrad")
licenses {
license {
name.set("The Apache Software License, Version 1.0")
url.set("http://www.apache.org/licenses/LICENSE-3.0.txt")
distribution.set("repo")
}
}
developers {
developer {
id.set("Breandan Considine")
name.set("Breandan Considine")
email.set("bre@ndan.co")
organization.set("Université de Montréal")
}
}
scm {
url.set("https://github.com/breandan/kotlingrad")
}
}
}
}
sourceSets {
val commonMain by getting {
// TODO: Maybe move this into the plugin somehow?
kotlin.srcDir(generatedSourcesPath)
dependencies {
implementation(kotlin("stdlib-common"))
implementation(kotlin("reflect:2.1.0"))
api("ai.hypergraph:kaliningraph:0.2.1")
}
}
val jvmMain by getting {
dependencies {
implementation(kotlin("bom"))
implementation(kotlin("stdlib"))
implementation("org.graalvm.js:js:24.1.1")
implementation("guru.nidi:graphviz-kotlin:0.18.1")
implementation(kotlin("reflect:2.1.0"))
}
}
val jvmTest by getting {
dependencies {
implementation("org.jetbrains.bio:viktor:1.2.0")
// Property-based testing
val ejmlVersion = "0.43.1"
implementation("org.ejml:ejml-kotlin:$ejmlVersion")
implementation("org.ejml:ejml-all:$ejmlVersion")
val kotestVersion = "5.9.1"
implementation("io.kotest:kotest-runner-junit5:$kotestVersion")
implementation("io.kotest:kotest-assertions-core:$kotestVersion")
implementation("io.kotest:kotest-property:$kotestVersion")
implementation("org.junit.jupiter:junit-jupiter:5.9.1")
// Symbolic fuzzing interpreter
implementation(kotlin("scripting-jsr223"))
// implementation("com.github.tschuchortdev:kotlin-compile-testing:1.4.9")
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
}
}
tasks.withType<DokkaTaskPartial> {
dokkaSourceSets.configureEach {
jdkVersion = 17
sourceLink {
localDirectory = projectDir.resolve("src")
remoteUrl = URL("https://github.com/breandan/kotlingrad/tree/master/core/src")
remoteLineSuffix = "#L"
}
}
}