-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.sbt
More file actions
86 lines (77 loc) · 2.43 KB
/
build.sbt
File metadata and controls
86 lines (77 loc) · 2.43 KB
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
import scala.jdk.CollectionConverters._
import java.util.Properties
import com.sourcegraph.sbtsourcegraph.Versions
val V = new {
def scala212 = "2.12.12"
def scalameta = "4.5.13"
}
scalaVersion := V.scala212
ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0-alpha.1"
ThisBuild / versionScheme := Some("early-semver")
organization := "com.sourcegraph"
semanticdbEnabled := !scalaVersion.value.startsWith("2.10")
semanticdbVersion := "4.4.26"
homepage := Some(url("https://github.com/sourcegraph/sbt-sourcegraph"))
licenses := List(
"Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")
)
developers := List(
Developer(
"olafurpg",
"Ólafur Páll Geirsson",
"olafurpg@sourcegraph.com",
url("https://sourcegraph.com")
)
)
commands +=
Command.command("fixAll") { s =>
"scalafixAll" :: "scalafmtAll" :: "scalafmtSbt" :: s
}
commands +=
Command.command("checkAll") { s =>
"scalafmtCheckAll" :: "scalafmtSbtCheck" ::
"scalafixAll --check" :: "publishLocal" ::
s
}
// Cross-building settings (see https://github.com/sbt/sbt/issues/3473#issuecomment-325729747)
def scala212 = "2.12.13"
def scala210 = "2.10.7"
sbtPlugin := true
moduleName := "sbt-sourcegraph"
pluginCrossBuild / sbtVersion := "1.2.1"
Compile / resourceGenerators += Def.task {
val out =
(Compile / managedResourceDirectories).value.head / "sbt-sourcegraph" / "semanticdb.properties"
if (!out.exists()) {
val versions = Versions.semanticdbVersionsByScalaVersion()
val props = new Properties()
props.putAll(versions.asJava)
IO.write(props, "SemanticDB versions grouped by Scala version.", out)
}
List(out)
}
crossScalaVersions := Seq(scala212, scala210)
scalacOptions ++= {
if (scalaVersion.value == scala210) List()
else List("-Xlint:unused")
}
pluginCrossBuild / sbtVersion := {
// keep this as low as possible to avoid running into binary incompatibility such as https://github.com/sbt/sbt/issues/5049
scalaBinaryVersion.value match {
case "2.10" => "0.13.17"
case "2.12" => "1.2.1"
}
}
buildInfoKeys := List[BuildInfoKey](
version
)
buildInfoPackage := "com.sourcegraph.sbtsourcegraph"
enablePlugins(BuildInfoPlugin)
enablePlugins(ScriptedPlugin)
scriptedBufferLog := false
scriptedLaunchOpts ++= Seq(
"-Xmx2048M",
s"-Dscip-java.version=${Versions.semanticdbJavacVersion()}",
s"-Dplugin.version=${version.value}"
)
def isCI = "true" == System.getenv("CI")