This repository has been archived by the owner on Jul 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBasicPlugin.scala
70 lines (60 loc) · 1.83 KB
/
BasicPlugin.scala
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
package tnm
import sbt._, Keys._
import sbtrelease.ReleasePlugin
import aether._
object BasicPlugin extends AutoPlugin {
private val javaVersion = "1.8"
val shellSettings = Seq(
shellPrompt := Shell.prompt
)
val compilerSettings = Seq(
resolvers := Seq(Repo.TnmGeneral),
scalaVersion := ScalaVersion.curr,
javacOptions ++= Seq(
"-source", javaVersion,
"-target", javaVersion
),
doc / javacOptions ++= Seq(
"-source", javaVersion
),
scalacOptions ++= Seq(
"-encoding", "UTF-8",
"-unchecked",
"-deprecation",
"-feature",
"-Xlog-reflective-calls",
"-Xlint",
"-Ywarn-value-discard"
) ++ ((pluginCrossBuild / scalaBinaryVersion).value match {
case v if v == "2.11" || v == "2.12" => Seq("-Ywarn-unused-import", s"-target:jvm-$javaVersion")
case v if v == "2.13" => Seq("-Ywarn-unused:imports", s"-target:jvm-$javaVersion")
case _ => Seq.empty
}),
console / scalacOptions -= "-Ywarn-unused-import",
Compile / parallelExecution := true
)
val checkJavaVersionCompliance = (s: State) => {
val installed = sys.props("java.specification.version").toDouble
require(
installed >= javaVersion.toDouble,
s"Java $javaVersion is required to build this project")
s
}
val miscSettings = Seq(
Global / cancelable := true,
Test / parallelExecution := true,
Test / fork := true,
run / fork := true,
Global / onLoad :=
checkJavaVersionCompliance compose (Global / onLoad).value
)
val publishSettings =
aether.AetherPlugin.autoImport.overridePublishBothSettings ++
Repo.publishSettings(Repo.Private)
override lazy val projectSettings =
shellSettings ++
compilerSettings ++
publishSettings ++
miscSettings
override val requires = ReleasePlugin && AetherPlugin
}