@@ -83,12 +83,39 @@ TestKeys.includeTestDependencies := true
83
83
84
84
libraryDependencies ++= Seq (" junit" % " junit" % " 4.11" % " test" , " com.novocode" % " junit-interface" % " 0.10" % " test" )
85
85
86
+ // Define custom Ivy configuration called "partest". Ivy configuration is analogous to Maven scope
87
+ // and allows to group dependencies together, see:
88
+ // http://www.scala-sbt.org/release/docs/Detailed-Topics/Library-Management#configurations
89
+ // We define custom configuration so we can resolve partest through Ivy from Maven repository.
90
+ // However, by putting partest dependency in custom configuration we can make sure that
91
+ // it doesn't interfere with any other dependencies. Also, we can make sure that dependencies
92
+ // resolved in partest configuration NOT included in generated pom. See makePomConfiguration
93
+ // setting we define below.
94
+ val partestConfiguration = config(" partest" )
95
+
96
+ // Define configuration to be used to assemble the classpath for compiling and running
97
+ // tests. We define it as an union of default test configuration (scope in Maven's speak)
98
+ // and partest configuration.
99
+ val testWithPartestConfiguration = Configurations .Test .extend(partestConfiguration)
100
+
101
+ // register both configurations we defined so they are processed by `update` command
102
+ ivyConfigurations ++= Seq (partestConfiguration, testWithPartestConfiguration)
103
+
104
+ // override configuration used to assemble classpath for tests
105
+ configuration in Test := testWithPartestConfiguration
106
+
107
+ // Define configurations (scopes in Maven's speak) that are taken into account when
108
+ // generating pom. By default sbt sets MakePomConfiguration.configurations to None which is
109
+ // interpreted as "include dependencies in all configurations". That would include
110
+ // dependencies in partest configuration which is not what we want: see comment above
111
+ // where we define the partest configuration.
112
+ makePomConfiguration := makePomConfiguration.value.copy(configurations = Some (Configurations .default))
113
+
86
114
// default
87
115
TestKeys .partestVersion := " 1.0.0-RC6"
88
116
89
117
// the actual partest the interface calls into -- must be binary version close enough to ours
90
118
// so that it can link to the compiler/lib we're using (testing)
91
- // NOTE: not sure why, but the order matters (maybe due to the binary version conflicts for xml/parser combinators pulled in for scaladoc?)
92
119
libraryDependencies ++= (
93
120
if (TestKeys .includeTestDependencies.value) {
94
121
/**
@@ -111,8 +138,8 @@ libraryDependencies ++= (
111
138
dep.exclude(" org.scala-lang.modules" , " scala-xml_2.11.0-M5" ).
112
139
exclude(" org.scala-lang.modules" , " scala-xml_2.11.0-M4" ).
113
140
exclude(" org.scalacheck" , " scalacheck_2.11.0-M5" )
114
- Seq (" org.scala-lang.modules" % " scala-partest-interface_2.11.0-M5" % " 0.2" % " test " ,
115
- " org.scala-lang.modules" % " scala-partest_2.11.0-M5" % TestKeys .partestVersion.value % " test " ).
141
+ Seq (" org.scala-lang.modules" % " scala-partest-interface_2.11.0-M5" % " 0.2" % " partest " ,
142
+ " org.scala-lang.modules" % " scala-partest_2.11.0-M5" % TestKeys .partestVersion.value % " partest " ).
116
143
map(excludeScalaXml)
117
144
}
118
145
else Seq .empty
0 commit comments