-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathbuild.sbt
230 lines (216 loc) · 7.58 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
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
import sbt._
import java.io.File
import Dependencies._
import sbtbuildinfo.BuildInfoPlugin.autoImport._
import org.scoverage.coveralls.Imports.CoverallsKeys._
val mainVersion = "v2.0-SNAPSHOT"
maintainer := "Mandar Chandorkar <mandar2812@gmail.com>"
packageSummary := "Scala Library/REPL for Machine Learning Research"
packageDescription := "DynaML is a Scala & JVM Machine Learning toolbox for research, education & industry."
val heapSize = Option(System.getProperty("heap")).getOrElse("4096m")
val dataDirectory = settingKey[File](
"The directory holding the data files for running example scripts"
)
val scriptsDir = settingKey[File](
"The directory holding the example scripts"
)
val baseSettings = Seq(
organization := "io.github.tailhq",
scalaVersion in ThisBuild := scala,
//crossScalaVersions in ThisBuild := crossScala,
resolvers in ThisBuild ++= Seq(
"jzy3d-releases" at "https://maven.jzy3d.org/releases",
"Scalaz Bintray Repo" at "https://dl.bintray.com/scalaz/releases",
"BeDataDriven" at "https://nexus.bedatadriven.com/content/groups/public",
Resolver.sonatypeRepo("public"),
Resolver.sonatypeRepo("snapshots"),
Resolver.typesafeIvyRepo("releases"),
Resolver.bintrayRepo("cibotech", "public"),
"jitpack" at "https://jitpack.io"
),
publishTo := sonatypePublishTo.value,
useGpg := true,
publishConfiguration := publishConfiguration.value.withOverwrite(true),
publishLocalConfiguration := publishLocalConfiguration.value
.withOverwrite(true),
coverallsTokenFile := Some(".coveralls.yml"),
autoAPIMappings := true
)
lazy val pipes = (project in file("dynaml-pipes"))
.settings(baseSettings: _*)
.settings(libraryDependencies ++= pipesDependencies)
.enablePlugins(BuildInfoPlugin)
.settings(
name := "dynaml-pipes",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml.pipes",
buildInfoUsePackageAsPath := true,
version := mainVersion
)
lazy val core = (project in file("dynaml-core"))
.settings(baseSettings: _*)
.dependsOn(pipes)
.settings(libraryDependencies ++= coreDependencies)
.enablePlugins(JavaAppPackaging, BuildInfoPlugin)
.settings(
name := "dynaml-core",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml",
buildInfoUsePackageAsPath := true,
version := mainVersion
)
lazy val examples = (project in file("dynaml-examples"))
.settings(baseSettings: _*)
.dependsOn(pipes, core)
.enablePlugins(BuildInfoPlugin)
.settings(
name := "dynaml-examples",
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml.examples",
buildInfoUsePackageAsPath := true,
version := mainVersion
)
lazy val repl = (project in file("dynaml-repl"))
.enablePlugins(BuildInfoPlugin)
.settings(baseSettings: _*)
.settings(
name := "dynaml-repl",
version := mainVersion,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml.repl",
buildInfoUsePackageAsPath := true,
libraryDependencies ++= replDependencies
)
lazy val tensorflow = (project in file("dynaml-tensorflow"))
.enablePlugins(BuildInfoPlugin)
.settings(baseSettings: _*)
.dependsOn(core, pipes)
.settings(
name := "dynaml-tensorflow",
version := mainVersion,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml.tensorflow",
buildInfoUsePackageAsPath := true,
libraryDependencies ++= tensorflowDependency
.map(_.excludeAll(excludeSlf4jBindings: _*))
)
lazy val notebook = (project in file("dynaml-notebook"))
.enablePlugins(BuildInfoPlugin)
.settings(baseSettings: _*)
.dependsOn(core, examples, pipes, tensorflow)
.settings(
name := "dynaml-notebook",
version := mainVersion,
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq.dynaml.jupyter",
buildInfoUsePackageAsPath := true,
libraryDependencies ++= notebookDepencencies
.map(_.excludeAll(excludeSlf4jBindings: _*))
)
lazy val DynaML = (project in file("."))
.enablePlugins(
JavaAppPackaging,
UniversalPlugin,
BuildInfoPlugin,
sbtdocker.DockerPlugin,
ScalaUnidocPlugin,
JavaUnidocPlugin
)
.settings(baseSettings: _*)
.dependsOn(core, examples, pipes, tensorflow, repl)
.settings(
libraryDependencies ++= dynaServeDependencies,
name := "DynaML",
version := mainVersion,
fork in run := true,
fork in test := true,
mainClass in Compile := Some("io.github.tailhq.dynaml.DynaML"),
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion),
buildInfoPackage := "io.github.tailhq",
buildInfoUsePackageAsPath := true,
dataDirectory := new File("data"),
mappings in Universal ++= dataDirectory.value
.listFiles()
.toSeq
.map(p => p -> s"data/${p.getName}"),
scriptsDir := new File("scripts"),
mappings in Universal ++= scriptsDir.value
.listFiles()
.toSeq
.map(p => p -> s"scripts/${p.getName}"),
mappings in Universal ++= Seq(
{
//Initialization script for the DynaML REPL
val init = (resourceDirectory in Compile).value / "DynaMLInit.scala"
init -> "conf/DynaMLInit.scala"
}, {
val banner = (resourceDirectory in Compile).value / "dynamlBanner.txt"
banner -> "conf/banner.txt"
}
),
javaOptions in test ++= Seq(
"-Dlog4j.debug=true",
"-Dlog4j.configuration=log4j.properties"
),
javaOptions in Universal ++= Seq(
// -J params will be added as jvm parameters
s"-J-Xmx$heapSize",
"-J-Xms64m",
"-J-XX:HeapBaseMinAddress=32G"
),
scalacOptions in Universal ++= Seq("-Xlog-implicits"),
initialCommands in console := """io.github.tailhq.dynaml.DynaML.main(Array())""",
dockerfile in docker := {
val appDir: File = stage.value
val targetDir = "/app"
new Dockerfile {
from("openjdk:8-jre")
entryPoint(s"$targetDir/bin/${executableScriptName.value}")
copy(appDir, targetDir, chown = "daemon:daemon")
}
},
imageNames in docker := Seq(
// Sets the latest tag
ImageName(s"tailhq/${name.value.toLowerCase}:latest"),
// Sets a name with a tag that contains the project version
ImageName(
namespace = Some("tailhq"),
repository = name.value.toLowerCase,
tag = Some(version.value)
)
)
)
.aggregate(core, pipes, examples, repl, tensorflow, notebook)
.settings(aggregate in publishM2 := true, aggregate in update := false)
lazy val docs = project
.in(file("dynaml-docs")) // important: it must not be docs/
.dependsOn(DynaML)
.enablePlugins(
MdocPlugin,
DocusaurusPlugin,
ScalaUnidocPlugin,
JavaUnidocPlugin
)
.settings(
mdocVariables := Map(
"VERSION" -> version.value
),
moduleName := "dynaml-docs",
unidocProjectFilter in (ScalaUnidoc, unidoc) := inProjects(
DynaML,
core,
pipes,
examples,
notebook,
tensorflow,
repl
),
target in (ScalaUnidoc, unidoc) := (baseDirectory in LocalRootProject).value / "website" / "static" / "api",
cleanFiles += (target in (ScalaUnidoc, unidoc)).value,
docusaurusCreateSite := docusaurusCreateSite
.dependsOn(unidoc in Compile)
.value,
docusaurusPublishGhpages := docusaurusPublishGhpages
.dependsOn(unidoc in Compile)
.value
)