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

scalaHome support is bitrotted, requires workaround to use with Scala 2.13 #7477

Open
SethTisue opened this issue Jan 18, 2024 · 1 comment
Labels

Comments

@SethTisue
Copy link
Member

SethTisue commented Jan 18, 2024

(and lord knows whether it works at all with Scala 3!)

If scalaHome didn't already exist, I'm not sure we would add it today, as it's not hard to just publishLocal from one's Scala 2 checkout (a method that I expect would also work for Scala 3).

I was able to get it partially working with Scala 2.13 by using a workaround, as follows.

I tried:

scalaVersion := "2.13.12"
scalaHome := Some(file("/Users/tisue/scala.213"))

(the doc is silent about how to handle scalaVersion, but we need to get the binary version right, at least; using e.g. 2.13.13-bin-SNAPSHOT" seems to work just as well)

but then console gives:

[error] (scalaInstance) sbt.internal.inc.InvalidScalaInstance: Scala instance doesn't exist or is invalid:  (library jar  /Users/tisue/scala.213/lib/scala-library.jar)

there is no such lib directory in a Scala 2.13 checkout, but after dist/mkPack, build/pack/lib/scala-library.jar exists, so I thought maybe ln -s build/pack/lib would fix it, and it does get past the first error

and it doesn't make console work:

java.lang.NoSuchMethodError: 'org.jline.utils.AttributedString org.jline.utils.AttributedString.fromAnsi(java.lang.String, java.util.List, java.lang.String, java.lang.String)'

but it does make compile and run work:

% cat S.scala
object Main extends App {
  println(s"hi there! ${scala.util.Properties.versionNumberString}")
}
% sbt run
[info] welcome to sbt 1.9.8 (Eclipse Adoptium Java 17.0.9)
[info] loading project definition from /Users/tisue/tmp/scalaHome/project
[info] loading settings for project scalahome from build.sbt ...
[info] set current project to scalahome (in build file:/Users/tisue/tmp/scalaHome/)
[info] running Main 
hi there! 2.13.13-20240118-035212-951cc9b

so, the support isn't as fully bitrotted as I'd feared!

anyway, opening this issue to document the current state, but who knows, someone might take an interest in fixing it, and/or perhaps even adding Scala 3 support

@SethTisue SethTisue added the Bug label Jan 18, 2024
@eed3si9n
Copy link
Member

@SethTisue Thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants