mirror of https://github.com/sbt/sbt.git
parent
06797514f8
commit
96e086b1a1
|
|
@ -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]].
|
||||
*/
|
||||
def requires: Plugins = empty
|
||||
def requires: Plugins = plugins.JvmPlugin
|
||||
|
||||
val label: String = getClass.getName.stripSuffix("$")
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import Def.Setting
|
|||
object CorePlugin extends AutoPlugin {
|
||||
// This is included by default
|
||||
override def trigger = allRequirements
|
||||
override def requires = empty
|
||||
|
||||
override lazy val projectSettings: Seq[Setting[_]] =
|
||||
Defaults.coreDefaultSettings
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ import org.specs2.mutable.Specification
|
|||
import sbt.internal._
|
||||
import sbt.internal.util.{ AttributeEntry, AttributeMap, ConsoleOut, GlobalLogging, MainLogging, Settings }
|
||||
|
||||
object PluginCommandTestPlugin0 extends AutoPlugin
|
||||
object PluginCommandTestPlugin0 extends AutoPlugin { override def requires = empty }
|
||||
|
||||
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 log = Logger.Null
|
||||
|
||||
object A extends AutoPlugin
|
||||
object B extends AutoPlugin
|
||||
object A extends AutoPlugin { override def requires = empty }
|
||||
object B extends AutoPlugin { override def requires = empty }
|
||||
|
||||
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 java.util.concurrent.atomic.{AtomicInteger => AInt}
|
||||
|
||||
object A extends AutoPlugin
|
||||
object B extends AutoPlugin
|
||||
object E extends AutoPlugin
|
||||
object A extends AutoPlugin { override def requires: Plugins = empty }
|
||||
object B extends AutoPlugin { override def requires: Plugins = empty }
|
||||
object E extends AutoPlugin { override def requires: Plugins = empty }
|
||||
|
||||
object Imports
|
||||
{
|
||||
|
|
@ -20,6 +20,7 @@ object Imports
|
|||
|
||||
object OrgPlugin extends AutoPlugin {
|
||||
override def trigger = allRequirements
|
||||
override def requires: Plugins = empty
|
||||
override def projectSettings = Seq(
|
||||
organization := "override"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue