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

Use closest previous version when looking for stable Scala versions #1032

Conversation

alexarchambault
Copy link
Contributor

This should allow not to have to update https://github.com/VirtusLab/scala-cli-scala-versions/blob/main/scala-versions-v1.json upon each release. This file only needs to be updated when new Scala versions are released (and known to be supported by Scala CLI).

Copy link
Contributor

@lwronski lwronski left a comment

Choose a reason for hiding this comment

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

For me, only the unit test is missing, the rest LGTM

a unit test might look like this:

val confFile = s"""[
                    | {
                    |  "scalaCliVersion": "0.1.0",
                    |  "supportedScalaVersions": ["3.0.1", "2.13.4", "2.12.13"]
                    | }
                    |]""".stripMargin

 test(s"Use closest previous version when looking for stable Scala versions") {
    TestInputs.withTmpDir("conf-scala-versions") { dirPath =>

      val confFilePath = dirPath / "conf-file.json"
      os.write(confFilePath, confFile)

      val options = BuildOptions(
        scalaOptions = ScalaOptions(
          scalaVersion = Some(MaybeScalaVersion("3")),
          scalaBinaryVersion = None,
          supportedScalaVersionsUrl = Some(s"file://${confFile2.toString()}")
        )
      )

      val scalaParams          = options.scalaParams.orThrow.getOrElse(???)
      val expectedScalaVersion = "3.0.1"
      val expectedScalaParams  = ScalaParameters(expectedScalaVersion)

      expect(scalaParams == expectedScalaParams)
    }
  }

@alexarchambault alexarchambault force-pushed the latest-scala-cli-version-for-stable-scala-versions branch 2 times, most recently from e701bd5 to 075b1dd Compare May 23, 2022 13:47
- remove unnecessary None values
- more BuildOptions refacto
- better os.Path to URL string conversion in BuildOptionsTests
And use a custom Scala CLI version in the tests
@alexarchambault alexarchambault force-pushed the latest-scala-cli-version-for-stable-scala-versions branch from 075b1dd to 231eabf Compare May 23, 2022 16:32
@alexarchambault alexarchambault merged commit 2f4d46c into VirtusLab:main May 23, 2022
@alexarchambault alexarchambault added the internal Internal or build-related changes label May 25, 2022
@alexarchambault alexarchambault deleted the latest-scala-cli-version-for-stable-scala-versions branch July 14, 2022 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Internal or build-related changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants