-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sbt
227 lines (188 loc) · 7.64 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
import sbt.Keys.libraryDependencies
import sbtcrossproject.{CrossType, crossProject}
enablePlugins(GitVersioning)
name := "potassium"
organization in ThisBuild := "com.lynbrookrobotics"
val potassiumVersion = "0.1.0"
val isRelease = sys.props.get("TRAVIS_TAG").isDefined
git.formattedShaVersion := git.gitHeadCommit.value map { sha =>
if (isRelease) potassiumVersion else s"$potassiumVersion-${sha.take(8)}"
}
scalaVersion in ThisBuild := "2.12.4"
resolvers in ThisBuild += "Funky-Repo" at "http://lynbrookrobotics.com/repo"
lazy val sharedDependencies = if (System.getenv("NATIVE_TARGET") == "ARM32") {
Def.setting(Seq(
"org.typelevel" %%% "squants" % "1.3.0"
))
} else {
Def.setting(Seq(
"org.typelevel" %%% "squants" % "1.3.0",
"org.scalatest" %%% "scalatest" % "3.1.0-SNAP6" % Test,
"org.scalacheck" %%% "scalacheck" % "1.13.5" % Test
))
}
lazy val jvmDependencies = Seq(
"org.mockito" % "mockito-core" % "2.3.11" % Test,
"com.storm-enroute" %% "scalameter-core" % "0.8.2" % Test
)
lazy val potassium = project.in(file(".")).
aggregate(
coreJVM, coreJS, coreNative,
controlJVM, controlJS, controlNative,
sensorsJVM, sensorsJS, sensorsNative,
commonsJVM, commonsJS, commonsNative,
modelJVM, modelNative,
frcJVM, frcNative,
remote,
visionJVM, visionNative,
configJVM,configJS, configNative,
lighting
).settings(
publish := {},
publishLocal := {}
)
addCommandAlias(
"testAll",
(potassium: ProjectDefinition[ProjectReference])
.aggregate
.map(p => s"${p.asInstanceOf[LocalProject].project}/test")
.mkString(";", ";", "")
)
lazy val nativeSettings = Def.settings(
scalaVersion := "2.11.12",
nativeLinkStubs in Test := true,
coverageExcludedPackages := ".*"
)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(CrossType.Full).settings(
name := "potassium-core",
libraryDependencies ++= sharedDependencies.value
).jvmSettings(libraryDependencies ++= jvmDependencies).jsSettings(
requiresDOM := true,
coverageEnabled := false
).nativeSettings(nativeSettings)
lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val coreNative = core.native
lazy val model = crossProject(JVMPlatform, NativePlatform).crossType(CrossType.Pure).dependsOn(core, commons).settings(
name := "potassium-model",
libraryDependencies ++= sharedDependencies.value
).nativeSettings(nativeSettings)
lazy val modelJVM = model.jvm
lazy val modelNative = model.native
lazy val control = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(CrossType.Pure).dependsOn(core).settings(
name := "potassium-control",
libraryDependencies ++= sharedDependencies.value
).nativeSettings(nativeSettings)
lazy val controlJVM = control.jvm
lazy val controlJS = control.js
lazy val controlNative = control.native
lazy val remote = project.dependsOn(coreJVM).settings(
name := "potassium-remote",
libraryDependencies ++= sharedDependencies.value,
libraryDependencies ++= jvmDependencies
)
lazy val vision = crossProject(JVMPlatform, NativePlatform).crossType(CrossType.Pure).dependsOn(core).settings(
name := "potassium-vision",
libraryDependencies ++= sharedDependencies.value
).jvmSettings(
libraryDependencies ++= jvmDependencies,
resolvers += "WPILib-Maven" at "http://team846.github.io/wpilib-maven",
libraryDependencies += "edu.wpi.first" % "ntcore" % wpiVersion
).nativeSettings(
if (System.getenv("NATIVE_TARGET") == "ARM32") {
Seq(
libraryDependencies += "com.lynbrookrobotics" %%% "wpilib-scala-native" % "0.1.2",
libraryDependencies += "com.lynbrookrobotics" %%% "ntcore-scala-native" % "0.1.2",
)
} else Seq(
resolvers += "WPILib-Maven" at "http://team846.github.io/wpilib-maven",
libraryDependencies += "edu.wpi.first" % "wpilib" % wpiVersion,
libraryDependencies += "edu.wpi.first" % "ntcore" % wpiVersion,
test := { (compile in Compile).value }
),
nativeSettings
)
lazy val visionJVM = vision.jvm
lazy val visionNative = vision.native
val wpiVersion = "2018.2.2"
val ctreVersion = "5.2.1.1"
lazy val frc = crossProject(JVMPlatform, NativePlatform).crossType(CrossType.Full).dependsOn(core, sensors, control).settings(
name := "potassium-frc",
libraryDependencies ++= sharedDependencies.value
).jvmSettings(
libraryDependencies ++= jvmDependencies,
resolvers += "WPILib-Maven" at "http://team846.github.io/wpilib-maven",
libraryDependencies += "edu.wpi.first" % "wpilib" % wpiVersion,
libraryDependencies += "edu.wpi.first" % "ntcore" % wpiVersion,
libraryDependencies += "com.ctre" % "phoenix" % ctreVersion
).nativeSettings(
if (System.getenv("NATIVE_TARGET") == "ARM32") {
Seq(
libraryDependencies += "com.lynbrookrobotics" %%% "wpilib-scala-native" % "0.1.2",
libraryDependencies += "com.lynbrookrobotics" %%% "ntcore-scala-native" % "0.1.2",
libraryDependencies += "com.lynbrookrobotics" %%% "phoenix-scala-native" % "0.1.2"
)
} else Seq(
resolvers += "WPILib-Maven" at "http://team846.github.io/wpilib-maven",
libraryDependencies += "edu.wpi.first" % "wpilib" % wpiVersion,
libraryDependencies += "edu.wpi.first" % "ntcore" % wpiVersion,
libraryDependencies += "com.ctre" % "phoenix" % ctreVersion,
test := { (compile in Compile).value }
),
nativeSettings
)
lazy val frcJVM = frc.jvm
lazy val frcNative = frc.native
lazy val config = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(CrossType.Pure).dependsOn(core).settings(
name := "potassium-config",
libraryDependencies ++= sharedDependencies.value,
libraryDependencies += "com.chuusai" %%% "shapeless" % "2.3.3",
libraryDependencies += "io.argonaut" %%% "argonaut" % "6.2.1",
libraryDependencies += "com.github.alexarchambault" %%% "argonaut-shapeless_6.2" % "1.2.0-M8",
libraryDependencies += "org.scala-lang" % "scala-reflect" % scalaVersion.value
).nativeSettings(nativeSettings)
lazy val configJVM = config.jvm
lazy val configJS = config.js
lazy val configNative = config.native
lazy val lighting = project.dependsOn(coreJVM).settings(
name := "potassium-lighting",
libraryDependencies ++= sharedDependencies.value,
libraryDependencies ++= jvmDependencies
)
lazy val sensors = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(CrossType.Pure).dependsOn(core).settings(
name := "potassium-sensors",
libraryDependencies ++= sharedDependencies.value
).nativeSettings(nativeSettings)
lazy val sensorsJVM = sensors.jvm
lazy val sensorsJS = sensors.js
lazy val sensorsNative = sensors.native
lazy val commons = crossProject(JSPlatform, JVMPlatform, NativePlatform).crossType(CrossType.Pure).
dependsOn(
control
).settings(
name := "potassium-commons",
libraryDependencies ++= sharedDependencies.value
).nativeSettings(nativeSettings)
lazy val commonsJVM = commons.jvm
lazy val commonsJS = commons.js
lazy val commonsNative = commons.native
lazy val benchmarks = project.dependsOn(
coreJVM, modelJVM, controlJVM, commonsJVM
)
lazy val docsMappingsAPIDir = settingKey[String]("Name of subdirectory in site target directory for api docs")
lazy val docs = project
.enablePlugins(ScalaUnidocPlugin)
.dependsOn(coreJVM, modelJVM, controlJVM,
remote, visionJVM, frcJVM, configJVM, sensorsJVM,
commonsJVM, lighting)
.settings(
autoAPIMappings := true,
docsMappingsAPIDir := "api",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), docsMappingsAPIDir),
unidocProjectFilter in (ScalaUnidoc, unidoc) :=
inProjects(coreJVM, modelJVM, controlJVM,
remote, visionJVM, frcJVM, configJVM, lighting, sensorsJVM, commonsJVM)
)
publishArtifact := false
publishMavenStyle := true
publishTo in ThisBuild := Some(Resolver.file("gh-pages-repo", baseDirectory.value / "repo"))