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:
Josh Suereth 2014-04-22 11:23:15 -04:00
parent 447ae8b1d8
commit fc3f6dd1d9
3 changed files with 6 additions and 15 deletions

View File

@ -195,7 +195,6 @@ object Keys
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 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 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)

View File

@ -6,13 +6,14 @@ import Keys._
import Project.inConfig
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
* add:
* To disable this plugin, you need to 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 {
// 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.
override lazy val projectSettings: Seq[Setting[_]] =
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()
}

View File

@ -15,8 +15,6 @@ object JUnitXmlReportTest extends Build {
scalaVersion := "2.9.2",
libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test",
testReportJUnitXml := true,
// TODO use matchers instead of sys.error
checkReport := {
val oneSecondReport = XML.loadFile(oneSecondReportFile)