This repository has been archived by the owner on Jun 27, 2020. It is now read-only.
forked from playframework/scalatestplus-play
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sbt
163 lines (145 loc) · 5.82 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
/*
* Copyright 2001-2016 Artima, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.typesafe.tools.mima.core.{ProblemFilters, ReversedMissingMethodProblem}
import sbt.util._
import scala.sys.process._
import sbt.io.Path._
import interplay.ScalaVersions._
import sbt.addCompilerPlugin
resolvers ++= DefaultOptions.resolvers(snapshot = true)
resolvers += Resolver.sonatypeRepo("snapshots")
val PlayVersion = playVersion("2.7.3")
val SeleniumVersion = "3.141.59"
val HtmlUnitVersion = "2.34.0"
val PhantomJsDriverVersion = "1.4.4"
val MockitoVersion = "2.18.3"
val CssParserVersion = "1.2.0"
val ScalatestVersion = "3.1.0"
lazy val mimaSettings = Seq(
mimaPreviousArtifacts := {
val artifact = organization.value %% name.value
if(scalaVersion.value.equals(scala213))
Set(artifact % "4.0.3")
else
Set(artifact % "4.0.0")
}
)
lazy val commonSettings = mimaSettings ++ Seq(
scalaVersion := scala213,
crossScalaVersions := Seq("2.11.12", scala212, scala213),
fork in Test := true, // see https://github.com/sbt/sbt/issues/4609
parallelExecution in Test := false,
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oTK"),
scalafixDependencies in ThisBuild += "org.scalatest" %% "autofix" % "3.1.0.0",
addCompilerPlugin(scalafixSemanticdb) // enable SemanticDB
)
lazy val `scalatestplus-play-root` = project
.in(file("."))
.enablePlugins(PlayRootProject)
.aggregate(`scalatestplus-play`)
.settings(commonSettings: _*)
.settings(
sonatypeProfileName := "org.scalatestplus.play",
mimaPreviousArtifacts := Set.empty
)
lazy val `scalatestplus-play` = project
.in(file("module"))
.enablePlugins(Playdoc, PlayLibrary, PlayReleaseBase)
.configs(Docs)
.settings(
organization := "io.kontainers",
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % ScalatestVersion,
"org.scalatestplus" %% "scalatestplus-selenium" % "1.0.0-M2",
"org.seleniumhq.selenium" % "selenium-java" % SeleniumVersion exclude(org = "com.codeborne", name = "phantomjsdriver"),
"org.seleniumhq.selenium" % "htmlunit-driver" % HtmlUnitVersion,
"net.sourceforge.htmlunit" % "htmlunit-cssparser" % CssParserVersion,
"com.codeborne" % "phantomjsdriver" % PhantomJsDriverVersion,
"com.typesafe.play" %% "play-test" % PlayVersion,
"com.typesafe.play" %% "play-ws" % PlayVersion,
"com.typesafe.play" %% "play-ahc-ws" % PlayVersion
),
scalacOptions in(Compile, doc) := Seq("-doc-title", "ScalaTest + Play, " + releaseVersion),
pomExtra := PomExtra,
mimaBinaryIssueFilters ++= Seq(
ProblemFilters.exclude[ReversedMissingMethodProblem]("org.scalatestplus.play.BaseOneServerPerTest.org$scalatestplus$play$BaseOneServerPerTest$_setter_$org$scalatestplus$play$BaseOneServerPerTest$$lock_="),
ProblemFilters.exclude[ReversedMissingMethodProblem]("org.scalatestplus.play.BaseOneServerPerTest.org$scalatestplus$play$BaseOneServerPerTest$$lock")
)
)
.settings(commonSettings: _*)
lazy val docs = project
.in(file("docs"))
.enablePlugins(PlayDocsPlugin, PlayNoPublish)
.configs(Docs)
.settings(
libraryDependencies ++= Seq(
"org.mockito" % "mockito-core" % MockitoVersion % Test
),
PlayDocsKeys.scalaManualSourceDirectories := (baseDirectory.value / "manual" / "working" / "scalaGuide" ** "code").get,
PlayDocsKeys.resources += {
val apiDocs = (doc in(`scalatestplus-play`, Compile)).value
// Copy the docs to a place so they have the correct api/scala prefix
val apiDocsStage = target.value / "api-docs-stage"
val cacheFile = streams.value.cacheDirectory / "api-docs-stage"
val mappings = (apiDocs.allPaths.filter(!_.isDirectory).get pair relativeTo(apiDocs)).map {
case (file, path) => file -> apiDocsStage / "api" / "scala" / path
}
Sync(CacheStore(cacheFile))(mappings)
PlayDocsDirectoryResource(apiDocsStage)
},
SettingKey[Seq[File]]("migrationManualSources") := Nil
)
.settings(commonSettings: _*)
.dependsOn(`scalatestplus-play`)
playBuildRepoName in ThisBuild := "scalatestplus-play"
lazy val PomExtra = {
<scm>
<url>https://github.com/kontainers/scalatestplus-play</url>
<connection>scm:git:git@github.com:kontainers/scalatestplus-play.git</connection>
<developerConnection>
scm:git:git@github.com:kontainers/scalatestplus-play.git
</developerConnection>
</scm>
<developers>
<developer>
<id>bvenners</id>
<name>Bill Venners</name>
</developer>
<developer>
<id>gcberger</id>
<name>George Berger</name>
</developer>
<developer>
<id>cheeseng</id>
<name>Chua Chee Seng</name>
</developer>
</developers>
}
lazy val checkCodeFormat = taskKey[Unit]("Check that code format is following Scalariform rules")
checkCodeFormat := {
val exitCode = "git diff --exit-code".!
if (exitCode != 0) {
sys.error(
"""
|ERROR: Scalariform check failed, see differences above.
|To fix, format your sources using sbt scalariformFormat test:scalariformFormat before submitting a pull request.
|Additionally, please squash your commits (eg, use git commit --amend) if you're going to update this pull request.
|""".stripMargin)
}
}
addCommandAlias("validateCode",
";scalariformFormat;test:scalariformFormat;checkCodeFormat"
)