From fc3f6dd1d97fa72062d034cd82914f43bd03c58e Mon Sep 17 00:00:00 2001 From: Josh Suereth Date: Tue, 22 Apr 2014 11:23:15 -0400 Subject: [PATCH] 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. --- main/src/main/scala/sbt/Keys.scala | 1 - .../sbt/plugins/JUnitXmlReportPlugin.scala | 18 ++++++------------ .../project/JUnitXmlReportTest.scala | 2 -- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/main/src/main/scala/sbt/Keys.scala b/main/src/main/scala/sbt/Keys.scala index 0758ce5b7..3ea64983b 100644 --- a/main/src/main/scala/sbt/Keys.scala +++ b/main/src/main/scala/sbt/Keys.scala @@ -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) diff --git a/main/src/main/scala/sbt/plugins/JUnitXmlReportPlugin.scala b/main/src/main/scala/sbt/plugins/JUnitXmlReportPlugin.scala index 4b576d5a2..c1af6fffe 100644 --- a/main/src/main/scala/sbt/plugins/JUnitXmlReportPlugin.scala +++ b/main/src/main/scala/sbt/plugins/JUnitXmlReportPlugin.scala @@ -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() } \ No newline at end of file diff --git a/sbt/src/sbt-test/tests/junit-xml-report/project/JUnitXmlReportTest.scala b/sbt/src/sbt-test/tests/junit-xml-report/project/JUnitXmlReportTest.scala index 885be62a3..77de82620 100644 --- a/sbt/src/sbt-test/tests/junit-xml-report/project/JUnitXmlReportTest.scala +++ b/sbt/src/sbt-test/tests/junit-xml-report/project/JUnitXmlReportTest.scala @@ -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)