-
Notifications
You must be signed in to change notification settings - Fork 36
/
build.sbt
156 lines (136 loc) · 6.81 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
import sbtrelease.ReleasePlugin.autoImport._
import sbtrelease._
import ReleaseStateTransformations._
import sbtassembly.AssemblyPlugin.defaultUniversalScript
organization := "com.github.peregin"
name := "telemetry-on-video"
val entryPoint = "peregin.gpv.GpsOverlayApp"
Compile / mainClass := Some(entryPoint)
scalaVersion := "2.13.15"
// suppress warnings for unused settings introduced by plugins (e.g. github)
Global / excludeLintKeys ++= Set(ghreleaseNotes)
val jacksonVersion = "2.18.1"
val json4sVersion = "4.0.7"
val akkaVersion = "2.8.6"
val specs2Version = "4.20.9"
val logbackVersion = "1.5.12"
val batikVersion = "1.18" // svg manipulation
val xmlVersion = "2.3.0"
val jodaVersion = "2.13.0"
val swingVersion = "3.0.0"
val javacvVersion = "1.5.11"
val geotoolsVersion = "32.1"
scalacOptions ++= List("-feature", "-deprecation", "-language:implicitConversions", "-language:reflectiveCalls")
val macDockNameOpt = "-Xdock:name=\"GPS Overlay\""
run / fork := true
val moreJavaOptions = Seq(
//macDockNameOpt, // supported on MacOs only
"-Xmx1G",
"--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED",
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED"
)
javaOptions ++= moreJavaOptions
javacOptions ++= Seq("-source", "17", "-target", "17")
transitiveClassifiers in Global := Seq(Artifact.SourceClassifier)
resolvers ++= Seq(
"Typesafe Repository" at "https://repo.typesafe.com/typesafe/releases/",
"GeoTools Repository" at "https://repo.osgeo.org/repository/release/",
)
assembly / mainClass := Some(entryPoint)
assembly / assemblyJarName := "gps-overlay-on-video.jar"
assembly / assemblyOption := (assembly / assemblyOption).value
.withPrependShellScript(prependShellScript = Some(defaultUniversalScript(javaOpts = moreJavaOptions, shebang = false)))
assembly / assemblyMergeStrategy := {
case PathList("META-INF", ps @ _*) if ps.last.endsWith(".SF") || ps.last.endsWith(".RSA") || ps.last.endsWith(".DES") => MergeStrategy.discard
case PathList("META-INF", "services", _*) => MergeStrategy.filterDistinctLines
case PathList("META-INF", "maven", _*) => MergeStrategy.discard
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case PathList("META-INF", _*) => MergeStrategy.first
case PathList("javax", "servlet", _*) => MergeStrategy.discard
case PathList("junit", _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
(assembly / test) := {}
Compile / assembly / artifact := {
val art = (Compile / assembly / artifact).value
art.withClassifier(Some("assembly"))
}
addArtifact(Compile / assembly / artifact, assembly)
publishArtifact := false // it is done by the assembly plugin
lazy val root = (project in file(".")).
enablePlugins(BuildInfoPlugin, AssemblyPlugin).
settings(
buildInfoKeys := Seq[BuildInfoKey](name, version, scalaVersion, sbtVersion, BuildInfoKey.action("buildTime") {
new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm").format(new java.util.Date())
}),
buildInfoPackage := "info",
ghreleaseRepoOrg := "peregin",
ghreleaseRepoName := "gps-overlay-on-video",
ghreleaseNotes := (v => s"Release $v"),
releaseProcess := Seq[ReleaseStep](
checkSnapshotDependencies,
inquireVersions,
runClean,
runTest,
setReleaseVersion,
commitReleaseVersion,
tagRelease,
ReleaseStep(releaseStepTask(assembly)), // package artifacts
pushChanges, // needed fot the GH plugin to use the latest tag
ReleaseStep(releaseStepInputTask(githubRelease)),
setNextVersion,
commitNextVersion,
pushChanges // push the next version
),
// because of: org.swinglabs:swingx-core : 1.6.2-2 -> 1.6.2
dependencyUpdatesFilter -= moduleFilter(organization = "org.swinglabs", name = "swingx-core"),
)
onLoadMessage := welcomeMessage.value
def welcomeMessage = Def.setting {
import scala.Console
def red(text: String): String = s"${Console.RED}$text${Console.RESET}"
def item(text: String): String = s"${Console.GREEN}▶ ${Console.CYAN}$text${Console.RESET}"
s"""|${red(""" """)}
|${red(""" _ """)}
|${red(""" __ _____| |___ __ ___ _ _ _ _ ___ _ _ """)}
|${red(""" \ V / -_) / _ \/ _/ _ \ '_| ' \/ -_) '_|""")}
|${red(""" \_/\___|_\___/\__\___/_| |_||_\___|_| """)}
|${red(""" """+ version.value)}
|
|Useful sbt tasks:
|${item("run")} - starts the application
|${item("release")} - generates a new release
""".stripMargin
}
libraryDependencies += "org.scala-lang.modules" %% "scala-swing" % swingVersion
libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % xmlVersion
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % akkaVersion
libraryDependencies += "com.typesafe.akka" %% "akka-slf4j" % akkaVersion
libraryDependencies += "org.swinglabs" % "swingx-core" % "1.6.2-2"
libraryDependencies += "org.swinglabs" % "swingx-ws" % "1.0"
libraryDependencies += "com.jgoodies" % "looks" % "2.2.2"
libraryDependencies += "com.jgoodies" % "jgoodies-common" % "1.8.1"
libraryDependencies += "com.miglayout" % "miglayout" % "3.7.4"
libraryDependencies += "org.bytedeco" % "javacv" % javacvVersion
libraryDependencies += "org.bytedeco" % "javacv-platform" % javacvVersion
libraryDependencies += "com.fasterxml.jackson.dataformat" % "jackson-dataformat-yaml" % jacksonVersion
libraryDependencies += "com.fasterxml.jackson.module" %% "jackson-module-scala" % jacksonVersion
libraryDependencies += "org.json4s" %% "json4s-native" % json4sVersion
libraryDependencies += "org.json4s" %% "json4s-jackson" % json4sVersion
libraryDependencies += "com.fasterxml.jackson.datatype" % "jackson-datatype-jsr310" % "2.18.1"
libraryDependencies += "ch.qos.logback" % "logback-classic" % logbackVersion
libraryDependencies += "ch.qos.logback" % "logback-core" % logbackVersion
libraryDependencies += "joda-time" % "joda-time" % jodaVersion
libraryDependencies += "org.joda" % "joda-convert" % "3.0.1"
libraryDependencies += "org.apache.xmlgraphics" % "batik-transcoder" % batikVersion
libraryDependencies += "com.google.guava" % "guava" % "33.3.1-jre"
libraryDependencies += "org.geotools" % "gt-referencing" % geotoolsVersion exclude("javax.media", "jai_core")
// deprecated from Java 9, needs to be added when
libraryDependencies += "com.sun.activation" % "javax.activation" % "1.2.0"
libraryDependencies += "org.specs2" %% "specs2-core" % specs2Version % "test"
libraryDependencies += "org.specs2" %% "specs2-scalacheck" % specs2Version % "test"
libraryDependencies += "org.specs2" %% "specs2-mock" % specs2Version % "test"
libraryDependencies += "com.typesafe.akka" %% "akka-testkit" % akkaVersion % "test"
libraryDependencies += "org.mockito" % "mockito-all" % "1.10.19" % "test"