-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.sbt
123 lines (109 loc) · 4.16 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
import scala.sys.process._
import _root_.io.circe.parser._
val dataVersion = "2024a"
val softwareVersion = "25"
val snapshotRelease = true
val releaseType = if (snapshotRelease) "-SNAPSHOT" else ""
val jacksonVersion = "com.fasterxml.jackson.core" % "jackson-core" % "2.17.2"
val commonSettings = Seq(
organization := "net.iakovlev",
sonatypeProfileName := "net.iakovlev",
version := s"$dataVersion.$softwareVersion$releaseType",
crossPaths := false,
autoScalaLibrary := false,
publishMavenStyle := true
)
val `commons-compress` = Seq(
"org.apache.commons" % "commons-compress" % "1.26.1",
"com.github.luben" % "zstd-jni" % "1.5.5-11"
)
lazy val timeshape = (project in file("."))
.settings(commonSettings)
.aggregate(core, builder, testApp, `geojson-proto`, benchmarks)
.settings(publish / skip := true)
lazy val builderArgument = settingKey[String](
"Argument to pass to builder, either local path to source data file or version to download")
lazy val releaseTask = taskKey[Unit](
"Publishes an artifact and optionally makes a release if version is not a snapshot")
lazy val core = (project in file("core"))
.settings(commonSettings)
.settings(
builderArgument := dataVersion,
libraryDependencies ++= Seq(
"com.esri.geometry" % "esri-geometry-api" % "2.2.4",
"junit" % "junit" % "4.13.1" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
exclude ("junit", "junit-dep"),
"org.slf4j" % "slf4j-api" % "1.7.30",
"net.iakovlev" % "geojson-proto" % "1.1.4"
) ++ `commons-compress`,
dependencyOverrides += jacksonVersion,
name := "timeshape",
publishTo := sonatypePublishTo.value,
Compile / packageBin / packageOptions += Package.ManifestAttributes("Automatic-Module-Name" -> "net.iakovlev.timeshape"),
Compile / doc / javacOptions := Seq("-Xdoclint:none"),
Compile / javacOptions := Seq("-source", "8", "-target", "8"),
Compile / resourceGenerators += Def.taskDyn {
val log = streams.value.log
val outputPath = (Compile / resourceManaged).value
val outputFile = outputPath / "data.tar.zstd"
outputPath.mkdirs()
if (!outputFile.exists()) {
log.info("Timeshape resource doesn't exist in this host, creating it now.")
log.info("Downloading timezone data with version: " + builderArgument.value)
val command =
s"${(builder / stage).value}/bin/${(builder / name).value} ${builderArgument.value} ${outputFile.getAbsolutePath}"
log.info(s"running $command")
command.!
} else {
log.info("Timeshape resource exists, skipping creation")
}
Def.task(Seq(outputFile))
}.taskValue,
releaseTask := {
publish.value
val buildState = state.value
if (!isSnapshot.value) Command.process("sonatypeRelease", buildState)
}
)
lazy val `geojson-proto` = (project in file("geojson-proto"))
.settings(commonSettings)
.settings(
publishTo := sonatypePublishTo.value,
version := "1.1.5-SNAPSHOT",
Compile / PB.targets := Seq(
PB.gens.java("3.25.5") -> (Compile / sourceManaged).value
),
Compile / doc / javacOptions := Seq("-Xdoclint:none"),
Compile / javacOptions := Seq("-source", "8", "-target", "8"),
releaseTask := {
publish.value
val buildState = state.value
if (!isSnapshot.value) Command.process("sonatypeRelease", buildState)
}
)
lazy val builder = (project in file("builder"))
.settings(commonSettings)
.settings(
libraryDependencies ++= Seq(
jacksonVersion,
"de.grundid.opendatalab" % "geojson-jackson" % "1.14"
) ++ `commons-compress`,
name := "timeshape-builder",
publish / skip := true
)
.dependsOn(`geojson-proto`)
.enablePlugins(JavaAppPackaging)
lazy val testApp = (project in file("test-app"))
.settings(commonSettings)
.settings(
publish / skip := true,
libraryDependencies ++= Seq("org.openjdk.jol" % "jol-core" % "0.9",
"ch.qos.logback" % "logback-classic" % "1.2.13")
)
.dependsOn(core)
lazy val benchmarks = (project in file("benchmarks"))
.settings(commonSettings)
.settings(publish / skip := true)
.dependsOn(core)
.enablePlugins(JmhPlugin)