-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.sbt
179 lines (165 loc) · 6.52 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
ThisBuild / tlBaseVersion := "0.109"
ThisBuild / tlCiReleaseBranches := Seq("master")
ThisBuild / githubWorkflowEnv += "MUNIT_FLAKY_OK" -> "true"
ThisBuild / tlCiReleaseBranches += "topic/scala3"
Global / concurrentRestrictions += Tags.limit(Tags.Compile, 1)
ThisBuild / crossScalaVersions := Seq("3.5.2")
ThisBuild / scalacOptions += "-language:implicitConversions" // TODO
lazy val catsVersion = "2.12.0"
lazy val kindProjectorVersion = "0.13.2"
lazy val monocleVersion = "3.3.0"
lazy val scalaJavaTimeVersion = "2.6.0"
lazy val geminiLocalesVersion = "0.7.0"
lazy val jtsVersion = "0.4.0"
lazy val coulombVersion = "0.8.0"
lazy val spireVersion = "0.18.0"
lazy val refinedVersion = "0.11.2"
lazy val lucumaRefinedVersion = "0.1.3"
lazy val catsTimeVersion = "0.5.1"
lazy val circeVersion = "0.14.10"
lazy val circeRefinedVersion = "0.15.1"
lazy val catsScalacheckVersion = "0.3.2"
lazy val catsParseVersion = "1.0.0"
lazy val kittensVersion = "3.4.0"
lazy val scalajsStubVersion = "1.1.0"
Global / onChangedBuildSource := ReloadOnSourceChanges
val root = tlCrossRootProject.aggregate(core, testkit, tests)
lazy val core = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Full)
.in(file("modules/core"))
.settings(
name := "lucuma-core",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-parse" % catsParseVersion,
"org.typelevel" %%% "cats-core" % catsVersion,
"dev.optics" %%% "monocle-core" % monocleVersion,
"dev.optics" %%% "monocle-macro" % monocleVersion,
"dev.optics" %%% "monocle-state" % monocleVersion,
"edu.gemini" %%% "lucuma-jts" % jtsVersion,
"com.manyangled" %%% "coulomb-core" % coulombVersion,
"com.manyangled" %%% "coulomb-spire" % coulombVersion,
"com.manyangled" %%% "coulomb-units" % coulombVersion,
"org.typelevel" %%% "spire" % spireVersion,
"org.typelevel" %%% "spire-extras" % spireVersion,
"eu.timepit" %%% "refined" % refinedVersion,
"eu.timepit" %%% "refined-cats" % refinedVersion,
"edu.gemini" %%% "lucuma-refined" % lucumaRefinedVersion,
"org.typelevel" %%% "cats-time" % catsTimeVersion,
"org.typelevel" %%% "kittens" % kittensVersion,
"io.circe" %%% "circe-core" % circeVersion,
"io.circe" %%% "circe-refined" % circeRefinedVersion
)
)
.jvmConfigure(_.enablePlugins(AutomateHeaderPlugin))
.jvmSettings(
libraryDependencies ++= Seq(
"edu.gemini" %% "lucuma-jts-awt" % jtsVersion,
"org.scala-js" %% "scalajs-stubs" % scalajsStubVersion
)
)
.jsSettings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"edu.gemini" %%% "gemini-locales" % geminiLocalesVersion
)
)
lazy val testkit = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Pure)
.in(file("modules/testkit"))
.dependsOn(core)
.settings(
name := "lucuma-core-testkit",
libraryDependencies ++= Seq(
"org.typelevel" %%% "cats-testkit" % catsVersion,
"dev.optics" %%% "monocle-law" % monocleVersion,
"org.typelevel" %%% "spire-laws" % spireVersion,
"eu.timepit" %%% "refined-scalacheck" % refinedVersion,
"io.circe" %%% "circe-testing" % circeVersion,
"com.manyangled" %%% "coulomb-testkit" % coulombVersion,
"io.chrisdavenport" %%% "cats-scalacheck" % catsScalacheckVersion
)
)
.jvmConfigure(_.enablePlugins(AutomateHeaderPlugin))
val MUnitFramework = new TestFramework("munit.Framework")
val MUnitFlakyOK = sys.env.get("MUNIT_FLAKY_OK") match {
case Some("true") => Tests.Argument(MUnitFramework, "--exclude-tags=ScalaCheckFlaky")
case _ => Tests.Argument()
}
lazy val tests = crossProject(JVMPlatform, JSPlatform)
.crossType(CrossType.Full)
.in(file("modules/tests"))
.enablePlugins(NoPublishPlugin)
.dependsOn(testkit)
.settings(
name := "lucuma-core-tests",
libraryDependencies ++= Seq(
"org.scalameta" %%% "munit" % "1.0.2" % Test,
"org.typelevel" %%% "discipline-munit" % "2.0.0" % Test
),
testFrameworks += MUnitFramework,
testOptions += MUnitFlakyOK
)
.jvmConfigure(_.enablePlugins(AutomateHeaderPlugin))
.jvmSettings(
resolvers += "Gemini Repository".at(
"https://github.com/gemini-hlsw/maven-repo/raw/master/releases"
),
libraryDependencies ++= Seq(
("edu.gemini.ocs" %% "edu-gemini-util-skycalc" % "2020001.1.7" % Test)
.cross(CrossVersion.for3Use2_13)
.exclude("org.scala-lang.modules", "scala-xml_2.13"),
"com.47deg" %% "scalacheck-toolbox-datetime" % "0.7.0" % Test
)
)
lazy val benchmarks = project
.in(file("modules/benchmarks"))
.dependsOn(core.jvm)
.settings(name := "lucuma-core-benchmarks")
.enablePlugins(NoPublishPlugin, JmhPlugin)
// for publishing to npm
lazy val npmPackage = taskKey[File]("Prepare the npm package")
lazy val npmPublish = taskKey[Unit]("Run npm publish")
lazy val npm = project
.in(file("modules/npm"))
.dependsOn(core.js)
.enablePlugins(ScalaJSPlugin, NoPublishPlugin)
.settings(
scalaJSLinkerConfig ~= (_.withModuleKind(ModuleKind.ESModule)),
npmPackage := {
val _ = (Compile / fullLinkJS).value
val outDir = (Compile / fullLinkJS / scalaJSLinkerOutputDirectory).value
IO.write(
outDir / "package.json",
s"""|{
| "name": "lucuma-core",
| "version": "${version.value}",
| "license": "${licenses.value.head._1}",
| "main": "main.js",
| "types": "main.d.ts",
| "type": "module"
|}
|""".stripMargin
)
IO.copyDirectory((Compile / sourceDirectory).value / "typescript", outDir)
outDir
},
npmPublish := {
import scala.sys.process._
val outDir = npmPackage.value
Process(List("npm", "publish"), outDir).!!
}
)
ThisBuild / githubWorkflowPublishPreamble +=
WorkflowStep.Use(
UseRef.Public("actions", "setup-node", "v4"),
Map(
"node-version" -> "20",
"registry-url" -> "https://registry.npmjs.org"
)
)
ThisBuild / githubWorkflowPublish ++= Seq(
WorkflowStep.Sbt(List("npm/npmPublish"),
name = Some("NPM Publish"),
env = Map("NODE_AUTH_TOKEN" -> s"$${{ secrets.NPM_REPO_TOKEN }}")
)
)