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

support mix of launcherType in version overrides #2975

Merged
merged 7 commits into from May 6, 2024

Conversation

bishabosha
Copy link
Contributor

@bishabosha bishabosha commented May 2, 2024

needed for scala/scala3#20098 and VirtusLab/scala-cli#2838

enable a mixture of launcherType in version overrides, this allows to have a prebuilt scala launcher for 3.5.0+, and then bootstrap launcher for anything below to preserve backwards compatibility.

here is the proposed new scala.json app descriptor:

{
  "repositories": [
    "central"
  ],
  "dependencies": [
    "org.scala-lang:scala3-compiler_3:latest.stable"
  ],
  "name": "scala",
  "properties": {
    "scala.usejavacp": "true"
  },
  "versionOverrides": [
    {
      "versionRange": "(3.4.max,)",
      "launcherType": "prebuilt",
      "prebuilt": "zip+https://github.com/scala/scala3/releases/download/${version}/scala3-${version}.zip!scala3-${version}/bin/scala"
    },
    {
      "versionRange": "[3.1.0,3.4.max]",
      "mainClass": "dotty.tools.MainGenericRunner"
    },
    {
      "versionRange": "[3.0.0,3.0.2]",
      "mainClass": "dotty.tools.repl.Main"
    },
    {
      "versionRange": "(,2.max]",
      "dependencies": [
        "org.scala-lang:scala-compiler:latest.stable"
      ],
      "mainClass": "scala.tools.nsc.MainGenericRunner"
    }
  ]
}

we would actually have to update this app descriptor again when we want a true native launcher built by graalvm - but version overrides support that already.

cc/ @adpi2 @tgodzik @kasiaMarek @Gedochao @hamzaremmal

@bishabosha
Copy link
Contributor Author

Everyone involved, I added a field to AppDescriptor so I guess we should have a new minor release I put 2.2.0 in the since annotation, but is that right?

Copy link
Collaborator

@adpi2 adpi2 left a comment

Choose a reason for hiding this comment

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

LGTM

@bishabosha
Copy link
Contributor Author

bishabosha commented May 2, 2024

CI only fails due to macOS runner being arm64 - #2974

@alexarchambault
Copy link
Member

Everyone involved, I added a field to AppDescriptor so I guess we should have a new minor release I put 2.2.0 in the since annotation, but is that right?

Precisely, the @since annotation allows not to break binary compatibility upon field addition

@bishabosha bishabosha force-pushed the version-overrides-launcherType branch from 16c6684 to 0538b94 Compare May 3, 2024 07:38
// for a prebuilt launcher, we expect the path of the launcher to appear somewhere in the script
val scala3path = {
val original = "github.com/scala/scala3/releases/download/3.3.3/scala3-3.3.3.zip/scala3-3.3.3/bin/scala"
if (currentOs == "windows") original.replace('/', '\\')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use currentOs here because if ran from e.g. macOS then the Mac-formatted path will actually be in the launcher.

Copy link
Collaborator

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

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

LGTM from me, since it's needed for Scala CLI as Scala I am going to merge it and work on a release. Hopefully, this is not an issue @alexarchambault ?

Thanks @bishabosha !

@tgodzik tgodzik merged commit 82430eb into coursier:main May 6, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants