Include both explicit plugin resolves and boot resolvers

Fixes #4408
This commit is contained in:
Eugene Yokota 2018-10-06 16:50:40 -04:00
parent 4867e87eca
commit a9fd111143
1 changed files with 13 additions and 3 deletions

View File

@ -198,8 +198,9 @@ object Defaults extends BuildCommon {
scalaOrganization :== ScalaArtifacts.Organization, scalaOrganization :== ScalaArtifacts.Organization,
scalaArtifacts :== ScalaArtifacts.Artifacts, scalaArtifacts :== ScalaArtifacts.Artifacts,
sbtResolver := { sbtResolver := {
if (sbtVersion.value endsWith "-SNAPSHOT") Classpaths.sbtIvySnapshots val v = sbtVersion.value
else Classpaths.typesafeReleases if (v.endsWith("-SNAPSHOT") || v.contains("-bin-")) Classpaths.sbtMavenSnapshots
else Resolver.DefaultMavenRepository
}, },
crossVersion :== Disabled(), crossVersion :== Disabled(),
buildDependencies := Classpaths.constructBuildDependencies.value, buildDependencies := Classpaths.constructBuildDependencies.value,
@ -2289,13 +2290,20 @@ object Classpaths {
inTask(updateSbtClassifiers)( inTask(updateSbtClassifiers)(
Seq( Seq(
externalResolvers := { externalResolvers := {
val boot = bootResolvers.value
val explicit = buildStructure.value val explicit = buildStructure.value
.units(thisProjectRef.value.build) .units(thisProjectRef.value.build)
.unit .unit
.plugins .plugins
.pluginData .pluginData
.resolvers .resolvers
explicit orElse bootRepositories(appConfiguration.value) getOrElse externalResolvers.value // https://github.com/sbt/sbt/issues/4408
(explicit, boot) match {
case (Some(ex), Some(b)) => (ex.toVector ++ b.toVector).distinct
case (Some(ex), None) => ex
case (None, Some(b)) => b
case _ => externalResolvers.value
}
}, },
ivyConfiguration := InlineIvyConfiguration( ivyConfiguration := InlineIvyConfiguration(
paths = ivyPaths.value, paths = ivyPaths.value,
@ -3065,6 +3073,8 @@ object Classpaths {
val sbtIvySnapshots: URLRepository = Resolver.sbtIvyRepo("snapshots") val sbtIvySnapshots: URLRepository = Resolver.sbtIvyRepo("snapshots")
val typesafeReleases: URLRepository = Resolver.typesafeIvyRepo("releases") val typesafeReleases: URLRepository = Resolver.typesafeIvyRepo("releases")
val sbtPluginReleases: URLRepository = Resolver.sbtPluginRepo("releases") val sbtPluginReleases: URLRepository = Resolver.sbtPluginRepo("releases")
val sbtMavenSnapshots: MavenRepository =
MavenRepository("sbt-maven-snapshot", Resolver.SbtRepositoryRoot + "/" + "maven-snapshots/")
def modifyForPlugin(plugin: Boolean, dep: ModuleID): ModuleID = def modifyForPlugin(plugin: Boolean, dep: ModuleID): ModuleID =
if (plugin) dep.withConfigurations(Some(Provided.name)) else dep if (plugin) dep.withConfigurations(Some(Provided.name)) else dep