-
Notifications
You must be signed in to change notification settings - Fork 163
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-xml module #664
base: main
Are you sure you want to change the base?
Add scala-xml module #664
Conversation
Codecov Report
@@ Coverage Diff @@
## main #664 +/- ##
==========================================
+ Coverage 85.02% 85.03% +0.01%
==========================================
Files 124 125 +1
Lines 1629 1631 +2
Branches 38 38
==========================================
+ Hits 1385 1387 +2
Misses 244 244
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
build.sbt
Outdated
@@ -198,10 +198,23 @@ lazy val circe = crossProject(JVMPlatform, JSPlatform) | |||
) | |||
) | |||
|
|||
lazy val `scala-xml` = crossProject(JVMPlatform, JSPlatform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably easiest to make it JVM only for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That requires rearranging the tests too, since they're cross-built for js and jvm. I've tried moving the test into jvm-only sources, let's see what happens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, nothing wrong with that. Still, better not to publish for JS unless you have a cross-platform parser. scala-xml.js is kind of a lie at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we'd then need to also exclude the js version from mima? Might be better to reorganize the modules instead to do this properly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, it's pretty simple. Instead of using crossProject
, just make an ordinary project
:)
The tricky part is for the tests, you need to do a .jvmConfigure(_.dependsOn(`scala-xml`))
Needs mima-wrangling to exclude the new module. |
tlVersionIntroduced := List("2.12", "2.13", "3").map(_ -> "skunk version this will be added").toMap |
Note on testing - I've copied the pattern of the Circe tests but they aren't really adequate (they'll still pass if you change the Postgres types of the codecs.) I've done some manual end-to-end testing but we don't have any automated tests that these codecs actually work correctly with Postgres. |
val xml: Codec[Elem] = Codec.simple(_.toString, s => Either.catchNonFatal(XML.loadString(s)).leftMap(_.getMessage), Type.xml) | ||
val _xml: Codec[Arr[Elem]] = Codec.array(_.toString, s => Either.catchNonFatal(XML.loadString(s)).leftMap(_.getMessage), Type._xml) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we use fs2-data-xml for parsing then it can cross-compile for JS/Native.
No description provided.