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

Release projects with different scala version #416

Open
ex0ns opened this issue Jun 7, 2024 · 0 comments
Open

Release projects with different scala version #416

ex0ns opened this issue Jun 7, 2024 · 0 comments

Comments

@ex0ns
Copy link

ex0ns commented Jun 7, 2024

I am trying to publish a sbt plugin (2.12) based on Scala.js as well as a scala.js library (3.3.3) from the same project, my setup is as follow

// build.sbt
import sbt._
import ReleaseTransformations._

lazy val scala2Version = "2.12.19"
lazy val scala3Version = "3.3.3"

lazy val lib = project
  .in(file("lib"))
  .settings(Test / fork := false)
  .settings(
    organization := "org.test",
    scalaVersion := scala3Version,
    crossScalaVersions := Seq(scala3Version),
    libraryDependencies ++= Seq(
      "com.raquo" %%% "laminar" % "17.0.0",
    ),
  )
  .enablePlugins(ScalaJSPlugin)

lazy val plugin = project
  .in(file("plugin"))
  .settings(
    Seq(
      scalaVersion := scala2Version,
      crossScalaVersions := Seq(scala2Version),
      sbtPlugin := true,
      addSbtPlugin(("org.scala-js" % "sbt-scalajs" % "1.16.0").cross(CrossVersion.constant(scala2Version))),
    )
  )


lazy val root = project
  .in(file("."))
  .aggregate(lib, plugin)
  .settings(
    // crossScalaVersions := Nil,
    publish / skip := true,
    // releaseCrossBuild := false,
    /* Quick hack so we can test release in local */
    publishTo := Some(Resolver.file("local-maven", file(Path.userHome.absolutePath + "/.m2/repository"))),
    // scalaVersion := scala2Version,
    releaseProcess := Seq[ReleaseStep](
      checkSnapshotDependencies
    )
  )

And

// plugins.sbt
addSbtPlugin("com.github.sbt" % "sbt-release" % "1.4.0")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0")

However if I try to run a sbt release cross, sbt is trying to fetch laminar for scala 2.12, which does not exist.

sbt:root> release cross with-defaults
[info] Setting scala version to 2.12.19
[info] set current project to root (in build file:/Users/ex0ns/Projects/test-sbt-release/)
[info] Updating lib_sjs1_2.12
https://repo1.maven.org/maven2/com/raquo/laminar_sjs1_2.13/17.0.0/laminar_sjs1_2.12-17.0.0.jar

I really don't get why lib would be published in 2.12.
I have tried a lot of different setup (with and without crossScala version, cross build and such), but I could not make this work.

I was able to narrow down the issue to checkSnapshotDependencies but I have no way to check that the steps after are not having the same issue as well.

https://github.com/sbt/sbt-release/blob/v1.4.0/src/main/scala/ReleaseExtra.scala#L17 is calling https://github.com/sbt/sbt-release/blob/v1.4.0/src/main/scala/ReleasePlugin.scala#L221

However I can't reproduce this error by simply calling root / Runtime / managedClasspath...

What did I miss here ?

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

No branches or pull requests

1 participant