-
Notifications
You must be signed in to change notification settings - Fork 44
/
Copy pathbuild.sbt
77 lines (73 loc) · 2.39 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
def parseTagVersion: String = {
import scala.sys.process._
// drop `v` prefix
"git describe --abbrev=0 --tags".!!.drop(1).trim
}
inThisBuild(List(
version ~= { dynVer =>
if (System.getenv("CI") != null) dynVer else s"$parseTagVersion-SNAPSHOT" // only for local publishing
},
organization := "org.scalameta",
homepage := Some(url("https://github.com/scalameta/sbt-scalafmt")),
licenses :=
Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")),
developers := List(
Developer(
"poslegm",
"Mikhail Chugunkov",
url("https://chugunkov.website/"),
),
Developer(
"olafurpg",
"Ólafur Páll Geirsson",
url("https://geirsson.com"),
),
Developer(
"tanishiking",
"Rikito Taniguchi",
url("https://github.com/tanishiking/"),
),
),
resolvers ++= Resolver.sonatypeOssRepos("public"),
scalaVersion := "2.12.20",
crossScalaVersions += "3.6.3",
packageDoc / publishArtifact := insideCI.value,
packageSrc / publishArtifact := insideCI.value,
))
publish / skip := true
val scalafmtVersion = "3.9.1"
onLoadMessage :=
s"Welcome to sbt-scalafmt ${version.value} (scalafmt $scalafmtVersion)"
lazy val plugin = project.enablePlugins(SbtPlugin).settings(
moduleName := "sbt-scalafmt",
libraryDependencies ++= List(
"com.googlecode.java-diff-utils" % "diffutils" % "1.3.0",
"org.scalameta" %% "scalafmt-sysops" % scalafmtVersion cross
CrossVersion.for3Use2_13,
"org.scalameta" %% "scalafmt-dynamic" % scalafmtVersion cross
CrossVersion.for3Use2_13,
),
scriptedBufferLog := false,
scriptedLaunchOpts += s"-Dplugin.version=${version.value}",
// For compat reasons we have this in here to ensure we are testing against 1.2.8
// We honestly probably don't need to, so if this ever causes issues, rip it out.
pluginCrossBuild / sbtVersion := {
scalaBinaryVersion.value match {
case "2.12" => "1.2.8"
case _ => "2.0.0-M3"
}
},
conflictWarning := {
scalaBinaryVersion.value match {
case "3" => ConflictWarning("warn", Level.Warn, false)
case _ => conflictWarning.value
}
},
)
// For some reason, it doesn't work if this is defined in globalSettings in PublishPlugin.
inScope(Global)(Seq(
PgpKeys.pgpPassphrase := sys.env.get("PGP_PASSPHRASE").map(_.toCharArray()),
))