Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CrossVersion.Disabled compat #280

Merged
merged 1 commit into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,12 @@ lazy val lmCore = (project in file("core"))
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ArtifactExtra.extension"),
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.ArtifactTypeFilterExtra.types"),

// by mistake we aliased the companion object instead of an instance of Disabled
// but it was aliased as a constant expression, so even if the binary API has changed
// there are no call sites in bytecode because the value got inlined
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More precisely "constant folded" not "inlined".

// also it's wouldn't work so I doubt anyone has made use of it
exclude[DirectMissingMethodProblem]("sbt.librarymanagement.CrossVersionFunctions.Disabled"),

// contraband issue
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.ConfigurationReportLite.copy*"),
exclude[DirectMissingMethodProblem]("sbt.internal.librarymanagement.UpdateReportLite.copy*"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ final case class ScalaVersion(full: String, binary: String)
private[librarymanagement] abstract class CrossVersionFunctions {

/** Compatibility with 0.13 */
final val Disabled = sbt.librarymanagement.Disabled
final val Disabled = sbt.librarymanagement.Disabled()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The corresponding construct in sbt 0.13 https://github.com/sbt/sbt-zero-thirteen/blob/v0.13.17/ivy/src/main/scala/sbt/CrossVersion.scala#L19:

  object Disabled extends CrossVersion { override def toString = "disabled" }

so the above change could be considered valid for source compat with sbt 0.13, but in general we probably should recommend migrating to lowercase CrossVersion.disabled.

final val Binary = sbt.librarymanagement.Binary
final val Constant = sbt.librarymanagement.Constant
final val Full = sbt.librarymanagement.Full
Expand Down Expand Up @@ -37,7 +37,7 @@ private[librarymanagement] abstract class CrossVersionFunctions {
def binary: CrossVersion = Binary()

/** Disables cross versioning for a module. */
def disabled: CrossVersion = Disabled()
def disabled: CrossVersion = Disabled

/** Cross-versions a module with a constant string (typically the binary Scala version). */
def constant(value: String): CrossVersion = Constant(value)
Expand Down