Skip to content

Commit 73e840e

Browse files
committed
gradlify jupyter build, default to mavenLocal
1 parent 063d187 commit 73e840e

File tree

5 files changed

+684
-641
lines changed

5 files changed

+684
-641
lines changed

build.gradle.kts

+16-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ plugins {
55
kotlin("jvm") version "1.4.0"
66
}
77

8-
group = "edu.mcgill"
9-
version = "0.1.0"
8+
group = "com.github.breandan"
9+
version = "0.1.1"
1010

1111
repositories {
1212
mavenCentral()
@@ -82,13 +82,26 @@ tasks {
8282

8383
val installPathLocal = "${System.getProperty("user.home")}/.jupyter_kotlin/libraries"
8484

85-
register<Copy>("jupyterInstall") {
85+
val genNotebookJSON by creating(JavaExec::class) {
86+
main = "edu.mcgill.kaliningraph.codegen.NotebookGenKt"
87+
classpath = sourceSets["main"].runtimeClasspath
88+
args = listOf(projectDir.path, project.version.toString())
89+
}
90+
91+
val jupyterInstall by registering(Copy::class) {
92+
dependsOn(genNotebookJSON)
93+
dependsOn("publishToMavenLocal")
8694
val installPath = findProperty("ath") ?: installPathLocal
8795
doFirst { mkdir(installPath) }
8896
from(file("kaliningraph.json"))
8997
into(installPath)
9098
doLast { logger.info("Kaliningraph notebook support was installed in: $installPath") }
9199
}
100+
101+
val jupyterRun by creating(Exec::class) {
102+
dependsOn(jupyterInstall)
103+
commandLine("jupyter", "notebook", "--notebook-dir=notebooks")
104+
}
92105
}
93106

94107
val fatJar by tasks.creating(Jar::class) {
@@ -106,7 +119,6 @@ publishing {
106119
publications.create<MavenPublication>("default") {
107120
artifact(fatJar)
108121
pom {
109-
name.set("Kaliningraph")
110122
url.set("https://github.com/breandan/kaliningraph")
111123
licenses {
112124
license {

kaliningraph.json

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
{
2-
"properties": {
3-
"kaliningraphVersion": "0.1.0"
4-
},
52
"link": "https://github.com/breandan/kaliningraph",
63
"repositories": [
4+
"*mavenLocal",
75
"https://jitpack.io"
86
],
97
"dependencies": [
10-
"com.github.breandan:kaliningraph:$kaliningraphVersion"
8+
"com.github.breandan:kaliningraph:0.1.1"
119
],
1210
"imports": [
1311
"edu.mcgill.kaliningraph.*",
@@ -20,6 +18,6 @@
2018
"edu.mcgill.kaliningraph.circuits.Gate": "HTML(($it as edu.mcgill.kaliningraph.circuits.Gate).graph.html())",
2119
"edu.mcgill.kaliningraph.circuits.NFunction": "HTML(($it as edu.mcgill.kaliningraph.circuits.NFunction).graph.html())",
2220
"edu.mcgill.kaliningraph.circuits.ComputationGraph": "HTML(($it as edu.mcgill.kaliningraph.Graph<*, *, *>).html())",
23-
"org.ejml.data.DMatrixSparseCSC": "HTML(\"<img src=\\\"${($it as org.ejml.data.DMatrixSparseCSC).adjToMat()}\\\"/>\")"
21+
"org.ejml.data.DMatrixSparseCSC": "HTML(\"<img src=\\\"${($it as org.ejml.data.DMatrixSparseCSC).matToImg()}\\\"/>\")"
2422
}
25-
}
23+
}

0 commit comments

Comments
 (0)