Merge pull request #5094 from eed3si9n/wip/meta_resolvers

add includePluginResolvers
This commit is contained in:
eugene yokota 2019-09-19 12:41:20 -04:00 committed by GitHub
commit 29ea7ee6fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 2 deletions

View File

@ -2175,6 +2175,7 @@ object Classpaths {
moduleConfigurations :== Nil,
publishTo :== None,
resolvers :== Vector.empty,
includePluginResolvers :== false,
useJCenter :== false,
retrievePattern :== Resolver.defaultRetrievePattern,
transitiveClassifiers :== Seq(SourceClassifier, DocClassifier),
@ -2247,10 +2248,21 @@ object Classpaths {
(Def.task {
val proj = projectResolver.value
val rs = externalResolvers.value
def pluginResolvers: Vector[Resolver] =
buildStructure.value
.units(thisProjectRef.value.build)
.unit
.plugins
.pluginData
.resolvers
.getOrElse(Vector.empty)
val pr =
if (includePluginResolvers.value) pluginResolvers
else Vector.empty
bootResolvers.value match {
case Some(repos) if overrideBuildResolvers.value => proj +: repos
case _ =>
val base = if (sbtPlugin.value) sbtResolvers.value ++ rs else rs
val base = if (sbtPlugin.value) sbtResolvers.value ++ rs ++ pr else rs ++ pr
(proj +: base).distinct
}
}).value,

View File

@ -412,7 +412,8 @@ object Keys {
val fullResolvers = taskKey[Seq[Resolver]]("Combines the project resolver, default resolvers, and user-defined resolvers.").withRank(CTask)
val otherResolvers = taskKey[Seq[Resolver]]("Resolvers not included in the main resolver chain, such as those in module configurations.").withRank(CSetting)
val scalaCompilerBridgeResolvers = taskKey[Seq[Resolver]]("Resolvers used to resolve compiler bridges.").withRank(CSetting)
val useJCenter = settingKey[Boolean]("Use JCenter as the default repository.").withRank(BSetting)
val includePluginResolvers = settingKey[Boolean]("Include the resolvers from the metabuild.").withRank(CSetting)
val useJCenter = settingKey[Boolean]("Use JCenter as the default repository.").withRank(CSetting)
val moduleConfigurations = settingKey[Seq[ModuleConfiguration]]("Defines module configurations, which override resolvers on a per-module basis.").withRank(BMinusSetting)
val retrievePattern = settingKey[String]("Pattern used to retrieve managed dependencies to the current build.").withRank(DSetting)
val retrieveConfiguration = settingKey[Option[RetrieveConfiguration]]("Configures retrieving dependencies to the current build.").withRank(DSetting)

View File

@ -0,0 +1,7 @@
lazy val check = taskKey[Unit]("")
ThisBuild / includePluginResolvers := true
check := {
val rs = fullResolvers.value
assert(rs exists (_.name == "bintray-eed3si9n-sbt-plugins"), s"$rs does not include bintray")
}

View File

@ -0,0 +1 @@
resolvers += Resolver.bintrayRepo("eed3si9n", "sbt-plugins")

View File

@ -0,0 +1 @@
> check