Merge pull request #2662 from dwijnand/publishTo-TaskKey

[sbt 1.0] Make publishTo & otherResolvers TaskKey's
This commit is contained in:
eugene yokota 2016-09-29 01:43:36 -04:00 committed by GitHub
commit 87ef5287f6
3 changed files with 22 additions and 14 deletions

View File

@ -357,7 +357,7 @@ object Keys {
val resolvers = SettingKey[Seq[Resolver]]("resolvers", "The user-defined additional resolvers for automatically managed dependencies.", BMinusTask)
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 otherResolvers = TaskKey[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)
@ -374,7 +374,7 @@ object Keys {
val ivyScala = SettingKey[Option[IvyScala]]("ivy-scala", "Configures how Scala dependencies are checked, filtered, and injected.", CSetting)
val ivyValidate = SettingKey[Boolean]("ivy-validate", "Enables/disables Ivy validation of module metadata.", BSetting)
val ivyLoggingLevel = SettingKey[UpdateLogging.Value]("ivy-logging-level", "The logging level for updating.", BSetting)
val publishTo = SettingKey[Option[Resolver]]("publish-to", "The resolver to publish to.", ASetting)
val publishTo = TaskKey[Option[Resolver]]("publish-to", "The resolver to publish to.", ASetting)
val artifacts = SettingKey[Seq[Artifact]]("artifacts", "The artifact definitions for the current module. Must be consistent with " + packagedArtifacts.key.label + ".", BSetting)
val projectDescriptors = TaskKey[Map[ModuleRevisionId, ModuleDescriptor]]("project-descriptors", "Project dependency map for the inter-project resolver.", DTask)
val autoUpdate = SettingKey[Boolean]("auto-update", "<unimplemented>", Invisible)

View File

@ -0,0 +1,12 @@
[@dwijnand]: https://github.com/dwijnand
[2059]: https://github.com/sbt/sbt/issues/2059
[2662]: https://github.com/sbt/sbt/pull/2662
### Fixes with compatibility implications
### Improvements
- Changes publishTo & otherResolvers from SettingKey's to TaskKey's. [#2059][2059]/[#2662][2662] by [@dwijnand][@dwijnand]
### Bug fixes

View File

@ -2,7 +2,7 @@ def customIvyPaths: Seq[Def.Setting[_]] = Seq(
ivyPaths := new IvyPaths((baseDirectory in ThisBuild).value, Some((baseDirectory in ThisBuild).value / "ivy-cache"))
)
lazy val sharedResolver =
lazy val sharedResolver: Resolver =
Resolver.defaultShared.nonlocal()
//MavenRepository("example-shared-repo", "file:///tmp/shared-maven-repo-bad-example")
//Resolver.file("example-shared-repo", repoDir)(Resolver.defaultPatterns)
@ -15,16 +15,12 @@ lazy val common = project.
version := "1.0-SNAPSHOT",
publishTo := Some(sharedResolver),
crossVersion := CrossVersion.Disabled,
publishMavenStyle := (publishTo.value match {
case Some(repo) =>
repo match {
case repo: PatternsBasedRepository => repo.patterns.isMavenCompatible
case _: RawRepository => false // TODO - look deeper
case _: MavenRepository => true
case _: MavenCache => true
case _ => false // TODO - Handle chain repository?
}
case _ => true
publishMavenStyle := (sharedResolver match {
case repo: PatternsBasedRepository => repo.patterns.isMavenCompatible
case _: RawRepository => false // TODO - look deeper
case _: MavenRepository => true
case _: MavenCache => true
case _ => false // TODO - Handle chain repository?
})
// updateOptions := updateOptions.value.withLatestSnapshots(true)
)
@ -47,4 +43,4 @@ TaskKey[Unit]("dumpResolvers") := {
(fullResolvers in dependent).value foreach { r =>
streams.value.log.info(s" * ${r}")
}
}
}