forked from finos/morphir-jvm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sc
279 lines (244 loc) · 9.04 KB
/
build.sc
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import $ivy.`com.goyeau::mill-git:0.1.0-6-4254b37`
import $ivy.`com.goyeau::mill-scalafix:8515ae6`
import $ivy.`io.github.davidgregory084::mill-tpolecat:0.1.3`
import $ivy.`com.lihaoyi::mill-contrib-bloop:$MILL_VERSION`
import com.goyeau.mill.git.GitVersionedPublishModule
import com.goyeau.mill.scalafix.ScalafixModule
import io.github.davidgregory084.TpolecatModule
import mill._
import mill.scalalib._
import mill.scalajslib._
import publish._
import mill.scalalib.scalafmt._
import coursier.maven.MavenRepository
import ammonite.ops._, ImplicitWd._
object Deps {
object Versions {
val scala211 = "2.11.12"
val scala212 = "2.12.10"
val scala213 = "2.13.2"
val scalaJS06 = "0.6.32"
val scalaJS1 = "1.0.0"
val scalaJVMVersions = Seq(scala211, scala212, scala213)
val scalaJSVersions = Seq(
(scala212, scalaJS06),
(scala213, scalaJS06)
)
val zio = "1.0.0-RC19-2"
val zioConfig = "1.0.0-RC18"
val zioLogging = "0.2.9"
val zioNio = "1.0.0-RC6"
val zioProcess = "0.0.4"
val circe = "0.13.0"
val newtype = "0.4.4"
val decline = "1.2.0"
val pprint = "0.5.9"
val scalameta = "4.3.10"
val directories = "11"
val enumeratum = "1.6.1"
val macroParadise = "2.1.1"
}
}
trait MorphirPublishModule extends GitVersionedPublishModule {
def packageDescription = T(artifactName())
def pomSettings = PomSettings(
description = packageDescription(),
organization = "org.morphir",
url = "https://github.com/MorganStanley/morphir-jvm",
licenses = Seq(License.`Apache-2.0`),
versionControl = VersionControl.github("MorganStanley", "morphir-jvm"),
developers = Seq(
Developer(
"DamianReeves",
"Damian Reeves",
"https://github.com/DamianReeves"
)
)
)
}
trait MorphirCommonModule extends ScalaModule with ScalafmtModule with ScalafixModule with TpolecatModule {
def millSourcePath = super.millSourcePath / offset
def repositories = super.repositories ++ Seq(
MavenRepository("https://oss.sonatype.org/content/repositories/releases"),
MavenRepository("https://oss.sonatype.org/content/repositories/snapshots")
)
def platformSegment: String
def offset: os.RelPath = os.rel
def sources = T.sources(
super
.sources()
.flatMap(source =>
Seq(
PathRef(source.path / os.up / source.path.last),
PathRef(source.path / os.up / os.up / source.path.last)
)
)
)
}
trait CommonJvmModule extends MorphirCommonModule {
def platformSegment = "jvm"
def crossScalaVersion: String
def millSourcePath = super.millSourcePath / os.up
trait Tests extends super.Tests with MorphirTestModule {
def platformSegment = "jvm"
}
}
trait CommonJsModule extends MorphirCommonModule with ScalaJSModule {
def platformSegment = "js"
def crossScalaJSVersion: String
def scalaJSVersion = crossScalaJSVersion
def millSourcePath = super.millSourcePath / os.up / os.up
trait Tests extends super.Tests with MorphirTestModule {
def platformSegment = "js"
def scalaJSVersion = crossScalaJSVersion
}
}
trait MorphirTestModule extends ScalaModule with TestModule {
def millSourcePath = super.millSourcePath / os.up
def crossScalaVersion: String
def ivyDeps = Agg(
ivy"dev.zio::zio-test::${Deps.Versions.zio}",
ivy"dev.zio::zio-test-sbt::${Deps.Versions.zio}"
)
def testFrameworks =
Seq("zio.test.sbt.ZTestFramework")
def offset: os.RelPath = os.rel
def sources = T.sources(
super
.sources()
.++(CrossModuleBase.scalaVersionPaths(crossScalaVersion, s => millSourcePath / s"src-$s"))
.flatMap(source =>
Seq(
PathRef(source.path / os.up / "test" / source.path.last),
PathRef(source.path / os.up / os.up / "test" / source.path.last)
)
)
.distinct
)
}
object morphir extends Module {
import Deps._
object ir extends Module {
object jvm extends Cross[JvmMorphirIrModule](Versions.scala212, Versions.scala213)
class JvmMorphirIrModule(val crossScalaVersion: String)
extends CrossScalaModule
with CommonJvmModule
with MorphirPublishModule {
def artifactName = "morphir-ir"
def ivyDeps = Agg(
ivy"dev.zio::zio:${Versions.zio}",
ivy"dev.zio::zio-streams:${Versions.zio}",
ivy"io.circe::circe-core:${Versions.circe}",
ivy"io.circe::circe-generic:${Versions.circe}",
ivy"io.circe::circe-parser:${Versions.circe}",
ivy"com.beachape::enumeratum:${Versions.enumeratum}",
ivy"com.beachape::enumeratum-circe:${Versions.enumeratum}",
ivy"dev.zio::zio-test::${Deps.Versions.zio}"
)
object test extends Tests {
def crossScalaVersion = JvmMorphirIrModule.this.crossScalaVersion
}
}
}
object scala extends Module {
object jvm extends Cross[JvmMorphirScalaModule](Versions.scala212, Versions.scala213)
class JvmMorphirScalaModule(val crossScalaVersion: String)
extends CrossScalaModule
with CommonJvmModule
with MorphirPublishModule {
def artifactName = "morphir-scala"
def moduleDeps = Seq(morphir.ir.jvm(crossScalaVersion))
def ivyDeps = Agg(
ivy"org.scalameta::scalameta:${Versions.scalameta}"
)
object test extends Tests {
def crossScalaVersion = JvmMorphirScalaModule.this.crossScalaVersion
}
}
}
object sdk extends Module {
object core extends Module {
object jvm extends Cross[JvmMorphirSdkCore](Versions.scala212, Versions.scala211, Versions.scala213)
class JvmMorphirSdkCore(val crossScalaVersion: String)
extends CrossScalaModule
with CommonJvmModule
with MorphirPublishModule {
def artifactName = "morphir-sdk-core"
object test extends Tests {
def crossScalaVersion = JvmMorphirSdkCore.this.crossScalaVersion
}
}
}
}
object workspace extends Module {
object jvm extends Cross[JvmMorphirWorkspace](Versions.scala212, Versions.scala213)
class JvmMorphirWorkspace(val crossScalaVersion: String)
extends CrossScalaModule
with CommonJvmModule
with MorphirPublishModule {
def artifactName = "morphir-workspace"
def moduleDeps = Seq(morphir.ir.jvm(crossScalaVersion))
def ivyDeps = Agg(
ivy"dev.zio::zio:${Versions.zio}",
ivy"dev.zio::zio-logging:${Versions.zioLogging}",
ivy"dev.zio::zio-config:${Versions.zioConfig}",
ivy"dev.zio::zio-config-magnolia:${Versions.zioConfig}",
ivy"dev.zio::zio-config-typesafe:${Versions.zioConfig}",
ivy"dev.zio::zio-process:${Versions.zioProcess}",
ivy"dev.zio::zio-logging:${Versions.zioLogging}",
ivy"io.estatico::newtype:${Versions.newtype}",
ivy"com.monovore::decline-effect:${Versions.decline}",
ivy"com.lihaoyi::pprint:${Versions.pprint}",
ivy"org.scalameta::scalameta:${Versions.scalameta}"
)
def scalacOptions = super.scalacOptions() ++ (
if (crossScalaVersion.startsWith("2.13")) Seq("-Ymacro-annotations") else Seq.empty
)
def scalacPluginIvyDeps =
super.scalacPluginIvyDeps() ++
(if (crossScalaVersion.startsWith("2.12"))
Agg(ivy"org.scalamacros:::paradise:${Versions.macroParadise}")
else
Agg.empty)
object test extends Tests {
def crossScalaVersion = JvmMorphirWorkspace.this.crossScalaVersion
}
}
}
object cli extends Module {
object jvm extends Cross[JvmMorphirCli](Versions.scala212, Versions.scala213)
class JvmMorphirCli(val crossScalaVersion: String)
extends CrossScalaModule
with CommonJvmModule
with MorphirPublishModule {
def artifactName = "morphir-cli"
def moduleDeps = Seq(morphir.ir.jvm(crossScalaVersion), morphir.workspace.jvm(crossScalaVersion))
def ivyDeps = Agg(
ivy"dev.zio::zio:${Versions.zio}",
ivy"dev.zio::zio-logging:${Versions.zioLogging}",
ivy"dev.zio::zio-config:${Versions.zioConfig}",
ivy"dev.zio::zio-config-magnolia:${Versions.zioConfig}",
ivy"dev.zio::zio-config-typesafe:${Versions.zioConfig}",
ivy"dev.zio::zio-process:${Versions.zioProcess}",
ivy"dev.zio::zio-logging:${Versions.zioLogging}",
ivy"io.estatico::newtype:${Versions.newtype}",
ivy"com.monovore::decline-effect:${Versions.decline}",
ivy"com.lihaoyi::pprint:${Versions.pprint}",
ivy"org.scalameta::scalameta:${Versions.scalameta}"
)
def scalacOptions = super.scalacOptions() ++ (
if (crossScalaVersion.startsWith("2.13")) Seq("-Ymacro-annotations") else Seq.empty
)
def scalacPluginIvyDeps =
super.scalacPluginIvyDeps() ++
(if (crossScalaVersion.startsWith("2.12"))
Agg(ivy"org.scalamacros:::paradise:${Versions.macroParadise}")
else
Agg.empty)
object test extends Tests {
def crossScalaVersion = JvmMorphirCli.this.crossScalaVersion
}
}
}
}
// object workspace extends Module