-
Notifications
You must be signed in to change notification settings - Fork 3
/
build.sbt
171 lines (138 loc) · 4.96 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import java.io.PrintWriter
import scala.io.Source
name := "selenium-4.21"
organization := "org.scalatestplus"
version := "3.2.19.0"
homepage := Some(url("https://github.com/scalatest/scalatestplus-selenium"))
licenses := List("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
developers := List(
Developer(
"bvenners",
"Bill Venners",
url("https://github.com/bvenners")
),
Developer(
"cheeseng",
"Chua Chee Seng",
url("https://github.com/cheeseng")
)
)
scalaVersion := "2.13.13"
crossScalaVersions := List("2.11.12", "2.12.19", "2.13.13", "3.3.3")
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest-core" % "3.2.19",
"org.seleniumhq.selenium" % "selenium-java" % "4.21.0",
"org.seleniumhq.selenium" % "htmlunit-driver" % "4.13.0",
"org.eclipse.jetty" % "jetty-webapp" % "9.4.48.v20220622" % Test,
"org.scalatest" %% "scalatest-funspec" % "3.2.19" % Test,
"org.scalatest" %% "scalatest-shouldmatchers" % "3.2.19" % Test
)
import scala.xml.{Node => XmlNode, NodeSeq => XmlNodeSeq, _}
import scala.xml.transform.{RewriteRule, RuleTransformer}
// skip dependency elements with a scope
pomPostProcess := { (node: XmlNode) =>
new RuleTransformer(new RewriteRule {
override def transform(node: XmlNode): XmlNodeSeq = node match {
case e: Elem if e.label == "dependency"
&& e.child.exists(child => child.label == "scope") =>
def txt(label: String): String = "\"" + e.child.filter(_.label == label).flatMap(_.text).mkString + "\""
Comment(s""" scoped dependency ${txt("groupId")} % ${txt("artifactId")} % ${txt("version")} % ${txt("scope")} has been omitted """)
case _ => node
}
}).transform(node).head
}
/*Test / testOptions :=
Seq(
Tests.Argument(TestFrameworks.ScalaTest,
"-l", "org.scalatest.tags.Slow"
))*/
enablePlugins(SbtOsgi)
osgiSettings
OsgiKeys.exportPackage := Seq(
"org.scalatestplus.selenium.*"
)
OsgiKeys.importPackage := Seq(
"org.scalatest.*",
"org.scalactic.*",
"scala.*;version=\"$<range;[==,=+);$<replace;"+scalaBinaryVersion.value+";-;.>>\"",
"*;resolution:=optional"
)
OsgiKeys.additionalHeaders:= Map(
"Bundle-Name" -> "ScalaTestPlusSelenium",
"Bundle-Description" -> "ScalaTest+Selenium is an open-source integration library between ScalaTest and Selenium for Scala projects.",
"Bundle-DocURL" -> "http://www.scalatest.org/",
"Bundle-Vendor" -> "Artima, Inc."
)
publishTo := {
val nexus = "https://oss.sonatype.org/"
Some("publish-releases" at nexus + "service/local/staging/deploy/maven2")
}
publishMavenStyle := true
Test / publishArtifact := false
pomIncludeRepository := { _ => false }
pomExtra := (
<scm>
<url>https://github.com/scalatest/scalatestplus-selenium</url>
<connection>scm:git:[email protected]:scalatest/scalatestplus-selenium.git</connection>
<developerConnection>
scm:git:[email protected]:scalatest/scalatestplus-selenium.git
</developerConnection>
</scm>
)
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
scalacOptions ++= {
(if (scalaBinaryVersion.value.startsWith("3"))
Seq(
"-deprecation",
"-encoding", "utf-8",
"-feature",
"-unchecked",
)
else
Seq(
"-deprecation",
"-encoding", "utf-8",
"-explaintypes",
"-feature",
"-unchecked",
"-Ywarn-dead-code",
)
) ++ (if (scalaBinaryVersion.value == "2.10" || scalaBinaryVersion.value.startsWith("3.")) Seq.empty else Seq("-Ywarn-unused"))
}
Compile / sourceGenerators += {
Def.task {
Generator.generateWebBrowserForScala3(scalaVersion.value, (sourceManaged in Compile).value)
}.taskValue
}
// Temporary disable publishing of doc in dotty, can't get it to build.
Compile / packageDoc / publishArtifact := !scalaBinaryVersion.value.startsWith("3")
def docTask(docDir: File, resDir: File, projectName: String): File = {
val docLibDir = docDir / "lib"
val htmlSrcDir = resDir / "html"
val cssFile = docLibDir / "template.css"
val addlCssFile = htmlSrcDir / "addl.css"
val css = Source.fromFile(cssFile).mkString
val addlCss = Source.fromFile(addlCssFile).mkString
if (!css.contains("pre.stHighlighted")) {
val writer = new PrintWriter(cssFile)
try {
writer.println(css)
writer.println(addlCss)
}
finally { writer.close }
}
if (projectName.contains("scalatest")) {
(htmlSrcDir * "*.gif").get.foreach { gif =>
IO.copyFile(gif, docLibDir / gif.name)
}
}
docDir
}
Compile / doc := docTask((Compile / doc).value,
(Compile / sourceDirectory).value,
name.value)
Compile / doc / scalacOptions := Seq("-doc-title", s"ScalaTest + Selenium ${version.value}",
"-sourcepath", baseDirectory.value.getAbsolutePath(),
"-doc-source-url", s"https://github.com/scalatest/releases-source/blob/main/scalatestplus-selenium/${version.value}€{FILE_PATH}.scala")