-
Notifications
You must be signed in to change notification settings - Fork 10
/
build.sbt
145 lines (136 loc) · 4.91 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
import Dependencies._
ThisBuild / libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
val commonSettings = Seq(
versionScheme := Some("early-semver"),
scalaVersion := "2.13.14",
crossScalaVersions := Seq("2.12.19", "2.13.14"),
resolvers ++= Resolver.sonatypeOssRepos("releases") ++ Resolver.sonatypeOssRepos("snapshots") ++ Seq(
"locationtech-releases".at("https://repo.locationtech.org/content/groups/releases"),
"locationtech-snapshots".at("https://repo.locationtech.org/content/groups/snapshots")
),
scalacOptions := Seq(
"-deprecation",
"-unchecked",
"-feature",
"-language:implicitConversions",
"-language:reflectiveCalls",
"-language:higherKinds",
"-language:postfixOps",
"-language:existentials",
"-language:experimental.macros",
"-feature",
"-Ypatmat-exhaust-depth",
"100"
),
libraryDependencies ++= (
if (priorTo213(scalaVersion.value)) Seq(compilerPlugin(("org.scalamacros" %% "paradise" % "2.1.1").cross(CrossVersion.full)))
else Nil
),
scalacOptions ++= (if (priorTo213(scalaVersion.value)) Nil else Seq("-Ymacro-annotations")),
organization := "com.azavea.geotrellis",
organizationName := "GeoTrellis",
organizationHomepage := Some(url("https://geotrellis.io/")),
homepage := Some(url("https://github.com/geotrellis/maml")),
description := "MAML is used to create a declarative structure that describes a combination of map algebra operations.",
Test / publishArtifact := false,
sonatypeProfileName := "com.azavea",
developers := List(
Developer("moradology", "Nathan Zimmerman", "nzimmerman@azavea.com", url("https://github.com/moradology")),
Developer("echeipesh", "Eugene Cheipesh", "echeipesh@azavea.com", url("https://github.com/echeipesh")),
Developer("lossyrob", "Rob Emanuele", "remanuele@azavea.com", url("https://github.com/lossyrob"))
),
licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
)
val java17SparkSettings = Seq(
// JDK17+ https://github.com/apache/spark/blob/v3.5.1/pom.xml#L299-L317
javaOptions ++= {
if (javaMajorVersion >= 17)
Seq(
"-XX:+IgnoreUnrecognizedVMOptions",
"--add-modules=jdk.incubator.vector",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.base/jdk.internal.ref=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.cs=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.util.calendar=ALL-UNNAMED",
"-Djdk.reflect.useDirectMethodHandle=false",
"-Dio.netty.tryReflectionSetAccessible=true"
)
else Nil
}
)
lazy val noPublishSettings = Seq(
publish / skip := true,
publishLocal / skip := true,
publish := {},
publishLocal := {}
)
lazy val root = project
.in(file("."))
.aggregate(mamlJs, mamlJvm, mamlSpark)
.settings(commonSettings)
.settings(noPublishSettings)
lazy val maml = crossProject(JSPlatform, JVMPlatform)
.in(file("."))
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
scalacheck % Test,
scalatest % Test,
logging % Test,
cats("core").value,
cats("effect").value,
circe("core").value,
circe("generic").value,
circe("generic-extras").value,
circe("parser").value,
circe("optics").value
)
)
.jvmSettings(
name := "maml-jvm",
libraryDependencies ++= Seq(
geotrellis("raster").value,
geotrellis("layer").value,
geotrellis("proj4").value
)
)
.jsSettings(
name := "maml-js",
libraryDependencies += geotrellis("raster").value
)
lazy val mamlJvm = maml.jvm
lazy val mamlJs = maml.js
lazy val mamlSpark = project
.in(file("spark"))
.dependsOn(mamlJvm)
.settings(commonSettings)
.settings(java17SparkSettings)
.settings(name := "maml-spark")
.settings(
libraryDependencies ++= Seq(
spark("sql").value % Test,
spark("core").value % Provided,
geotrellis("spark-testkit").value % Test,
geotrellis("spark").value % Provided
)
)
.settings(
Test / fork := true,
Test / parallelExecution := false
)
def priorTo213(scalaVersion: String): Boolean =
CrossVersion.partialVersion(scalaVersion) match {
case Some((2, minor)) if minor < 13 => true
case _ => false
}
def javaMajorVersion: Int = System.getProperty("java.version").split("\\.").head.toInt