mirror of https://github.com/sbt/sbt.git
Merge pull request #2738 from eed3si9n/wip/extra_rename
Rename to extraProjects/derivedProjects
This commit is contained in:
commit
4fa4bda69f
|
|
@ -0,0 +1 @@
|
|||
1.6
|
||||
|
|
@ -468,7 +468,7 @@ object Load {
|
|||
plugs.detected.builds.values
|
||||
}
|
||||
val buildLevelExtraProjects = plugs.detected.autoPlugins flatMap { d =>
|
||||
d.value.buildExtras map {_.setProjectOrigin(ProjectOrigin.BuildExtra)}
|
||||
d.value.extraProjects map {_.setProjectOrigin(ProjectOrigin.ExtraProject)}
|
||||
}
|
||||
|
||||
// NOTE - because we create an eval here, we need a clean-eval later for this URI.
|
||||
|
|
@ -602,7 +602,7 @@ object Load {
|
|||
}
|
||||
val p2 = this.resolveProject(p1, autoPlugins, plugins, injectSettings, memoSettings, log)
|
||||
val projectLevelExtra =
|
||||
if (expand) autoPlugins flatMap { _.projectExtras(p2) map {_.setProjectOrigin(ProjectOrigin.ProjectExtra)} }
|
||||
if (expand) autoPlugins flatMap { _.derivedProjects(p2) map {_.setProjectOrigin(ProjectOrigin.DerivedProject)} }
|
||||
else Nil
|
||||
(p2, projectLevelExtra)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,10 +91,10 @@ abstract class AutoPlugin extends Plugins.Basic with PluginsFunctions {
|
|||
// TODO?: def commands: Seq[Command]
|
||||
|
||||
/** The [[Project]]s to add to the current build. */
|
||||
def buildExtras: Seq[Project] = Nil
|
||||
def extraProjects: Seq[Project] = Nil
|
||||
|
||||
/** The [[Project]]s to add to the current build based on an existing project. */
|
||||
def projectExtras(proj: ProjectDefinition[_]): Seq[Project] = Nil
|
||||
def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] = Nil
|
||||
|
||||
private[sbt] def unary_! : Exclude = Exclude(this)
|
||||
|
||||
|
|
|
|||
|
|
@ -207,10 +207,10 @@ final case class ClasspathDependency(project: ProjectReference, configuration: O
|
|||
*/
|
||||
sealed trait ProjectOrigin
|
||||
object ProjectOrigin {
|
||||
case object Organic extends ProjectOrigin
|
||||
case object BuildExtra extends ProjectOrigin
|
||||
case object ProjectExtra extends ProjectOrigin
|
||||
case object GenericRoot extends ProjectOrigin
|
||||
case object Organic extends ProjectOrigin
|
||||
case object ExtraProject extends ProjectOrigin
|
||||
case object DerivedProject extends ProjectOrigin
|
||||
case object GenericRoot extends ProjectOrigin
|
||||
}
|
||||
|
||||
object Project extends ProjectExtra {
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
### Synthetic subprojects
|
||||
|
||||
sbt 0.13.13 adds support for `AutoPlugin`s to generate
|
||||
synthetic subprojects. To generate subprojects, override `buildExtras`
|
||||
synthetic subprojects. To generate subprojects, override `extraProjects`
|
||||
method as follows:
|
||||
|
||||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object BuildExtrasPlugin extends AutoPlugin {
|
||||
override def buildExtras: Seq[Project] =
|
||||
object ExtraProjectPluginExample extends AutoPlugin {
|
||||
override def extraProjects: Seq[Project] =
|
||||
List("foo", "bar", "baz") map generateProject
|
||||
|
||||
def generateProject(id: String): Project =
|
||||
|
|
@ -20,19 +20,19 @@ method as follows:
|
|||
}
|
||||
|
||||
In addition, subprojects may be derived from an existing subproject
|
||||
by overriding `projectExtras`.
|
||||
by overriding `derivedProjects`.
|
||||
|
||||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object ProjectExtrasPlugin extends AutoPlugin {
|
||||
object ExtraProjectPluginExample2 extends AutoPlugin {
|
||||
// Enable this plugin by default
|
||||
override def requires: Plugins = sbt.plugins.CorePlugin
|
||||
override def trigger = allRequirements
|
||||
|
||||
override def projectExtras(proj: ProjectDefinition[_]): Seq[Project] =
|
||||
override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] =
|
||||
// Make sure to exclude project extras to avoid recursive generation
|
||||
if (proj.projectOrigin != ProjectOrigin.ProjectExtra) {
|
||||
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
|
||||
val id = proj.id + "1"
|
||||
Seq(
|
||||
Project(id, file(id)).
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object BuildExtrasPlugin extends AutoPlugin {
|
||||
override def buildExtras: Seq[Project] =
|
||||
object ExtraProjectPluginExample extends AutoPlugin {
|
||||
override def extraProjects: Seq[Project] =
|
||||
List("foo", "bar", "baz") map generateProject
|
||||
|
||||
def generateProject(id: String): Project =
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
|
||||
object ProjectExtrasPlugin extends AutoPlugin {
|
||||
object ExtraProjectPluginExample2 extends AutoPlugin {
|
||||
// Enable this plugin by default
|
||||
override def requires: Plugins = sbt.plugins.CorePlugin
|
||||
override def trigger = allRequirements
|
||||
|
||||
override def projectExtras(proj: ProjectDefinition[_]): Seq[Project] =
|
||||
override def derivedProjects(proj: ProjectDefinition[_]): Seq[Project] =
|
||||
// Make sure to exclude project extras to avoid recursive generation
|
||||
if (proj.projectOrigin != ProjectOrigin.ProjectExtra) {
|
||||
if (proj.projectOrigin != ProjectOrigin.DerivedProject) {
|
||||
val id = proj.id + "1"
|
||||
Seq(
|
||||
Project(id, file(id)).
|
||||
Loading…
Reference in New Issue