@@ -26,6 +26,7 @@ object TestsPlugin extends AutoPlugin {
2626 override def extraProjects = funTestProjects ++ intTestProjects
2727
2828 override def buildSettings = Seq (
29+ resolvers += " scala-pr-validation-snapshots" at " https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/" ,
2930 testScalaVersion := sys.props.getOrElse(" mima.testScalaVersion" , scalaVersion.value),
3031 )
3132
@@ -41,25 +42,19 @@ object TestsPlugin extends AutoPlugin {
4142 private val V1 = config(" v1" ).extend(Compile ) // Version 1 of a library
4243 private val V2 = config(" v2" ).extend(Compile ) // Version 2 of a library
4344 private val App = config(" app" ).extend(V1 ) // An App, built against library v1
44- private val App2 = config(" app2" ).extend(V2 , App ) // The App, using library v2
4545
4646 private def testProjects (prefix : String , fileName : String , setup : Project => Project ) = {
4747 (file(" functional-tests" ) / " src" / prefix * dirContaining(fileName)).get().map { base =>
4848 Project (s " $prefix- ${base.name}" , base).disablePlugins(BintrayPlugin ).configure(setup)
4949 }
5050 }
5151
52- private def intTestProject (p : Project ) = p.settings(intTestProjectSettings )
53- private def funTestProject (p : Project ) = p.settings(funTestProjectSettings).configs(V1 , V2 , App , App2 )
52+ private def intTestProject (p : Project ) = p.settings(IntegrationTest / test := runIntegrationTest.value )
53+ private def funTestProject (p : Project ) = p.settings(funTestProjectSettings).configs(V1 , V2 , App )
5454
5555 private lazy val funTestProjects = testProjects(" test" , " problems.txt" , funTestProject)
5656 private lazy val intTestProjects = testProjects( " it" , " test.conf" , intTestProject)
5757
58- private def sharedTestProjectSettings = Def .settings(
59- resolvers += " scala-pr-validation-snapshots" at " https://scala-ci.typesafe.com/artifactory/scala-pr-validation-snapshots/" ,
60- scalaVersion := testScalaVersion.value,
61- )
62-
6358 private val oracleFile = Def .task {
6459 val p = baseDirectory.value / " problems.txt"
6560 val p211 = baseDirectory.value / " problems-2.11.txt"
@@ -88,18 +83,13 @@ object TestsPlugin extends AutoPlugin {
8883 val conf = ConfigFactory .parseFile(confFile).resolve()
8984 val moduleBase = conf.getString(" groupId" ) % conf.getString(" artifactId" )
9085 val depRes = dependencyResolution.value
91- val v1 = getArtifact(depRes, moduleBase % conf.getString(" v1 " ), streams.value.log)
92- val v2 = getArtifact(depRes, moduleBase % conf.getString(" v2 " ), streams.value.log)
86+ val v1 = getArtifact(depRes, moduleBase % conf.getString(V1 .name ), streams.value.log)
87+ val v2 = getArtifact(depRes, moduleBase % conf.getString(V2 .name ), streams.value.log)
9388 streams.value.log.info(s " Comparing $v1 -> $v2" )
9489 runCollectProblemsTest(cp, si, name.value, v1, v2, baseDirectory.value, oracleFile.value)
9590 streams.value.log.info(s " Test ' ${name.value}' succeeded. " )
9691 }
9792
98- private val intTestProjectSettings = Def .settings(
99- sharedTestProjectSettings,
100- IntegrationTest / test := runIntegrationTest.value,
101- )
102-
10393 private val funTestPerConfigSettings = Def .settings(
10494 Defaults .configSettings, // e.g. compile and package
10595 scalaSource := baseDirectory.value / configuration.value.name, // e.g., use v1/ instead of src/v1/scala/
@@ -125,7 +115,7 @@ object TestsPlugin extends AutoPlugin {
125115 case _ => p.exists()
126116 }
127117 (App / fgRun).toTask(" " ).value
128- val result = (App2 / fgRun).toTask(" " ).result.value
118+ val result = (Test / fgRun).toTask(" " ).result.value
129119 if (IO .read(oracleFile.value).isEmpty) {
130120 if (! pending) Result .tryValue(result)
131121 } else {
@@ -138,24 +128,24 @@ object TestsPlugin extends AutoPlugin {
138128 private val runFunctionalTest = Def .task {
139129 testCollectProblems.value
140130 testAppRun.value
141- streams.value.log.info(s " Test ' ${name.value}' succeeded. " )
131+ streams.value.log.info(s " Test ' ${name.value}' succeeded " )
142132 }
143133
144134 private val funTestProjectSettings = Def .settings(
145- sharedTestProjectSettings ,
135+ scalaVersion := testScalaVersion.value ,
146136 inConfig(V1 )(funTestPerConfigSettings),
147137 inConfig(V2 )(funTestPerConfigSettings),
148138 inConfig(App )(funTestPerConfigSettings),
149- inConfig(App2 )(Def .settings(
150- funTestPerConfigSettings ,
151- internalDependencyClasspath -- = (V1 / exportedProducts).value, // V2 only, drop V2 classes
139+ inConfig(Test )(Def .settings(
140+ internalDependencyClasspath ++= ( V2 / exportedProducts).value ,
141+ internalDependencyClasspath ++ = (App / exportedProducts).value,
152142 run / mainClass := Some (" App" ),
153143 run / trapExit := false ,
154144 )),
145+ Global / onLoad += oracleFileCheck.value,
155146 testCollectProblems := testCollectProblemsImpl.value,
156147 testAppRun := testAppRunImpl.value,
157148 Test / test := runFunctionalTest.value,
158- Global / onLoad += oracleFileCheck.value,
159149 )
160150
161151 private def runCollectProblemsTest (
@@ -190,7 +180,7 @@ object TestsPlugin extends AutoPlugin {
190180 } catch {
191181 case e : Exception =>
192182 Console .err.println(e.toString)
193- throw new MessageOnlyException (s " Test ' $testName' failed. " )
183+ throw new MessageOnlyException (s " Test ' $testName' failed " )
194184 }
195185 }
196186
0 commit comments