Merge pull request #2481 from eed3si9n/fport/2467

FPORT: Make JCenter opt in and Actually reorganize appResolvers
This commit is contained in:
eugene yokota 2016-02-26 17:02:03 -05:00
commit 4da7486dd8
10 changed files with 47 additions and 9 deletions

View File

@ -12,7 +12,6 @@
[repositories]
local
jcenter: https://jcenter.bintray.com/
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly

View File

@ -1148,6 +1148,7 @@ object Classpaths {
moduleConfigurations :== Nil,
publishTo :== None,
resolvers :== Nil,
useJCenter :== false,
retrievePattern :== Resolver.defaultRetrievePattern,
transitiveClassifiers :== Seq(SourceClassifier, DocClassifier),
sourceArtifactTypes :== Artifact.DefaultSourceTypes,
@ -1174,12 +1175,16 @@ object Classpaths {
organizationHomepage <<= organizationHomepage or homepage,
projectInfo <<= (name, description, homepage, startYear, licenses, organizationName, organizationHomepage, scmInfo, developers) apply ModuleInfo,
overrideBuildResolvers <<= appConfiguration(isOverrideRepositories),
externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers) {
case (Some(delegated), Seq(), _) => delegated
case (_, rs, Some(ars)) => task { ars ++ rs } // TODO - Do we need to filter out duplicates?
case (_, rs, _) => task { Resolver.withDefaultResolvers(rs) }
externalResolvers <<= (externalResolvers.task.?, resolvers, appResolvers, useJCenter) {
case (Some(delegated), Seq(), _, _) => delegated
case (_, rs, Some(ars), uj) => task { ars ++ rs }
case (_, rs, _, uj) => task { Resolver.withDefaultResolvers(rs, uj, true) }
},
appResolvers := {
val ac = appConfiguration.value
val uj = useJCenter.value
appRepositories(ac) map { ars => Resolver.reorganizeAppResolvers(ars, uj, true) }
},
appResolvers <<= appConfiguration apply appRepositories,
bootResolvers <<= appConfiguration map bootRepositories,
fullResolvers <<= (projectResolver, externalResolvers, sbtPlugin, sbtResolver, bootResolvers, overrideBuildResolvers) map { (proj, rs, isPlugin, sbtr, boot, overrideFlag) =>
boot match {

View File

@ -345,6 +345,7 @@ object Keys {
val projectResolver = TaskKey[Resolver]("project-resolver", "Resolver that handles inter-project dependencies.", DTask)
val fullResolvers = TaskKey[Seq[Resolver]]("full-resolvers", "Combines the project resolver, default resolvers, and user-defined resolvers.", CTask)
val otherResolvers = SettingKey[Seq[Resolver]]("other-resolvers", "Resolvers not included in the main resolver chain, such as those in module configurations.", CSetting)
val useJCenter = SettingKey[Boolean]("use-jcenter", "Use JCenter as the default repository.", BSetting)
val moduleConfigurations = SettingKey[Seq[ModuleConfiguration]]("module-configurations", "Defines module configurations, which override resolvers on a per-module basis.", BMinusSetting)
val retrievePattern = SettingKey[String]("retrieve-pattern", "Pattern used to retrieve managed dependencies to the current build.", DSetting)
val retrieveConfiguration = SettingKey[Option[RetrieveConfiguration]]("retrieve-configuration", "Configures retrieving dependencies to the current build.", DSetting)

View File

@ -0,0 +1,7 @@
[@eed3si9n]: https://github.com/eed3si9n
[2217]: https://github.com/sbt/sbt/issues/2217
### Fixes with compatibility implications
- sbt 0.13.10 adds a new setting `useJCenter`, which is set to `false` by default. When set to `true`, JCenter will be placed as the first external resolver to find library dependencies. [#2217][2217] by [@eed3si9n][@eed3si9n]

View File

@ -51,12 +51,14 @@
[2046]: https://github.com/sbt/sbt/issues/2046
[2097]: https://github.com/sbt/sbt/pull/2097
[2129]: https://github.com/sbt/sbt/pull/2129
[1938]: https://github.com/sbt/sbt/pull/1938
### Fixes with compatibility implications
- Starting 0.13.9, `crossScalaVersions` default value is fixed back to the older 0.12.x behavior. See below for details.
- Starting 0.13.9, the generated POM files no longer include dependencies on source or javadoc jars obtained via `withSources()` or `withJavadoc()`. See below for details.
- Scala version is bumped to 2.10.5. This brings in the fix for [SI-9027][SI9027]: XML node sequence literal bug. [#1666][1666]/[#2068][2068] by [@eed3si9n][@eed3si9n]
- Change launcher configuration so [JCenter](https://bintray.com/bintray/jcenter) is looked at first before all other external repositories. [#1938][1938]
### Improvements

View File

@ -0,0 +1,16 @@
lazy val check = taskKey[Unit]("")
lazy val check2 = taskKey[Unit]("")
lazy val root = (project in file(".")).
settings(
check := {
val fr = fullResolvers.value
assert(!(fr exists { _.name == "jcenter" }))
assert(fr exists { _.name == "public" })
},
check2 := {
val fr = fullResolvers.value
assert(fr exists { _.name == "jcenter" })
assert(fr exists { _.name == "public" })
}
)

View File

@ -0,0 +1,11 @@
> check
> set useJCenter := true
> check2
> reload
> set resolvers += Resolver.jcenterRepo
> check2

View File

@ -12,7 +12,6 @@
[repositories]
local
jcenter: https://jcenter.bintray.com/
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly

View File

@ -12,7 +12,6 @@
[repositories]
local
jcenter: https://jcenter.bintray.com/
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly

View File

@ -12,7 +12,6 @@
[repositories]
local
jcenter: https://jcenter.bintray.com/
maven-central
typesafe-ivy-releases: https://repo.typesafe.com/typesafe/ivy-releases/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly
sbt-ivy-snapshots: https://repo.scala-sbt.org/scalasbt/ivy-snapshots/, [organization]/[module]/[revision]/[type]s/[artifact](-[classifier]).[ext], bootOnly