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

Add scala-native support #316

Merged
merged 3 commits into from
Aug 6, 2021
Merged

Add scala-native support #316

merged 3 commits into from
Aug 6, 2021

Conversation

avdv
Copy link
Contributor

@avdv avdv commented Jul 12, 2021

  • update Scala 2.12 to 2.12.13 since scala-native's nscplugin is available for
    2.12.13 and 2.12.14
  • exclude java.nio.time support for scala-native, since scala-native does not
    implement this on its own and org.ekrich %%% sjavatime is not complete yet

Fixes #42

As already mentioned above, the scala-native module does not support the java.nio.time based Argument instances. I guess that's OK for a start, and could be improved later. Partial support would be possible, or one could separate the library part into a decline-time module which would not be published for scala-native at all.

Copy link
Owner

@bkirwi bkirwi left a comment

Choose a reason for hiding this comment

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

Very cool! Kicking off the build.

Curious what you're using this for, if you don't mind sharing?

build.sbt Outdated Show resolved Hide resolved
@bkirwi
Copy link
Owner

bkirwi commented Jul 14, 2021

Hmm, looks like CI will need an update... could you run sbt githubWorkflowGenerate and commit the result?

@avdv
Copy link
Contributor Author

avdv commented Jul 15, 2021

Curious what you're using this for, if you don't mind sharing?

Sure 😄, I have a little side-project where I am using scopt currently which comes with some idiosyncrasies and I'm thinking of replacing it with decline.

@avdv
Copy link
Contributor Author

avdv commented Jul 15, 2021

I've rebased onto master and pushed.

I would like to run the tests for Scala Native on CI too, but only for Scala 2.12 and 2.13. Do you know how to achieve that using sbt-github-actions?

@bkirwi
Copy link
Owner

bkirwi commented Jul 16, 2021

Hrm, I do not. The README makes it sound like it may be difficult: https://github.com/djspiewak/sbt-github-actions#generative-1

I suppose one might be able to reconfigure some of the tasks, so that eg. githubWorkflowBuild is a noop iff you're compiling on Scala 3, or look into some of the build matrix features? We'll also need to think about keeping sbt release working.

@avdv
Copy link
Contributor Author

avdv commented Jul 18, 2021

I suppose one might be able to reconfigure some of the tasks, so that eg. githubWorkflowBuild is a noop iff you're compiling on Scala 3, or look into some of the build matrix features?

I took a look at how they do it for cats. They have another matrix dimension:

ThisBuild / githubWorkflowBuildMatrixAdditions +=
  "platform" -> List("jvm", "js", "native")

and then exclude the Scala 3 / native platform job:

ThisBuild / githubWorkflowBuildMatrixExclusions +=
  MatrixExclude(Map("platform" -> "native", "scala" -> Scala3))

Also, they redefine the build steps and conditionally run with if: matrix.platform == 'native'.

I'll look into this a bit more tomorrow.

@avdv
Copy link
Contributor Author

avdv commented Jul 19, 2021

I have again rebased onto master and added a job step which runs conditionally if the matrix.scala version is not Scala 3.

I'll look into getting sbt release working next.

@bkirwi
Copy link
Owner

bkirwi commented Jul 24, 2021

Kicked off the updated jobs - looks like everything's working smoothly.

* update Scala 2.12 to 2.12.13 since scala-native's nscplugin is available for
  2.12.13 and 2.12.14
* exclude java.nio.time support for scala-native, since scala-native does not
  implement this on its own and `org.ekrich %%% sjavatime` is not complete yet

Fixes bkirwi#42
@avdv
Copy link
Contributor Author

avdv commented Aug 2, 2021

Sorry for responding so sluggishly... I have again rebased and pushed a new commit which also runs the publish artifacts step for the supported scala versions of the declineNative project.

Note, that the runClean and runTest release steps do not run the corresponding tasks for declineNative. It would be possible to integrate them in the same way as was done for the publish artifacts.

FTR, I tried aggregating the native project in the root project too, but that did not work so well since running any task with + always runs the tasks of the aggregated projects too, it just does not change the Scala version of the subproject. Which means that it would run declineNative / test with the Scala version set to the default one, even if it was switched to 3.0.1 globally. That would also lead to double publishes when running release cross.

@bkirwi
Copy link
Owner

bkirwi commented Aug 6, 2021

Cool looks good!

Note, that the runClean and runTest release steps do not run the corresponding tasks for declineNative. It would be possible to integrate them in the same way as was done for the publish artifacts.

That sounds like a good idea, but not a blocker. (There's a risk that a compilation bug in Scala Native could fail the build fairly late... but, hopefully, not a large one.)

Sorry for responding so sluggishly...

No need to apologize for volunteering your time slightly later than you expected to. :)

I'll go ahead and merge this, but will leave the corresponding issue open until we've got this released and confirmed working well.

@bkirwi bkirwi merged commit d35e099 into bkirwi:master Aug 6, 2021
@avdv
Copy link
Contributor Author

avdv commented Aug 6, 2021

Thanks for merging! I will check this out for my project later on, but I am on vacation the next weeks... 😃

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.

Build for Scala Native?
2 participants