-
Notifications
You must be signed in to change notification settings - Fork 50
/
build.sbt
111 lines (102 loc) · 3.18 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
name := "sbt-coveralls"
import sbt.ScriptedPlugin.autoImport.scriptedLaunchOpts
import java.io.File
import scala.sys.process._
lazy val generateXMLFiles =
taskKey[Unit]("Generate XML files (for test)")
generateXMLFiles := {
val dir = (Test / resourceDirectory).value
val pwd = (run / baseDirectory).value
val template =
if (System.getProperty("os.name").startsWith("Windows"))
".xml.windows.template"
else
".xml.template"
dir.listFiles { (_, name) => name.endsWith(template) }.foreach {
templateFile =>
val newFile = dir / templateFile.getName.replace(template, ".xml")
val content = IO.read(templateFile)
IO.write(newFile, content.replace("{{PWD}}", pwd.absolutePath))
}
}
lazy val prepareScripted =
taskKey[Unit]("Update .git files to make scripted work")
prepareScripted := {
val log = streams.value.log
val pwd = (run / baseDirectory).value
val submodules = "git submodule status" !! log
val submodulePaths = submodules.split('\n').map { x =>
x.split(" ")(2)
}
submodulePaths.foreach { subModulePath =>
val path = pwd / ".git" / "modules" / subModulePath
val pathFixedForWindows =
if (System.getProperty("os.name").startsWith("Windows"))
path.absolutePath.replace(
File.separator,
"/"
) // Git under Windows uses / for path separator
else
path.absolutePath
val destination = file(subModulePath) / ".git"
IO.delete(destination)
IO.write(destination, s"gitdir: $pathFixedForWindows")
}
}
inThisBuild(
List(
organization := "org.scoverage",
homepage := Some(url("http://scoverage.org")),
developers := List(
Developer(
"sksamuel",
"Stephen Samuel",
url("https://github.com/sksamuel")
),
Developer(
"rolandtritsch",
"Roland Tritsch",
url("https://github.com/rolandtritsch")
)
),
licenses := Seq(
"Apache-2.0" -> url("http://www.apache.org/license/LICENSE-2.0")
),
scalaVersion := "2.12.17", // scala-steward:off
versionScheme := Some("semver-spec")
)
)
lazy val root = Project("sbt-coveralls", file("."))
.enablePlugins(SbtPlugin)
.settings(
Test / publishArtifact := false,
scalacOptions := Seq(
"-release:8",
"-unchecked",
"-deprecation",
"-feature",
"-encoding",
"utf8"
),
dependencyOverrides ++= Seq(
"com.jcraft" % "jsch" % "0.1.55"
),
libraryDependencies ++= Seq(
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.18.0",
"com.fasterxml.jackson.core" % "jackson-core" % "2.18.0",
"org.eclipse.jgit" % "org.eclipse.jgit" % "5.13.0.202109080827-r",
"org.scalaj" %% "scalaj-http" % "2.4.2",
"io.circe" %% "circe-core" % "0.14.10",
"io.circe" %% "circe-generic" % "0.14.10",
"io.circe" %% "circe-parser" % "0.14.10",
"org.mockito" % "mockito-core" % "5.14.0" % Test,
"org.scalatest" %% "scalatest" % "3.2.19" % Test
),
scriptedLaunchOpts ++= Seq(
"-Xmx1024M",
"-Dplugin.sbtscoverage.version=" + "2.0.9",
"-Dplugin.sbtcoveralls.version=" + version.value
)
)