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

Publish Scala 3 artifacts #3035

Open
guizmaii opened this issue Jan 7, 2022 · 2 comments
Open

Publish Scala 3 artifacts #3035

guizmaii opened this issue Jan 7, 2022 · 2 comments
Assignees

Comments

@guizmaii
Copy link

guizmaii commented Jan 7, 2022

Hi,

Caliban (https://github.com/ghostdogpr/caliban) is using scalafmt-dynamic as a dependency of some of its modules and because scalafmt is not published for Scala 3 it creates issues (ghostdogpr/caliban#1239)

Do you think it would be possible for you to publish scalafmt artifacts for Scala3?

Cheers,
Jules :)

@guizmaii guizmaii changed the title Support Scala 3 Publish Scala 3 artifacts Jan 7, 2022
@olafurpg
Copy link
Member

olafurpg commented Jan 7, 2022

@guizmaii thank you for reporting! As a workaround, it should be possible to only depend on scalafmt-interfaces and dynamically classload scalafmt-dynamic. I believe this is what the Gradle spotless integration does to avoid a direct dependency on scalafmt-dynamic. You can use coursier-interface to dynamically download scalafmt-dynamic.

I haven’t looked at what is needed to cross-compile scalafmt-dynamic with Scala 3 but it should be relatively easy since it doesn’t depend on Scalameta (which has no Scala 3 artifact)

@sfali23
Copy link

sfali23 commented Nov 28, 2024

You also should be able to do following as well

def isScala3: Def.Initialize[Boolean] = Def.setting[Boolean](scalaVersion.value.startsWith("3."))
libraryDependencies ++= {
      Seq(
        if (isScala3.value) "org.scalameta" %% "scalafmt-dynamic" % "3.8.3" cross CrossVersion.for3Use2_13
        else "org.scalameta" %% "scalafmt-dynamic" % "3.8.3"
      )
    }

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

No branches or pull requests

5 participants