portable-scala-reflect icon indicating copy to clipboard operation
portable-scala-reflect copied to clipboard

Upgrade Scala Native to 0.5.1

Open xerial opened this issue 10 months ago • 3 comments

Upgrade Scala Native to 0.5.1.

  • Upgrade to sbt 1.9.9 to pass compilation
  • [breaking] Dropped Scala 2.11.12, which is no longer supported in Scala Native and Scala.js
  • Upgraded sbt-scalajs-crossproject (-native) to the latest version 1.3.2

Ideally, Scala 3 should be supported. However, since the macro-based JVM code needs to be rewritten for Scala 3, it is not included in this PR.

xerial avatar Apr 19 '24 23:04 xerial

CI failures include:

  • MiMA errors due to the missing first release for Scala Native 0.5.x. I think we can ignore these errors.
  • Scala.js 0.6.x support. I also feel it's safe to drop Scala.js 0.6.x support now that 1.x series has been used for years.

xerial avatar Apr 20 '24 05:04 xerial

* MiMA errors due to the missing first release for Scala Native 0.5.x. I think we can ignore these errors.

I think you can set a previous release missing somehow so that doesn't error - that might just be sbt-typelevel that has that feature but maybe you could copy.

ekrich avatar May 09 '24 01:05 ekrich

@ekrich Thanks for the hint! Ignoring a specific version worked by setting empty to mimaPreviousArtifacts

xerial avatar May 09 '24 04:05 xerial

Hello @sjrd @gzm0 , could we please get review on this PR? :pray: It will unblock the rollout of Scala Native 0.5.x :rocket:

sideeffffect avatar May 11 '24 00:05 sideeffffect

Sorry for the delay here: I'm insufficiently familiar with the relevant parts of the ecosystem to be sure to make the right version judgments here.

However: If we drop support for things, we need to bump the major version. Is this necessary to support Scala Native or can we do without? Because in the latter case, I do not think we should do it just because.

gzm0 avatar May 17 '24 15:05 gzm0

@gzm0 if I understand the PR correctly, we're dropping only support (cross-compilation target) for an old version of Scala (2.11). That shouldn't require a major bump release.

The code of the library is perfectly backwards compatible.

sideeffffect avatar May 17 '24 15:05 sideeffffect

The code of the library is perfectly backwards compatible.

That's irrelevant. If you do not publish it a Scala 2.11 cannot use it anymore. Scala 2 libraries need to be published for the minor Scala version. A library published for 2.11 cannot be used with 2.12 and vv.

gzm0 avatar May 17 '24 15:05 gzm0

Actually, a similar comment applies to Scala native itself: How are libraries published for Scala native 0.5.x and Scala native 0.4.x published? If they are not compatible, we should probably cross compile & publish for Scala native 0.4.x and 0.5.x.

gzm0 avatar May 17 '24 15:05 gzm0

If you do not publish it a Scala 2.11 cannot use it anymore. Scala 2 libraries need to be published for the minor Scala version. A library published for 2.11 cannot be used with 2.12 and vv.

Yes. All of this is true, no disagreement there.

But at the same time, this doesn't warrant major bump of the library in question. At least it didn't warrant for any libraries which dropped Scala 2.11 and Native 0.4.x and adopted Native 0.5.x. E.g. com-lihaoyi has already migrated to 0.5.x: https://github.com/orgs/com-lihaoyi/discussions/1

  • https://index.scala-lang.org/com-lihaoyi/geny/artifacts/geny
  • https://index.scala-lang.org/com-lihaoyi/utest/artifacts/utest

No major bump.

we should probably cross compile & publish for Scala native 0.4.x and 0.5.x

Nobody does that from what I've seen. Library developers stop cross-compiling to 0.4.x and start cross-compiling to 0.5.x in one commit/PR.

sideeffffect avatar May 17 '24 15:05 sideeffffect

I agree with @sideeffffect on the versioning aspect. We need a major version bump if we fragment the ecosystem. That is true only if the things which are still supported are incompatible with previous versions. A library that still supports 2.11 will always be able to stay on the old version, because it could not possibly depend on the third library requiring the new version of portable-scala-reflect (because such a new version would not exist for 2.11).

Here I think a minor version bump would be enough.

That said, I don't think I understand why it is even necessary to drop any support here? It seems we could keep expanding our build matrix instead, as we usually do?

sjrd avatar May 17 '24 16:05 sjrd

why it is even necessary to drop any support here? It seems we could keep expanding our build matrix instead, as we usually do?

Of course, that's entirely possible. But it's just more load on library maintainers (which in this case is you guys :heart: ). And in practice people don't do that. This library also isn't cross-compiled to Scala.js 0.6.x. And the consensus in the Scala Native community is also dropping 0.4.x immediately (see com-lihaoyi above).

But if that's what you'd prefer, I'm sure that wouldn't be a problem, the PR can accommodate this approach.

sideeffffect avatar May 17 '24 16:05 sideeffffect

FYI sttp, tapir and other SoftwareMill libs are also switching directly to 0.5.1 without a major version bump.

kciesielski avatar May 17 '24 16:05 kciesielski

MUnit took the approach where they moved to 0.5.x but manually released artifacts for 0.4.x (see: mvn and discussion) for a single version - it doesn't transitively force their users to update dependencies when they want to only want to change Scala Native version.

Not all libraries choose this, but if all of my dependencies did it, I would release 1 version for both 0.4 and 0.5 by hand, to make it easier on my users.

MateuszKubuszok avatar May 24 '24 16:05 MateuszKubuszok

OK. I think I understand now why we do not need a major version bump to drop support for cross versioned things: The version is mostly relevant on the artifacts and not on the git repository itself. So for things we drop support, an artifact with the new version simply doesn't exist.

  • So whether to cross publish to native 0.4.x is probably best left up to the native core maintainers.
  • IMO we should not drop support for things we don't have to in this PR.
  • Does the sbt version bump force a downstream bump? If yes, do we need a minor bump?

gzm0 avatar May 27 '24 07:05 gzm0

Does the sbt version bump force a downstream bump?

Not at all.

sideeffffect avatar May 28 '24 10:05 sideeffffect

Is there any think blocking this PR? If yes, how can I help moving it forward? There's a lot of interest in getting this merged and released, because of lot of transitive dependents this project has.

sideeffffect avatar May 30 '24 13:05 sideeffffect

IMO we should not drop support for things we don't have to in this PR.

Basically this PR changes too much. If you do not want to wait on @xerial , I suggest opening a new, minimal PR.

gzm0 avatar May 30 '24 15:05 gzm0

I'll try making an alternative tomorrow that only adds support without breaking anything.

sjrd avatar May 30 '24 16:05 sjrd

@gzm0 what do you mean? I see only changes in sbt setting to enable Scala Native 0.5.x. What changes do you think should be left out?

sideeffffect avatar May 30 '24 17:05 sideeffffect

@sjrd FYI. The only reason I needed to drop Scala.js 0.6.x support is due to this missing dependency error:

[warn] 	Note: Unresolved dependencies path:
[error] sbt.librarymanagement.ResolveException: Error downloading org.scala-js:scalajs-compiler_2.12.19:0.6.33
[error]   Not found
[error]   Not found
[error]   not found: /home/runner/.ivy2/localorg.scala-js/scalajs-compiler_2.12.19/0.6.33/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.12.19/0.6.33/scalajs-compiler_2.12.19-0.6.33.pom
[error] 	at lmcoursier.CoursierDependencyResolution.unresolvedWarningOrThrow(CoursierDependencyResolution.scala:344)
[error] 	at lmcoursier.CoursierDependencyResolution.$anonfun$update$38(CoursierDependencyResolution.scala:[31](https://github.com/portable-scala/portable-scala-reflect/actions/runs/8760907044/job/24050014845#step:5:32)3)
[error] 	at scala.util.Either$LeftProjection.map(Either.scala:573)
[error] 	at lmcoursier.CoursierDependencyResolution.update(CoursierDependencyResolution.scala:313)
[error] 	at sbt.librarymanagement.DependencyResolution.update(DependencyResolution.scala:60)
[error] 	at sbt.internal.LibraryManagement$.resolve$1(LibraryManagement.scala:60)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$12(LibraryManagement.scala:134)
[error] 	at sbt.util.Tracked$.$anonfun$lastOutput$1(Tracked.scala:74)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$20(LibraryManagement.scala:147)
[error] 	at scala.util.control.Exception$Catch.apply(Exception.scala:228)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11(LibraryManagement.scala:147)
[error] 	at sbt.internal.LibraryManagement$.$anonfun$cachedUpdate$11$adapted(LibraryManagement.scala:128)
[error] 	at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:220)
[error] 	at sbt.internal.LibraryManagement$.cachedUpdate(LibraryManagement.scala:161)
[error] 	at sbt.Classpaths$.$anonfun$updateTask0$1(Defaults.scala:3801)
[error] 	at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] 	at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error] 	at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error] 	at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error] 	at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error] 	at sbt.Execute.work(Execute.scala:292)
[error] 	at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error] 	at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] 	at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (portable-scala-reflectJS / update) sbt.librarymanagement.ResolveException: Error downloading org.scala-js:scalajs-compiler_2.12.19:0.6.[33](https://github.com/portable-scala/portable-scala-reflect/actions/runs/8760907044/job/24050014845#step:5:34)
[error]   Not found
[error]   Not found
[error]   not found: /home/runner/.ivy2/localorg.scala-js/scalajs-compiler_2.12.19/0.6.33/ivys/ivy.xml
[error]   not found: https://repo1.maven.org/maven2/org/scala-js/scalajs-compiler_2.12.19/0.6.33/scalajs-compiler_2.12.19-0.6.33.pom

https://github.com/portable-scala/portable-scala-reflect/actions/runs/8760907044/job/24050014845

xerial avatar May 31 '24 00:05 xerial

Superseded by #49 and other PRs that came before it. Thanks for pushing us in the right direction.

Version 1.1.3 is now on Maven Central with Scala Native 0.5.x support (and everything else that was supported in 1.1.2).

sjrd avatar May 31 '24 16:05 sjrd