mirror of https://github.com/sbt/sbt.git
Merge pull request #2661 from dwijnand/AutoPlugin-require-JvmPlugin-by-default
AutoPlugin should require JvmPlugin by default
This commit is contained in:
commit
798683b552
|
|
@ -71,7 +71,7 @@ abstract class AutoPlugin extends Plugins.Basic with PluginsFunctions {
|
||||||
|
|
||||||
/** This AutoPlugin requires the plugins the [[Plugins]] matcher returned by this method. See [[trigger]].
|
/** This AutoPlugin requires the plugins the [[Plugins]] matcher returned by this method. See [[trigger]].
|
||||||
*/
|
*/
|
||||||
def requires: Plugins = empty
|
def requires: Plugins = plugins.JvmPlugin
|
||||||
|
|
||||||
val label: String = getClass.getName.stripSuffix("$")
|
val label: String = getClass.getName.stripSuffix("$")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ import Def.Setting
|
||||||
object CorePlugin extends AutoPlugin {
|
object CorePlugin extends AutoPlugin {
|
||||||
// This is included by default
|
// This is included by default
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
|
override def requires = empty
|
||||||
|
|
||||||
override lazy val projectSettings: Seq[Setting[_]] =
|
override lazy val projectSettings: Seq[Setting[_]] =
|
||||||
Defaults.coreDefaultSettings
|
Defaults.coreDefaultSettings
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,11 @@ import org.specs2.mutable.Specification
|
||||||
import sbt.internal._
|
import sbt.internal._
|
||||||
import sbt.internal.util.{ AttributeEntry, AttributeMap, ConsoleOut, GlobalLogging, MainLogging, Settings }
|
import sbt.internal.util.{ AttributeEntry, AttributeMap, ConsoleOut, GlobalLogging, MainLogging, Settings }
|
||||||
|
|
||||||
object PluginCommandTestPlugin0 extends AutoPlugin
|
object PluginCommandTestPlugin0 extends AutoPlugin { override def requires = empty }
|
||||||
|
|
||||||
package subpackage {
|
package subpackage {
|
||||||
|
|
||||||
object PluginCommandTestPlugin1 extends AutoPlugin
|
object PluginCommandTestPlugin1 extends AutoPlugin { override def requires = empty }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,8 +54,8 @@ object AI
|
||||||
lazy val deducePlugin = Plugins.deducer(allPlugins)
|
lazy val deducePlugin = Plugins.deducer(allPlugins)
|
||||||
lazy val log = Logger.Null
|
lazy val log = Logger.Null
|
||||||
|
|
||||||
object A extends AutoPlugin
|
object A extends AutoPlugin { override def requires = empty }
|
||||||
object B extends AutoPlugin
|
object B extends AutoPlugin { override def requires = empty }
|
||||||
|
|
||||||
object Q extends AutoPlugin
|
object Q extends AutoPlugin
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
val test123 = project in file(".") enablePlugins TestP settings(
|
||||||
|
resourceGenerators in Compile <+= Def.task {
|
||||||
|
streams.value.log info "resource generated in settings"
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
TaskKey[Unit]("check") := {
|
||||||
|
val last = IO read (BuiltinCommands lastLogFile state.value).get
|
||||||
|
def assertContains(expectedString: String) =
|
||||||
|
if (!(last contains expectedString)) sys error s"Expected string $expectedString to be present"
|
||||||
|
assertContains("resource generated in settings")
|
||||||
|
assertContains("resource generated in plugin")
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
import sbt._, syntax._, Keys._
|
||||||
|
|
||||||
|
object TestP extends AutoPlugin {
|
||||||
|
override def projectSettings: Seq[Setting[_]] = Seq(
|
||||||
|
resourceGenerators in Compile <+= Def.task {
|
||||||
|
streams.value.log info "resource generated in plugin"
|
||||||
|
Nil
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
# Test case from https://github.com/sbt/sbt/issues/2081, adapted
|
||||||
|
|
||||||
|
> test
|
||||||
|
> check
|
||||||
|
|
@ -3,9 +3,9 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/
|
||||||
import sbt._, syntax._, Keys._
|
import sbt._, syntax._, Keys._
|
||||||
import java.util.concurrent.atomic.{AtomicInteger => AInt}
|
import java.util.concurrent.atomic.{AtomicInteger => AInt}
|
||||||
|
|
||||||
object A extends AutoPlugin
|
object A extends AutoPlugin { override def requires: Plugins = empty }
|
||||||
object B extends AutoPlugin
|
object B extends AutoPlugin { override def requires: Plugins = empty }
|
||||||
object E extends AutoPlugin
|
object E extends AutoPlugin { override def requires: Plugins = empty }
|
||||||
|
|
||||||
object Imports
|
object Imports
|
||||||
{
|
{
|
||||||
|
|
@ -20,6 +20,7 @@ object Imports
|
||||||
|
|
||||||
object OrgPlugin extends AutoPlugin {
|
object OrgPlugin extends AutoPlugin {
|
||||||
override def trigger = allRequirements
|
override def trigger = allRequirements
|
||||||
|
override def requires: Plugins = empty
|
||||||
override def projectSettings = Seq(
|
override def projectSettings = Seq(
|
||||||
organization := "override"
|
organization := "override"
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue