-
Notifications
You must be signed in to change notification settings - Fork 22
/
build.sbt
141 lines (123 loc) · 4.68 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
import sbt.Keys._
import org.scalajs.sbtplugin.ScalaJSCrossVersion
import org.openqa.selenium.Capabilities
import org.scalajs.jsenv.selenium.SeleniumJSEnv
import org.scalajs.jsenv.selenium.TestCapabilities
val previousVersion: Option[String] = Some("1.1.1")
val newScalaBinaryVersionsInThisRelease: Set[String] =
Set()
val commonSettings: Seq[Setting[_]] = Seq(
version := "1.1.2-SNAPSHOT",
organization := "org.scala-js",
scalaVersion := "2.11.12",
crossScalaVersions := Seq("2.11.12", "2.12.10", "2.13.1"),
scalacOptions ++= Seq("-deprecation", "-feature", "-Xfatal-warnings"),
homepage := Some(url("http://scala-js.org/")),
licenses += ("BSD New",
url("https://github.com/scala-js/scala-js-env-selenium/blob/main/LICENSE")),
scmInfo := Some(ScmInfo(
url("https://github.com/scala-js/scala-js-env-selenium"),
"scm:git:git@github.com:scala-js/scala-js-env-selenium.git",
Some("scm:git:git@github.com:scala-js/scala-js-env-selenium.git"))),
testOptions += Tests.Argument(TestFramework("com.novocode.junit.JUnitFramework"), "-v", "-a")
)
val previousArtifactSetting = Def.settings(
mimaPreviousArtifacts ++= {
val scalaV = scalaVersion.value
val scalaBinaryV = scalaBinaryVersion.value
val thisProjectID = projectID.value
previousVersion match {
case None =>
Set.empty
case _ if newScalaBinaryVersionsInThisRelease.contains(scalaBinaryV) =>
// New in this release, no binary compatibility to comply to
Set.empty
case Some(prevVersion) =>
/* Filter out e:info.apiURL as it expects 0.6.7-SNAPSHOT, whereas the
* artifact we're looking for has 0.6.6 (for example).
*/
val prevExtraAttributes =
thisProjectID.extraAttributes.filterKeys(_ != "e:info.apiURL")
val prevProjectID =
(thisProjectID.organization % thisProjectID.name % prevVersion)
.cross(thisProjectID.crossVersion)
.extra(prevExtraAttributes.toSeq: _*)
Set(prevProjectID)
}
}
)
val jsEnvCapabilities = settingKey[org.openqa.selenium.Capabilities](
"Capabilities of the SeleniumJSEnv")
val testSettings: Seq[Setting[_]] = commonSettings ++ Seq(
jsEnvCapabilities := TestCapabilities.fromEnv,
jsEnv := new SeleniumJSEnv(jsEnvCapabilities.value),
scalaJSUseMainModuleInitializer := true
)
// We'll need the name scalajs-env-selenium for the `seleniumJSEnv` project
name := "root"
lazy val seleniumJSEnv: Project = project.
settings(commonSettings).
settings(
name := "scalajs-env-selenium",
libraryDependencies ++= Seq(
/* Make sure selenium is before scalajs-envs-test-kit:
* It pulls in "closure-compiler-java-6" which in turn bundles some old
* guava stuff which in turn makes selenium fail.
*/
"org.seleniumhq.selenium" % "selenium-server" % "3.141.59",
"org.scala-js" %% "scalajs-js-envs" % "1.1.1",
"com.google.jimfs" % "jimfs" % "1.1",
"org.scala-js" %% "scalajs-js-envs-test-kit" % "1.1.1" % "test",
"com.novocode" % "junit-interface" % "0.11" % "test"
),
previousArtifactSetting,
mimaBinaryIssueFilters ++= BinaryIncompatibilities.SeleniumJSEnv,
publishMavenStyle := true,
publishTo := {
val nexus = "https://oss.sonatype.org/"
if (isSnapshot.value)
Some("snapshots" at nexus + "content/repositories/snapshots")
else
Some("releases" at nexus + "service/local/staging/deploy/maven2")
},
pomExtra := (
<developers>
<developer>
<id>nicolasstucki</id>
<name>Nicolas Stucki</name>
<url>https://github.com/nicolasstucki/</url>
</developer>
<developer>
<id>sjrd</id>
<name>Sébastien Doeraene</name>
<url>https://github.com/sjrd/</url>
</developer>
<developer>
<id>gzm0</id>
<name>Tobias Schlatter</name>
<url>https://github.com/gzm0/</url>
</developer>
</developers>
),
pomIncludeRepository := { _ => false },
// The chrome driver seems to not deal with parallelism very well (#47).
parallelExecution in Test := false
)
lazy val seleniumJSEnvTest: Project = project.
enablePlugins(ScalaJSPlugin).
enablePlugins(ScalaJSJUnitPlugin).
settings(testSettings)
lazy val seleniumJSHttpEnvTest: Project = project.
enablePlugins(ScalaJSPlugin).
enablePlugins(ScalaJSJUnitPlugin).
settings(testSettings).
settings(
jsEnv := {
new SeleniumJSEnv(
jsEnvCapabilities.value,
SeleniumJSEnv.Config()
.withMaterializeInServer("tmp", "http://localhost:8080/tmp/")
)
},
scalaJSLinkerConfig ~= { _.withModuleKind(ModuleKind.ESModule) }
)