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

Implement Scala CLI as the scala runner command #2838

Open
3 of 10 tasks
Gedochao opened this issue Apr 5, 2024 · 6 comments
Open
3 of 10 tasks

Implement Scala CLI as the scala runner command #2838

Gedochao opened this issue Apr 5, 2024 · 6 comments
Assignees
Labels
enhancement New feature or request installation Everything related to installing the CLI itself priority: high SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command.
Projects

Comments

@Gedochao
Copy link
Contributor

Gedochao commented Apr 5, 2024

Finally, the time has come to bring SIP-46 to a closure and implement Scala CLI as the official runner command for the Scala 3 compiler.

Corresponding compiler issue

Relevant docs

Requirements

  • set up downloading of Scala CLI JVM launcher from GitHub VirtusLab/scala-cli
  • download library dependencies to the dist/target/pack in maven repo style
  • fix scripts to wrap Scala CLI launcher, setting both the local repo and default scala version launcher options
    • update for windows (batch)
    • update for linux/mac (bash)
  • run any existing legacy (old) scala runner tests against the Scala CLI launcher on the scala/scala3 CI
  • use the Scala CLI launcher instead of the scala runner in official Scala 3 distributions
    • coursier
    • brew
    • SDKMAN

Potential follow-ups which are NOT included in this issue's scope

  • including platform-specific native installations of Scala CLI in Scala 3 official distribution channels
    • this should be done alongside native distribution of scalac, scaladoc etc
  • including Scala CLI in other Scala 3 installation methods (APT, winget, etc)
@Gedochao Gedochao added enhancement New feature or request installation Everything related to installing the CLI itself SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command. priority: high labels Apr 5, 2024
@Gedochao Gedochao added this to To do in Issue Board via automation Apr 5, 2024
@Gedochao Gedochao self-assigned this Apr 5, 2024
@bjornregnell
Copy link
Contributor

bjornregnell commented Apr 14, 2024

  • including Scala CLI in other Scala 3 installation methods (APT, winget, etc)

I think allowing a great Windows experience will help a lot. A vast majority of students coming to Lund University to learn Computer Science have windows laptops. I think making the new scala available as an .msi as well as using winget and choco is the way to go if I should judge from how my 150+ students last fall with windows would like to install it.

Allowing apt (or snap --classic) will also help those with WSL2 but WSL-users are still a minority among beginner learners compared to "normal" Windows using Windows Terminal with powershell or cmd. Anayway i recommend students to use sdkman under WSL.

My priority order as a teacher of Scala as the fall semester of 2024 is approaching: .msi, winget, choco, sdk, apt, snap

@Gedochao
Copy link
Contributor Author

@bjornregnell don't get me wrong, having native platform installations for Scala CLI is the plan, but we want to do it in steps. I was merely establishing the scope to be covered in this ticket, so that we don't try to do everything all at once.

As Scala CLI will be distributed alongside the compiler, we would need to have all the scripts contained in the installation in sync. scalac, scaladoc, scalap... everything should get native packages and then get distributed as such on the correct platforms in the future.

For now, the Windows native distribution will still be available through the old installation methods of scala-cli. We won't be sunsetting those for the time (if at all).

@bjornregnell
Copy link
Contributor

bjornregnell commented Apr 16, 2024

having native platform installations for Scala CLI is the plan

Great! I also think it is really good if the scala-cli home page makes the soon "old" scala-cli still to be easily installable under that executable name for all those who are stuck on old Scala versions, so they can use their old scala runner together with scala-cli. (Although beginner cs students rarely come with any Scala on their machine.)

Even if professional devs most often use some kind of Linux, I believe a vast majority of beginner students in cs at universities come with Windows 10/11 on their laptops, and they might not be seasoned in tricky install procedures of java+scala. So making the Windows UX top-notch for beginners is important IMHO.

If we can make it a one-click-install-everything on Windows with an -msi (perhaps it can check for and also install a JDK if needed?) students will be happy. (Most hard troubles I seen on students' machines is them having e.g. corrupted or no JAVAHOME, multiple conflicting JDK versions, an old Oracle entry in the registry incompatible with their User Path etc etc and they have no clue why it does not "just work"...).

@bishabosha
Copy link
Contributor

bishabosha commented Apr 29, 2024

@kasiaMarek @tgodzik do you know how the special name handling for scala-experimental works in error messages? (so the command name renders as scala not scala-cli)

currently our solution of bash script wrapper of java --jar scala-cli.jar is rendering the command in error message as scala-cli, e.g.

dist/target/pack/bin/scala foo
[error]  foo is not a scala-cli sub-command and it is not a valid path to an input file or directory.
Try viewing the relevant help to see the list of available sub-commands and options.
  scala-cli --help

@tgodzik
Copy link
Member

tgodzik commented Apr 30, 2024

I think that might be hardcoded, we might need to change that.

@bishabosha
Copy link
Contributor

bishabosha commented Apr 30, 2024

I think that might be hardcoded, we might need to change that.

@tgodzik @kasiaMarek

val progName = {
val argv0 = (new Argv0).get("scala-cli")
val last = Paths.get(argv0).getFileName.toString
last match {
case s".${name}.aux" =>
name // cs installs binaries under .app-name.aux and adds them to the PATH
case _ => argv0
}
}

yeah it looks unavoidable- (new Argv0).get("scala-cli") will always return "scala-cli" on JVM - only native launchers override Argv0

it would be good to have a way to change the name to "scala" on JVM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request installation Everything related to installing the CLI itself priority: high SIP-46 All the issues related to SIP-46 to turn Scala CLI into the official scala runner command.
Projects
Issue Board
In progress
Development

No branches or pull requests

4 participants