mirror of https://github.com/sbt/sbt.git
if sbtPlugin is true, sbt dependency and resolver are added
This commit is contained in:
parent
4a8e79befb
commit
ac280e5fe7
|
|
@ -451,7 +451,10 @@ object Classpaths
|
||||||
normalizedName <<= name(StringUtilities.normalize),
|
normalizedName <<= name(StringUtilities.normalize),
|
||||||
organization :== normalizedName,
|
organization :== normalizedName,
|
||||||
classpathFilter in GlobalScope :== "*.jar",
|
classpathFilter in GlobalScope :== "*.jar",
|
||||||
fullResolvers <<= (projectResolver,resolvers).map( (pr,rs) => pr +: Resolver.withDefaultResolvers(rs)),
|
fullResolvers <<= (projectResolver,resolvers,sbtPlugin,sbtResolver) map { (pr,rs,isPlugin,sr) =>
|
||||||
|
val base = pr +: Resolver.withDefaultResolvers(rs)
|
||||||
|
if(isPlugin) sr +: base else base
|
||||||
|
},
|
||||||
offline in GlobalScope :== false,
|
offline in GlobalScope :== false,
|
||||||
moduleID :== normalizedName,
|
moduleID :== normalizedName,
|
||||||
defaultConfiguration in GlobalScope :== Some(Configurations.Compile),
|
defaultConfiguration in GlobalScope :== Some(Configurations.Compile),
|
||||||
|
|
@ -461,7 +464,10 @@ object Classpaths
|
||||||
projectResolver <<= projectResolverTask,
|
projectResolver <<= projectResolverTask,
|
||||||
projectDependencies <<= projectDependenciesTask,
|
projectDependencies <<= projectDependenciesTask,
|
||||||
libraryDependencies in GlobalScope :== Nil,
|
libraryDependencies in GlobalScope :== Nil,
|
||||||
allDependencies <<= concat(projectDependencies,libraryDependencies),
|
allDependencies <<= (projectDependencies,libraryDependencies,sbtPlugin,sbtDependency) map { (projDeps, libDeps, isPlugin, sbtDep) =>
|
||||||
|
val base = projDeps ++ libDeps
|
||||||
|
if(isPlugin) sbtDep +: base else base
|
||||||
|
},
|
||||||
ivyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
ivyLoggingLevel in GlobalScope :== UpdateLogging.Quiet,
|
||||||
ivyXML in GlobalScope :== NodeSeq.Empty,
|
ivyXML in GlobalScope :== NodeSeq.Empty,
|
||||||
ivyValidate in GlobalScope :== false,
|
ivyValidate in GlobalScope :== false,
|
||||||
|
|
@ -498,10 +504,13 @@ object Classpaths
|
||||||
},
|
},
|
||||||
transitiveClassifiers :== Seq("sources", "javadoc"),
|
transitiveClassifiers :== Seq("sources", "javadoc"),
|
||||||
updateClassifiers <<= (ivySbt, projectID, update, transitiveClassifiers, updateConfiguration, ivyScala) map IvyActions.transitive,
|
updateClassifiers <<= (ivySbt, projectID, update, transitiveClassifiers, updateConfiguration, ivyScala) map IvyActions.transitive,
|
||||||
updateSbtClassifiers <<= (ivySbt, projectID, transitiveClassifiers, updateConfiguration, appConfiguration, ivyScala) map { (is, pid, classifiers, c, app, ivyScala) =>
|
updateSbtClassifiers <<= (ivySbt, projectID, transitiveClassifiers, updateConfiguration, sbtDependency, ivyScala) map { (is, pid, classifiers, c, sbtDep, ivyScala) =>
|
||||||
|
IvyActions.transitiveScratch(is, pid, "sbt", sbtDep :: Nil, classifiers, c, ivyScala)
|
||||||
|
},
|
||||||
|
sbtResolver in GlobalScope :== dbResolver,
|
||||||
|
sbtDependency in GlobalScope <<= appConfiguration { app =>
|
||||||
val id = app.provider.id
|
val id = app.provider.id
|
||||||
val module = ModuleID(id.groupID, id.name, id.version, crossVersion = id.crossVersioned)
|
ModuleID(id.groupID, id.name, id.version, crossVersion = id.crossVersioned)
|
||||||
IvyActions.transitiveScratch(is, pid, "sbt", module :: Nil, classifiers, c, ivyScala)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -688,15 +697,6 @@ object Classpaths
|
||||||
def allJars(cr: ConfigurationReport): Seq[File] = cr.modules.values.toSeq.flatMap(mr => allJars(mr.artifacts))
|
def allJars(cr: ConfigurationReport): Seq[File] = cr.modules.values.toSeq.flatMap(mr => allJars(mr.artifacts))
|
||||||
def allJars(as: Iterable[(Artifact,File)]): Iterable[File] = as collect { case (a, f) if isJar(a) => f }
|
def allJars(as: Iterable[(Artifact,File)]): Iterable[File] = as collect { case (a, f) if isJar(a) => f }
|
||||||
def isJar(a: Artifact): Boolean = a.`type` == "jar"
|
def isJar(a: Artifact): Boolean = a.`type` == "jar"
|
||||||
}
|
|
||||||
trait Defaults
|
|
||||||
{
|
|
||||||
def addSbtDependency: Setting[Seq[ModuleID]] =
|
|
||||||
libraryDependencies <<= (libraryDependencies, appConfiguration) { (libs, app) =>
|
|
||||||
val id = app.provider.id
|
|
||||||
libs :+ ModuleID(id.groupID, id.name, id.version, crossVersion = true)
|
|
||||||
}
|
|
||||||
|
|
||||||
def addSbtRepository: Setting[Seq[Resolver]] =
|
lazy val dbResolver = Resolver.url("sbt-db", new URL("http://databinder.net/repo/"))(Resolver.ivyStylePatterns)
|
||||||
resolvers += Resolver.url("sbt-db", new URL("http://databinder.net/repo/"))(Resolver.ivyStylePatterns)
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -195,7 +195,10 @@ object Keys
|
||||||
val autoUpdate = SettingKey[Boolean]("auto-update")
|
val autoUpdate = SettingKey[Boolean]("auto-update")
|
||||||
val retrieveManaged = SettingKey[Boolean]("retrieve-managed")
|
val retrieveManaged = SettingKey[Boolean]("retrieve-managed")
|
||||||
val managedDirectory = SettingKey[File]("managed-directory")
|
val managedDirectory = SettingKey[File]("managed-directory")
|
||||||
|
|
||||||
|
val sbtResolver = SettingKey[Resolver]("sbt-resolver")
|
||||||
|
val sbtDependency = SettingKey[ModuleID]("sbt-dependency")
|
||||||
|
|
||||||
// special
|
// special
|
||||||
val settings = TaskKey[Settings[Scope]]("settings")
|
val settings = TaskKey[Settings[Scope]]("settings")
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* sbt -- Simple Build Tool
|
/* sbt -- Simple Build Tool
|
||||||
* Copyright 2010 Mark Harrah
|
* Copyright 2010 Mark Harrah
|
||||||
*/
|
*/
|
||||||
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra with sbt.ProjectConstructors with sbt.Defaults
|
package object sbt extends sbt.std.TaskExtra with sbt.Types with sbt.ProcessExtra with sbt.impl.DependencyBuilders with sbt.PathExtra with sbt.ProjectConstructors
|
||||||
{
|
{
|
||||||
type Setting[T] = Project.Setting[T]
|
type Setting[T] = Project.Setting[T]
|
||||||
type ScopedKey[T] = Project.ScopedKey[T]
|
type ScopedKey[T] = Project.ScopedKey[T]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue