-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
71 lines (64 loc) · 2.55 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
import Wart._
enablePlugins(ScalaJSPlugin)
ThisBuild / scalaVersion := "2.13.13"
ThisBuild / version := "0.1.0-SNAPSHOT"
ThisBuild / organization := "io.lptk"
ThisBuild / organizationName := "LPTK"
ThisBuild / scalacOptions ++= Seq(
"-deprecation",
"-feature",
"-unchecked",
"-language:higherKinds",
if (insideCI.value) "-Wconf:any:error"
else "-Wconf:any:warning",
)
lazy val root = project.in(file("."))
.aggregate(mlscriptJVM, npmBuildJS)
.settings(
publish := {},
publishLocal := {},
)
lazy val mlscript = crossProject(JSPlatform, JVMPlatform).in(file("."))
.settings(
name := "mlscript",
scalacOptions ++= Seq(
"-Ywarn-value-discard",
"-Ypatmat-exhaust-depth:160",
),
wartremoverWarnings ++= Warts.allBut(
Recursion, Throw, Nothing, Return, While, IsInstanceOf,
Var, MutableDataStructures, NonUnitStatements,
DefaultArguments, ImplicitParameter, ImplicitConversion,
StringPlusAny, Any, ToString,
JavaSerializable, Serializable, Product, ToString,
LeakingSealed, Overloading,
Option2Iterable, IterableOps, ListAppend, SeqApply,
TripleQuestionMark,
),
libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.12" % Test,
libraryDependencies += "com.lihaoyi" %%% "sourcecode" % "0.3.0",
libraryDependencies += "com.lihaoyi" %%% "fastparse" % "2.3.3",
libraryDependencies += "com.lihaoyi" %% "os-lib" % "0.8.0",
//
watchSources += WatchSource(
sourceDirectory.value.getParentFile().getParentFile()/"shared/src/test/diff", "*.fun", NothingFilter),
watchSources += WatchSource(
sourceDirectory.value.getParentFile().getParentFile()/"shared/src/test/diff", "*.mls", NothingFilter),
Test / testOptions += Tests.Argument(TestFrameworks.ScalaTest, "-oC"),
)
lazy val mlscriptJVM = mlscript.jvm
// Create a npm-compatible package from the main projects.
lazy val npmBuild = crossProject(JSPlatform).in(file("npm"))
.settings(
name := "mlscript-npm",
scalaVersion := "2.13.13",
scalacOptions ++= Seq("-deprecation")
)
.jsSettings(
libraryDependencies += "org.scala-js" %%% "scalajs-dom" % "2.1.0",
Compile / fastOptJS / artifactPath := baseDirectory.value / ".." / ".." / "npm" / "dist" / "lib" / "index.js",
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule).withMinify(true) },
Compile / fullLinkJS / scalaJSLinkerOutputDirectory := baseDirectory.value / ".." / "dist" / "lib",
)
.dependsOn(mlscript % "compile->compile;test->test")
lazy val npmBuildJS = npmBuild.js