-
Notifications
You must be signed in to change notification settings - Fork 15
/
build.sbt
168 lines (143 loc) · 4.95 KB
/
build.sbt
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
import scala.io._
logLevel := Level.Debug
// credit to http://stackoverflow.com/a/32114551/2990673
lazy val mathFormulaInDoc = taskKey[Unit]("add MathJax script import in scaladoc html to display LaTeX formula")
lazy val commonSettings = Seq(
organization := "me.tongfei",
version := "0.1.0-SNAPSHOT",
isSnapshot := true,
scalaVersion := "2.12.8",
libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3",
"org.typelevel" %% "cats-core" % "1.6.0",
"org.typelevel" %% "algebra" % "1.0.0",
"com.lihaoyi" %% "sourcecode" % "0.1.5"
),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4" % Test,
libraryDependencies += "me.tongfei" %% "poly-io" % "0.3.2" % Test
)
lazy val tensor = (project in file("tensor"))
.settings(commonSettings: _*)
.settings(
name := "nexus-tensor"
)
lazy val diff = (project in file("diff"))
.settings(commonSettings: _*)
.dependsOn(tensor)
.settings(
name := "nexus-diff"
)
lazy val prob = (project in file("prob"))
.settings(commonSettings: _*)
.dependsOn(diff)
.settings(
name := "nexus-prob"
)
// this is a small, pure Java library
lazy val jniLoader = (project in file("jni-loader"))
.settings(commonSettings: _*)
.settings(
name := "nexus-jni-loader",
crossPaths := false,
autoScalaLibrary := false
)
lazy val testBase = (project in file("test-base"))
.settings(commonSettings: _*)
.dependsOn(diff).dependsOn(prob)
.settings(
name := "nexus-test-base",
publishArtifact := false,
libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.4"
)
lazy val ml = (project in file("ml"))
.settings(commonSettings: _*)
.dependsOn(diff)
.settings(
name := "nexus-ml"
)
lazy val tensorboard = (project in file("interop/tensorboard"))
.settings(commonSettings: _*)
.dependsOn(diff)
.settings(
name := "nexus-interop-tensorboard"
)
lazy val jvmRefMacros = (project in file("jvm-ref/macros"))
.settings(commonSettings: _*)
.settings(
name := "nexus-jvm-ref-macros"
)
lazy val jvmRefBackend = (project in file("jvm-ref/backend"))
.settings(commonSettings: _*)
.dependsOn(diff).dependsOn(jvmRefMacros)
.settings(
name := "nexus-jvm-ref-backend"
)
lazy val torchJni = (project in file("torch/jni"))
.settings(commonSettings: _*)
.dependsOn(jniLoader)
.settings(
name := "nexus-torch-backend-jni"
)
lazy val torchMacros = (project in file("torch/macros"))
.settings(commonSettings: _*)
.settings(
name := "nexus-torch-backend-macros"
)
lazy val torchCpu = (project in file("torch/cpu"))
.settings(commonSettings: _*)
.dependsOn(tensor).dependsOn(torchJni).dependsOn(torchMacros)
.settings(
name := "nexus-torch-backend-cpu"
)
lazy val torchCuda = (project in file("torch/cuda"))
.settings(commonSettings: _*)
.dependsOn(tensor).dependsOn(torchCpu)
.settings(
name := "nexus-torch-backend-cuda"
)
val root: Project = (project in file("."))
.settings(commonSettings: _*)
.enablePlugins(ScalaUnidocPlugin)
.settings(
name := "nexus",
unidocProjectFilter in (ScalaUnidoc, unidoc) :=
inAnyProject -- inProjects(testBase)
-- inProjects(jvmRefMacros) -- inProjects(jvmRefBackend) -- inProjects(jniLoader)
-- inProjects(torchJni) -- inProjects(torchMacros) -- inProjects(torchCpu) -- inProjects(torchCuda)
// unidoc := (unidoc andFinally Def.taskDyn {
// val apiDir: java.io.File = new java.io.File(s"${crossTarget.value}/unidoc")
// val docDir = apiDir // /"some"/"subfolder" // in my case, only api/some/solder is parsed
// // will replace this "importTag" by "scriptLine
// // find all html file and apply patch
// if(docDir.isDirectory)
// for (f <- listHtmlFile(docDir)) {
// val content = Source.fromFile(f).getLines().mkString("\n")
// val writer = new java.io.PrintWriter(f)
// writer.write(content.replace(
// "<head>",
// """<head>
// | <script type="text/x-mathjax-config">
// | MathJax.Hub.Config({
// | tex2jax: {
// | inlineMath: [ ['$','$'], ["\\(","\\)"] ],
// | displayMath: [ ['$$','$$'], ["\\[","\\]"] ]
// | }
// | });
// | </script>
// | <script type="text/javascript" async
// | src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML">
// | </script>""".stripMargin))
// writer.close()
// println(s"MathJax injected to $f.")
// }
// }).value
)
.aggregate(tensor, diff) // other libraries yet to be added
// function that find html files recursively
def listHtmlFile(dir: java.io.File): List[java.io.File] = {
dir.listFiles.toList.flatMap { f =>
if(f.getName.endsWith(".html")) List(f)
else if(f.isDirectory) listHtmlFile(f)
else List[File]()
}
}