Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cross-build for 2.13 #287

Merged
merged 7 commits into from
Jan 13, 2020
Merged

cross-build for 2.13 #287

merged 7 commits into from
Jan 13, 2020

Conversation

martijnhoekstra
Copy link
Contributor

No description provided.

@martijnhoekstra
Copy link
Contributor Author

At least bijection-core

@nevillelyh
Copy link
Collaborator

@martijnhoekstra are you still working on this? I can pick it up if you don't mind.

@martijnhoekstra
Copy link
Contributor Author

Oh, yes, I can pick this up again; I thought this one was ready to go, but maybe it isn't.

build.sbt Outdated
@@ -39,7 +39,7 @@ def versionFallback(scalaVersion: String, packageVersion210: String, version: St

val buildLevelSettings = Seq(
organization := "com.twitter",
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1"),
crossScalaVersions := Seq("2.10.6", "2.11.8", "2.12.1", "2.13.0"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Worth updating all of them? I think the latest are 2.10.6, 2.11.12, 2.12.10, & 2.13.1

Copy link
Contributor

Choose a reason for hiding this comment

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

2.10.7, I think

@nevillelyh
Copy link
Collaborator

nevillelyh commented Oct 9, 2019

Also we should probably get the CI build green.
@johnynek worth adding to scala-steward in the future?

@johnynek
Copy link
Collaborator

johnynek commented Oct 9, 2019

Yeah, I think scala-steward is a win for all repos.

martijnhoekstra added a commit to martijnhoekstra/repos that referenced this pull request Oct 10, 2019
@martijnhoekstra
Copy link
Contributor Author

@martijnhoekstra martijnhoekstra force-pushed the 213 branch 2 times, most recently from 2027265 to d0ae146 Compare October 10, 2019 14:27
@martijnhoekstra
Copy link
Contributor Author

martijnhoekstra commented Oct 10, 2019

Oh, it turns out I had lots of half-baked stuff laying around for bijection. There was lots of stuff that needed fixing, and I'm not sure what order I had in mind for that. Maybe first we can see what scala-steward brings to the table.

@nevillelyh
Copy link
Collaborator

@martijnhoekstra what about a quick fixup on this PR so we can get it in and let scala-steward pick up the rest?

@martijnhoekstra
Copy link
Contributor Author

@nevillelyh if it indeed turns out to be a quick fixup I'm all for it. When I get home tonight I can work on that, and see if it is and the problem is just scalafmt, or if there is more going on.

@martijnhoekstra
Copy link
Contributor Author

quick update: this is far farther from home than I had hoped.

@johnynek
Copy link
Collaborator

I'd like to use the strategy of making a scala-2.12- directory and scala-2.13+ directory or something for any changes. Since we haven't published for 2.13, anything goes, but for 2.11/2.12 I'd really like to not break binary compatibility.

We did something like this here:
typelevel/paiges#189

@martijnhoekstra
Copy link
Contributor Author

that sounds good @johnynek -- even without the bincompat argument it'll be necessary.

@martijnhoekstra
Copy link
Contributor Author

I burned this branch to the ground, and started it with a new blank slate. Marked the PR WIP.

@martijnhoekstra martijnhoekstra changed the title cross-build for 2.13 WIP: cross-build for 2.13 Oct 10, 2019
//things do work out. Without, we get diverging expansion starting at
//Injection.fromImplicitBijection
implicit val i1 = Bijection.fromInjection(Injection.int2String)
def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[List[Int], Vector[String @@ Rep[Int]]]]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@johnynek I pushed my WIP, as I'm hitting a hurdle here: scala 2.13 runs out of heap trying to get some sort of LUB here (I haven't figured out what it's trying to LUB). Ideas/sage advice/sharp insight more than welcome.

Copy link
Collaborator

Choose a reason for hiding this comment

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

//if we start here with Bijection.fromInjection(Injection.int2String)
//things do work out. Without, we get diverging expansion starting at
//Injection.fromImplicitBijection
implicit val i1 = Bijection.fromInjection(Injection.int2String)
Copy link
Collaborator

Choose a reason for hiding this comment

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

it could help to put a type here, maybe Bijection[Int, String @@ Rep[Int]]?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This keeps getting weirder. With

implicit val i1 = Bijection.fromInjection(Injection.int2String)
def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[CA, CB]] 

it succeeds fine.

With def ibij: ImplicitBijection[CA, CB] = implicitly[ImplicitBijection[List[Int], Vector[String @@ Rep[Int]] it crashes the compiler with OOM. That's obviously a compiler bug, but it's not immediately clear to me if, and if so how we can work around.

@martijnhoekstra
Copy link
Contributor Author

martijnhoekstra commented Oct 13, 2019

scala/bug#11770 messes up bijection-clojure. Worked around by calling generated static java methods.

@martijnhoekstra martijnhoekstra force-pushed the 213 branch 3 times, most recently from 0aba187 to 1ca6489 Compare October 14, 2019 08:44
Comment on lines -26 to -42
implicit val numericTypeclassBijection: TypeclassBijection[Numeric] =
new TypeclassBijection[Numeric] {
def apply[A, B](tc: Numeric[A], bij: Bijection[A, B]) =
new Numeric[B] {
def plus(x: B, y: B) = bij(tc.plus(bij.invert(x), bij.invert(y)))
def minus(x: B, y: B) = bij(tc.minus(bij.invert(x), bij.invert(y)))
def times(x: B, y: B) = bij(tc.times(bij.invert(x), bij.invert(y)))
def negate(x: B) = bij(tc.negate(bij.invert(x)))
def fromInt(x: Int) = bij(tc.fromInt(x))
def toInt(x: B) = tc.toInt(bij.invert(x))
def toLong(x: B) = tc.toLong(bij.invert(x))
def toFloat(x: B) = tc.toFloat(bij.invert(x))
def toDouble(x: B) = tc.toDouble(bij.invert(x))
def compare(x: B, y: B) = tc.compare(bij.invert(x), bij.invert(y))
}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extending numeric requires an extra member in 2.13. Probably not worth it to split this test up, as typeclass testing seems adequately tested in other tests. Does it need additional replacements?

@@ -73,7 +71,7 @@ trait LowPriorityJson {
* You need to import all the methods of this object to get general
* Injection[T,JsonNode] to work
*/
object JsonNodeInjection extends LowPriorityJson with java.io.Serializable {
object JsonNodeInjection extends CollectionJson with LowPriorityJson with java.io.Serializable {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This approach, with version specific parts mixed in to a version-neutral "main" can also be applied to the other split files. The upside is less duplicated code. The downside is more complexity. Both are backward binary compatible.

Happy to do it either way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@martijnhoekstra
Copy link
Contributor Author

Rebased to fix conflicts in tests

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@martijnhoekstra
Copy link
Contributor Author

rebased

@chrisbenincasa chrisbenincasa mentioned this pull request Dec 14, 2019
28 tasks
@chrisbenincasa
Copy link

Any update on the status of this? This is blocking the conversion of the memcached module over in #771 (which seems to be the last dependencyless module)

@martijnhoekstra
Copy link
Contributor Author

If I remember right this is ready for review

@dispalt
Copy link

dispalt commented Jan 10, 2020

This looks good anything keeping this from merging?

@nevillelyh
Copy link
Collaborator

LGTM and MiMa is green too. @johnynek wanna take a final look?

@johnynek
Copy link
Collaborator

This is great! Thanks for all the hard work!

@johnynek johnynek merged commit f1aaa9d into twitter:develop Jan 13, 2020
@martijnhoekstra
Copy link
Contributor Author

Nice! Is a release also possible?

@johnynek
Copy link
Collaborator

Just released:

https://github.com/twitter/bijection/releases/tag/v0.9.7

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants