forked from chsh/geohex4j
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbuild.sbt
73 lines (66 loc) · 2.22 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
import scala.language.postfixOps
val mainScalaVersion = "2.12.1"
lazy val npmPublish = taskKey[Unit]("Publish NPM package")
val jsModuleWrapper =
(
"""
|(function (global, factory) {
| if (typeof define === "function" && define.amd) {
| define(["exports"], factory);
| } else if (typeof exports !== "undefined") {
| factory(exports);
| } else {
| var mod = {
| exports: {}
| };
| factory(mod.exports);
| global.terahex = mod.exports;
| }
|})(this, function (exports) {
|
| var scalaExports = {};
| var __ScalaJSEnv = { exportsNamespace: scalaExports };
""".stripMargin,
"""
| var terahex = scalaExports.terahex();
| for (var key in terahex) { exports[key] = terahex[key] }
|});""".stripMargin)
lazy val root = project.in(file(".")).
aggregate(geohexJS, geohexJVM).
settings(
scalaVersion := mainScalaVersion,
crossScalaVersions := Seq(mainScalaVersion, "2.11.12"),
publish := {},
publishLocal := {}
)
lazy val geohex = crossProject.in(file(".")).
settings(
organization := "net.teralytics",
name := "geohex",
version := "0.1." + sys.env.getOrElse("TRAVIS_BUILD_NUMBER", "0-SNAPSHOT"),
scalaVersion := mainScalaVersion,
licenses +=("MIT", url("http://opensource.org/licenses/MIT"))
).
jvmSettings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.0.1" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test",
"io.spray" %% "spray-json" % "1.3.3" % "test",
"com.vividsolutions" % "jts" % "1.13" % "test",
"org.apache.spark" %% "spark-sql" % "2.4.5" % "provided"),
bintrayOrganization := Some("teralytics")
).
jsSettings(
scalaJSOutputWrapper := jsModuleWrapper,
npmPublish := {
"rm -rf npm-tar" #&&
"mkdir npm-tar" #&&
"npm install -g npm" #&&
s"npm version ${version.value} --no-git-tag-version --force" #&&
s"cp package.json README.md js/target/scala-${scalaBinaryVersion.value}/geohex-opt.js npm-tar" #&&
"tar -cf npm.tar npm-tar" #&&
"npm publish npm.tar" !
}
)
lazy val geohexJVM = geohex.jvm
lazy val geohexJS = geohex.js