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

Bundle scala cli in scala command #20351

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

bishabosha
Copy link
Member

@bishabosha bishabosha commented May 7, 2024

fixes #20098

Proposed changes to zip/targz archive:

  • in the /bin directory store an extra launcher for Scala CLI (either JAR, or native per platform).
  • /bin/scala[.bat] is modified to invoke Scala CLI stored in /bin
  • new /maven2 directory, which stores all the Jars and POM files necessary (in maven repo style) for scala-cli to invoke scala compiler offline (using the -r launcher option).
  • CHOICE: either replace jar files in /lib by aliases to the corresponding jar in /maven2, OR delete /lib and update references from scripts. (Looks like symlinks are not portable, so probably we should encode the classpath in a file, or adjust slightly how we build the toolchain)
  • add platform specific suffixes to artefacts:
    • e.g. scala-3.5.0-x86_64-pc-linux.tar.gz (for the artefact that bundles the x64 linux launcher)

@Gedochao Gedochao requested a review from sjrd May 7, 2024 12:31
@Gedochao Gedochao added the needs-minor-release This PR cannot be merged until the next minor release label May 7, 2024
@bishabosha bishabosha added the release-notes Should be mentioned in the release notes label May 7, 2024
Copy link
Member

@sjrd sjrd left a comment

Choose a reason for hiding this comment

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

I can only comment on what's jumping at me. The timing is way too short to do a real review.

Even if I did find something it wouldn't get addressed and shipped in time at this point, so, to be blunt: why bother?

bin/scala Outdated Show resolved Hide resolved
compiler/test/dotty/tools/scripting/ClasspathTests.scala Outdated Show resolved Hide resolved
@bishabosha
Copy link
Member Author

bishabosha commented May 7, 2024

It appears that on windows a critical class is loaded on boot scala.build.internal.JniGetWinDirs which is compiled by JDK 16, so fails when loading from Java 8. But on Mac OS the jar launcher works fine on java 8 - could it be possible that just this one dependency has a misconfigured build?

Edit: We can not guarantee that the Jar-based launcher works on JDK 17, so this must be do-not-merge until we implement the native launchers

@He-Pin
Copy link

He-Pin commented May 10, 2024

A question is if a new scala-cli is released, will scala update it automatically, like cs update scala-cli?

@bishabosha
Copy link
Member Author

bishabosha commented May 10, 2024

A question is if a new scala-cli is released, will scala update it automatically, like cs update scala-cli?

The way it is currently implemented, the idea would be that each scala version is tied to a specific Scala CLI launcher. and Each scala release would come with whatever is the latest Scala CLI version at that moment

@He-Pin
Copy link

He-Pin commented May 15, 2024

  1. When do republishing , is there some kind of Sha or md5 checking ?
  2. Does Windows platform been well tested?

@bishabosha bishabosha force-pushed the bundle-scala-cli branch 7 times, most recently from cbcd575 to 46696d5 Compare May 21, 2024 14:55
@hamzaremmal
Copy link
Member


val baseVersion = "3.5.0-RC1"

val referenceVersion = "3.4.2-RC1"
Copy link

Choose a reason for hiding this comment

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

Is it right?

Copy link
Member Author

Choose a reason for hiding this comment

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

we need a rebase

@hamzaremmal hamzaremmal force-pushed the bundle-scala-cli branch 6 times, most recently from 9c3357f to 6c9e3f3 Compare May 23, 2024 08:42
@bishabosha bishabosha force-pushed the bundle-scala-cli branch 5 times, most recently from 455da81 to a1291b3 Compare May 29, 2024 15:50
@bishabosha
Copy link
Member Author

bishabosha commented May 29, 2024

@hamzaremmal this is everything that was agreed in the plan, except for deciding what to do about the lib directory - and maybe caching the task to populate the local maven2 repo with coursier - also that relies upon cleaning the repo but it seems ci does that anyway (multiple times)

We would also need to update the ci.yml to publish artefacts for each launcher - and the sdkman publishing, but perhaps that can be another PR?

@hamzaremmal
Copy link
Member

We would also need to update the ci.yml to publish artefacts for each launcher - and the sdkman publishing, but perhaps that can be another PR?

Yes, it should be in another PR with the changes to the launchers.yml workflow too. I will take care of it.

@bishabosha
Copy link
Member Author

oh right and we should squash when merging this one I think

@hamzaremmal
Copy link
Member

oh right and we should squash when merging this one I think

Definitely

@bishabosha
Copy link
Member Author

I have manually squashed the commits where it makes sense

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release release-notes Should be mentioned in the release notes stat:do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Scala CLI as the scala runner command
6 participants