mirror of https://github.com/sbt/sbt.git
make scala-tool an exception not the rule (#158)
Fixes https://github.com/coursier/coursier/issues/1442 Fixes https://github.com/coursier/coursier/issues/1340 Ref https://github.com/coursier/sbt-coursier/pull/136 This treats `ScalaTool` (and only `ScalaTool`) as a sandbox configuration isolated from other subprojects. Likely this behavior is needed only for `ScalaTool` configuration where the scala-xml build's `ScalaTool` configuration transitively loops back to scala-xml's `Compile` artifacts. In most other cases, it's desirable to allow "x->compile" relationship.
This commit is contained in:
parent
cb842cff67
commit
44de26435f
|
|
@ -19,13 +19,16 @@ object ResolutionRun {
|
|||
configs: Set[Configuration]
|
||||
): Either[coursier.error.ResolutionError, Resolution] = {
|
||||
|
||||
val isCompileConfig =
|
||||
configs(Configuration.compile)
|
||||
val isCompileOrScalaToolConfig =
|
||||
configs(Configuration.compile) || configs(Configuration("scala-tool"))
|
||||
val isScalaToolConfig = configs(Configuration("scala-tool"))
|
||||
// Ref coursier/coursier#1340 coursier/coursier#1442
|
||||
// This treats ScalaTool as a sandbox configuration isolated from other subprojects.
|
||||
// Likely this behavior is needed only for ScalaTool configuration where the scala-xml
|
||||
// build's ScalaTool configuration transitively loops back to scala-xml's Compile artifacts.
|
||||
// In most other cases, it's desirable to allow "x->compile" relationship.
|
||||
def isSandboxConfig: Boolean = isScalaToolConfig
|
||||
|
||||
val repositories =
|
||||
params.internalRepositories.drop(if (isCompileConfig) 0 else 1) ++
|
||||
params.internalRepositories.drop(if (isSandboxConfig) 1 else 0) ++
|
||||
params.mainRepositories ++
|
||||
params.fallbackDependenciesRepositories
|
||||
|
||||
|
|
@ -87,10 +90,10 @@ object ResolutionRun {
|
|||
.withResolutionParams(
|
||||
params
|
||||
.params
|
||||
.addForceVersion((if (isCompileConfig) params.interProjectDependencies.map(_.moduleVersion) else Nil): _*)
|
||||
.withForceScalaVersion(isCompileOrScalaToolConfig && params.autoScalaLibOpt.nonEmpty)
|
||||
.addForceVersion((if (isSandboxConfig) Nil else params.interProjectDependencies.map(_.moduleVersion)): _*)
|
||||
.withForceScalaVersion(params.autoScalaLibOpt.nonEmpty)
|
||||
.withScalaVersionOpt(params.autoScalaLibOpt.map(_._2))
|
||||
.withTypelevel(params.params.typelevel && isCompileOrScalaToolConfig)
|
||||
.withTypelevel(params.params.typelevel)
|
||||
.withRules(rules)
|
||||
)
|
||||
.withCache(
|
||||
|
|
|
|||
|
|
@ -30,3 +30,12 @@ lazy val b = project
|
|||
version := "0.0.1",
|
||||
libraryDependencies += "com.github.alexarchambault" %% "argonaut-shapeless_6.2" % "1.2.0-M11"
|
||||
)
|
||||
|
||||
lazy val c = project
|
||||
.dependsOn(b % Configurations.CompilerPlugin)
|
||||
.settings(sharedSettings)
|
||||
.settings(
|
||||
organization := "com.pany",
|
||||
name := "c",
|
||||
version := "0.0.1"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
$ delete output
|
||||
> b/run
|
||||
$ exists output
|
||||
> c/compile
|
||||
|
|
|
|||
Loading…
Reference in New Issue