Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update Scala versions#381

Draft
Gedochao wants to merge 4 commits into
scalapy:mainfrom
Gedochao:maintenance/update-scala-versions
Draft

Update Scala versions#381
Gedochao wants to merge 4 commits into
scalapy:mainfrom
Gedochao:maintenance/update-scala-versions

Conversation

@Gedochao

@Gedochao Gedochao commented Apr 12, 2024

Copy link
Copy Markdown

Supersedes #380, #377, #376 and #370
Locks Scala 3 at the LTS (3.3.3 at this time)

@Gedochao Gedochao force-pushed the maintenance/update-scala-versions branch from 3e17e82 to 17523bf Compare April 12, 2024 07:04
@daenenk

daenenk commented Apr 15, 2024

Copy link
Copy Markdown

@Gedochao, I'm looking forward to try out scalapy on scala-native 0.5.0, so I had a look to your branch maintenance/update-scala-versions. When I start sbt I get the following

$ sbt -Dpath-to-my-python-exec
[info] welcome to sbt 1.9.8 (Oracle Corporation Java 22)
[info] loading settings for project scalapy-build from plugins.sbt ...
 . . .
~/scalapy/build.sbt:200: error: not found: value nativeLinkStubs
    nativeLinkStubs := true,
    ^
~/scalapy/build.sbt:201: error: not found: value nativeLinkingOptions
    nativeLinkingOptions ++= pythonLdFlags
    ^
~/scalapy/build.sbt:244: error: not found: value nativeLinkingOptions
    nativeLinkingOptions ++= pythonLdFlags,
    ^
~/scalapy/build.sbt:245: error: not found: value nativeMode
    nativeMode := "release-fast"
    ^
sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression

Could this be related to the fact that the list of "Sbt settings and tasks" has been shortened from scala-nateive 0.4.x to 0.5.x?

Or might there be another configuration mismatch on my system?

@Gedochao

Copy link
Copy Markdown
Author

@daenenk TBH I just tried bumping it blindly as well, hoping no code changes would be necessary. Alas, that is not the case.
I am not familiar with the code, and it seems to no longer be maintained, really, as indicated by @kiendang.
It was formerly maintained by @shadaj and he'd still be our best bet with questions, although I don't think he has the time for this project).
I'd also like a Scala Native 0.5.0 artifact of ScalaPy to be used with Scala CLI... But I'll probably just end up locking the supported ScalaPy version to 0.4.17 until this gets resolved.

Could this be related to the fact that the list of "Sbt settings and tasks" has been shortened from scala-nateive 0.4.x to 0.5.x?

I'll try to take a look at this when I find the time, no promises on when.

@daenenk

daenenk commented Apr 16, 2024

Copy link
Copy Markdown

With following changes in build.sbt, sbt accepts the config. Then it becomes clear that one of the issues is that scalatest needs to support scala-native 0.5.0 first, see scalatest/scalatest#2318. There seems to be process on the latter, so there is still hope.

  • Add import (required to define Mode used further)

    import scala.scalanative.build._ 
    
  • Bump version of scala-collection-compat

    libraryDependencies += "org.scala-lang.modules" %%% "scala-collection-compat" % "2.12.0",
    
  • Replace some nativeSettings into nativeConfig (I hope this is semantically the same)

    .nativeSettings(
      nativeConfig ~= { c =>
        c.withLinkingOptions(c.linkingOptions ++ pythonLdFlags) 
         .withLinkStubs(true)
      }
    )
    

    i.s.o.

    .nativeSettings(
      nativeLinkStubs := true,
      nativeLinkingOptions ++= pythonLdFlags
    )
    

    and

    .nativeSettings(
        nativeConfig ~= { c =>
          c.withLinkingOptions(c.linkingOptions ++ pythonLdFlags)
           .withMode(Mode.releaseFast)    
        }
    )
    

    i.s.o.

    .nativeSettings(
      nativeLinkingOptions ++= pythonLdFlags
      nativeMode := "release-fast"
    )
    

@Gedochao

Copy link
Copy Markdown
Author

@daenenk It seems that scalatest now supports Scala Native 0.5.x (see scalatest/scalatest#2322), so we should be unblocked here.
As per scalatest/scalatest#2317, the artifacts are already up.

I probably won't find the time to take another look at this for the next week or so, but if nobody picks it up, I can have another look later in May.

@daenenk

daenenk commented Aug 9, 2024

Copy link
Copy Markdown

With scalatest now supporting Scala Native 0.5.x, the dependencies are fine. Now it looks like that the upgrade to Scala Native 0.5.x broke some code. sbt coreJVM/test still works, but sbt coreNative/test doesn't. Getting type errors in Platform.scala. Replacing .toULong to .toUSize solves the easy once. But the errors related to Ptr[Byte] vs Pts[$_1] puzzled me. When using scala3Version, other errors are raised in Plarform.scala: CVoidPtr vs Ptr[Byte] and an issue with Zone. This is beyond my knowledge to fix.

@daenenk daenenk mentioned this pull request Aug 9, 2024
@shadaj

shadaj commented Aug 27, 2024

Copy link
Copy Markdown
Member

Not super sure about Zone, but when there is a Ptr[_] we should be using a Ptr[Byte] instead. Scala Native 0.4.x defaulted Ptr[_] to have byte-sized elements, but in 0.5.x we need to be explicit about that type.

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.

3 participants