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

cross-compile for scala.js #79

Closed
erikerlandson opened this issue Apr 24, 2020 · 16 comments
Closed

cross-compile for scala.js #79

erikerlandson opened this issue Apr 24, 2020 · 16 comments

Comments

@erikerlandson
Copy link
Owner

I know absolutely nothing about scala.js or its ecosystem.

If I'm lucky, sbt-crossproject would allow me to fake this.
https://github.com/portable-scala/sbt-crossproject

@cquiroz
Copy link

cquiroz commented May 14, 2020

I could try to do this, I've done a bunch of scala.js projects and we may need coulomb

@erikerlandson
Copy link
Owner Author

@cquiroz if you want to take a stab at it, please feel free! I'm hoping it's mostly additional targets in sbt, and corresponding in travis ci

@cquiroz
Copy link

cquiroz commented May 14, 2020

It is blocked on spire that hasn't been released yet for scala.js 1.0

@erikerlandson
Copy link
Owner Author

crossref: typelevel/spire#888

@erikerlandson
Copy link
Owner Author

Looks like the "real" problem is the archival of machinist
typelevel/spire#888 (comment)

@erikerlandson
Copy link
Owner Author

@cquiroz I believe spire 0.17.0-RC1 is building with scalaJS 1.x

@cquiroz
Copy link

cquiroz commented Jul 13, 2020

Yes, I'm waiting for a release

@erikerlandson
Copy link
Owner Author

@erikerlandson
Copy link
Owner Author

erikerlandson commented Jul 14, 2020

scala-steward updated to spire 0.17.0-RC1, which I merged, so if you rebase from develop ScalaJS 1.x should in theory work now

@cquiroz
Copy link

cquiroz commented Jul 14, 2020

Yes I'm updating the build, will send a PR soon

@cquiroz
Copy link

cquiroz commented Jul 14, 2020

Actually I found a show stopper. coulomb uses WeakTypeTags which aren't available on scala.js. I'm not very familiar with them, I dont know if coulomb could use something else

@erikerlandson
Copy link
Owner Author

erikerlandson commented Jul 14, 2020

I can try ClassTag
scala-js/scala-js#50 (comment)

Mostly I'm using them to provide default names based on the name of a type.

Another possible approach would be to not support defaults that require WeakTypeTag or TypeTag, or not support them in scala.js - the code would need some refactoring to support that kind of dual functionality.

Or possibly punt to macros. those are supported IIUC

Maybe a dedicated implicit GetTypeName, that could punt to a macro or just invoke WeakTypeTag. I was excited about getting rid of the scala-2.x macros and I'm not eager to bring them back, but maybe if they were only invoked for scala.js ... ?

Scala's support for "conditional compilation" is pretty awkward, but I see people do it.

If we are ultimately forced to use macros, this is nice and compact.
https://stackoverflow.com/a/15649874/3669757

@cquiroz
Copy link

cquiroz commented Jul 14, 2020

@tpolecat sugested to use shapeless Typeable to get the names. Some uses are in libs that are jvm only like pureconfig thus we wouldn't need to change them

@cquiroz
Copy link

cquiroz commented Jul 14, 2020

I can try todo it and make sure they'd run in scala.js

@erikerlandson
Copy link
Owner Author

@tpolecat sugested to use shapeless Typeable to get the names.

Sounds like a good approach, shapeless is already a dependency. If it works, I'm happy to use it everywhere. I recently migrated everything to WeakTypeTag for consistency.

It might be worth using a shim GetTypeName in case this needs to be changed yet again in the future. GetTypeName could call Typeable for now.

@erikerlandson
Copy link
Owner Author

closing with #97
QuantityParser and its deps are not supported in scalaJS in their current form, that will require a future redesign

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

2 participants