mirror of https://github.com/sbt/sbt.git
Remove enabling key for JunitXmlReportPlugin.
This migrates JunitXmlReportPlugin to work the way we desire new sbt features/plugins to work: * Enabling the feature is having the plugin available. * Disabling the feature is disabling the plugin * All code/settings for the feature are isolated to the plugin.
This commit is contained in:
parent
447ae8b1d8
commit
fc3f6dd1d9
|
|
@ -195,7 +195,6 @@ object Keys
|
||||||
val testFrameworks = SettingKey[Seq[TestFramework]]("test-frameworks", "Registered, although not necessarily present, test frameworks.", CTask)
|
val testFrameworks = SettingKey[Seq[TestFramework]]("test-frameworks", "Registered, although not necessarily present, test frameworks.", CTask)
|
||||||
val testListeners = TaskKey[Seq[TestReportListener]]("test-listeners", "Defines test listeners.", DTask)
|
val testListeners = TaskKey[Seq[TestReportListener]]("test-listeners", "Defines test listeners.", DTask)
|
||||||
val testForkedParallel = SettingKey[Boolean]("test-forked-parallel", "Whether forked tests should be executed in parallel", CTask)
|
val testForkedParallel = SettingKey[Boolean]("test-forked-parallel", "Whether forked tests should be executed in parallel", CTask)
|
||||||
val testReportJUnitXml = SettingKey[Boolean]("test-report-junit-xml", "Produce JUnit XML test reports", BPlusTask)
|
|
||||||
val testExecution = TaskKey[Tests.Execution]("test-execution", "Settings controlling test execution", DTask)
|
val testExecution = TaskKey[Tests.Execution]("test-execution", "Settings controlling test execution", DTask)
|
||||||
val testFilter = TaskKey[Seq[String] => Seq[String => Boolean]]("test-filter", "Filter controlling whether the test is executed", DTask)
|
val testFilter = TaskKey[Seq[String] => Seq[String => Boolean]]("test-filter", "Filter controlling whether the test is executed", DTask)
|
||||||
val testResultLogger = SettingKey[TestResultLogger]("test-result-logger", "Logs results after a test task completes.", DTask)
|
val testResultLogger = SettingKey[TestResultLogger]("test-result-logger", "Logs results after a test task completes.", DTask)
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,14 @@ import Keys._
|
||||||
import Project.inConfig
|
import Project.inConfig
|
||||||
import Configurations.Test
|
import Configurations.Test
|
||||||
|
|
||||||
/** A plugin that adds the ability for junit-xml to be generated.
|
/** An experimental plugin that adds the ability for junit-xml to be generated.
|
||||||
*
|
*
|
||||||
* While this plugin automatically includes its settings, to enable, you need to
|
* To disable this plugin, you need to add:
|
||||||
* add:
|
|
||||||
* {{{
|
* {{{
|
||||||
* testReportJunitXml in Global := true
|
* val myProject = project in file(".") disablePlugins (plugins.JunitXmlReportPlugin)
|
||||||
* }}}
|
* }}}
|
||||||
|
*
|
||||||
|
* Note: Using AutoPlugins to enable/disable build features is experimental in sbt 0.13.5.
|
||||||
*/
|
*/
|
||||||
object JUnitXmlReportPlugin extends AutoPlugin {
|
object JUnitXmlReportPlugin extends AutoPlugin {
|
||||||
// TODO - If testing becomes its own plugin, we only rely on the core settings.
|
// TODO - If testing becomes its own plugin, we only rely on the core settings.
|
||||||
|
|
@ -23,13 +24,6 @@ object JUnitXmlReportPlugin extends AutoPlugin {
|
||||||
// It might be a good idea to derive this setting into specific test scopes.
|
// It might be a good idea to derive this setting into specific test scopes.
|
||||||
override lazy val projectSettings: Seq[Setting[_]] =
|
override lazy val projectSettings: Seq[Setting[_]] =
|
||||||
Seq(
|
Seq(
|
||||||
testListeners ++= (if( testReportJUnitXml.value ) Seq(new JUnitXmlTestsListener(target.value.getAbsolutePath)) else Nil)
|
testListeners += new JUnitXmlTestsListener(target.value.getAbsolutePath)
|
||||||
)
|
)
|
||||||
override lazy val globalSettings: Seq[Setting[_]] =
|
|
||||||
Seq(
|
|
||||||
// TODO - in sbt 1.0, this should default to true.
|
|
||||||
testReportJUnitXml :== false
|
|
||||||
)
|
|
||||||
|
|
||||||
override def projectConfigurations: Seq[Configuration] = Seq()
|
|
||||||
}
|
}
|
||||||
|
|
@ -15,8 +15,6 @@ object JUnitXmlReportTest extends Build {
|
||||||
scalaVersion := "2.9.2",
|
scalaVersion := "2.9.2",
|
||||||
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test",
|
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test",
|
||||||
|
|
||||||
testReportJUnitXml := true,
|
|
||||||
|
|
||||||
// TODO use matchers instead of sys.error
|
// TODO use matchers instead of sys.error
|
||||||
checkReport := {
|
checkReport := {
|
||||||
val oneSecondReport = XML.loadFile(oneSecondReportFile)
|
val oneSecondReport = XML.loadFile(oneSecondReportFile)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue