-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Upgrade to Scala 2.12 #6691
Upgrade to Scala 2.12 #6691
Conversation
@@ -16,7 +16,7 @@ logLevel := Level.Warn | |||
|
|||
scalacOptions ++= Seq("-deprecation", "-language:_") | |||
|
|||
addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.getOrElse("interplay.version", "1.1.2")) | |||
addSbtPlugin("com.typesafe.play" % "interplay" % sys.props.getOrElse("interplay.version", "1.3.0-SNAPSHOT")) |
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.
Was version 1.3.0-SNAPSHOT published? Looks like the version was not changed at playframework/interplay#18.
Current master also shows that the last version still 1.2.1-SNAPSHOT:
https://github.com/playframework/interplay/blob/master/version.sbt
@@ -1,4 +1,4 @@ | |||
# | |||
# Copyright (C) 2009-2016 Lightbend Inc. <https://www.lightbend.com> | |||
# | |||
sbt.version=0.13.11 | |||
sbt.version=0.13.13 |
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.
This should also be updated at other files (documentation, templates and subprojects).
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'll file a milestone issue for upgrading to sbt 0.13.13
actually akka-http and akka-http-core are now released for 2.12 as Brings us down to our own dependencies. |
@schmitch great, I'll see about updating our internal docs... |
cfdd26a
to
ba00881
Compare
@schmitch okay, akka-http and sbt-io has been updated and play-doc 1.3.0 / interplay 1.7.0 has been released -- if this passes the build I think we're good. |
@@ -56,6 +56,14 @@ object BuildSettings { | |||
Resolver.typesafeRepo("releases"), | |||
Resolver.typesafeIvyRepo("releases") | |||
), | |||
scalacOptions in(Compile, doc) := { |
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.
maybe we should use ++=
instead of :=
and wrap it with .value
, I told you to add it since I didn't found other occurences which might override that.
Actually scripted tests will now only run on 2.12 and the normal tests won't actually cross-build as it seems. we need to adjust the travis build file. Also scripted tests fail, two of them are easy to fix: Fix for the scripted tests:
after that we get a really strange failure of akka-http-server: |
@schmitch I suspect that is happening from |
More update: when I run
|
yeah but actually that can be fixed with higher JAVA_OPTS, i use:
|
@schmitch we only have 3GB on the Travis CI box, but we can start there... |
ba00881
to
965de16
Compare
The scripted error seems to be happening because of the sbt mediator. There's a workaround: sbt/sbt#2786 (comment) There are a couple of scaladoc errors resulting from scaladoc complaining that private Java classes are escaping their boundaries -- they've been made package private. The stackoverflow https://issues.scala-lang.org/browse/SI-10027 only occurs in Play-Java, so I've pointed Play-Java project to the Scala 2.12 nightly build just to get something working. |
c3bf287
to
985e398
Compare
Well, I can get most of the scripted tests working with
|
Might be a different error? |
2ee4e03
to
8a87fd8
Compare
346e8a8
to
7dfa750
Compare
What's the status of this PR? Are we ready to merge soon? Also it looks to me we could backport to 2.5.x as well (perhaps with different dependency versions for Scala 2.12). |
There's a couple of tests involving Akka-HTTP that don't resolve and have been disabled. Otherwise, it's good for review. |
@@ -104,7 +104,7 @@ lazy val PlayAkkaHttpServerProject = PlayCrossBuiltProject("Play-Akka-Http-Serve | |||
.settings(libraryDependencies ++= akkaHttp) | |||
// Include scripted tests here as well as in the SBT Plugin, because we | |||
// don't want the SBT Plugin to have a dependency on an experimental module. | |||
.settings(playFullScriptedSettings: _*) | |||
//.settings(ScriptedPlugin.scriptedSettings ++ playScriptedSettings) |
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.
Commented out because the sbt-mediator throws exception here even if there are no sbt scripted tests...
@@ -122,7 +122,8 @@ trait Action[A] extends EssentialAction { | |||
* @tparam A the body content type | |||
*/ | |||
trait BodyParser[+A] extends (RequestHeader => Accumulator[ByteString, Either[Result, A]]) { | |||
self => | |||
// "with Any" because we need to prevent 2.12 SAM inference here | |||
self: BodyParser[A] with Any => |
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.
Scala 2.12 looks at Function
types and attempts to convert them to JDK 1.8 SAM types -- since BodyParser extends Function1, it ends up conflicting with the other Action.apply method that takes only a (Request[A] => Result)
(and therefore is also a SAM type, but does not share a common base type).
The solution here is to ensure the BodyParser cannot be treated as a SAM type by the compiler, by kludging the explicit self type reference.
@@ -25,7 +25,7 @@ play.http.filters = "filters.MyFilters" | |||
|
|||
## Configuring the security headers | |||
|
|||
Scaladoc is available in the [play.filters.headers](api/scala/play/filters/headers/package.html) package. | |||
Scaladoc is available in the [play.filters.headers](api/scala/play/filters/headers/) package. |
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.
2.12 doesn't believe in package.html
GzipFilter gzipFilter = new GzipFilter( | ||
new GzipFilterConfig().withShouldGzip((req, res) -> | ||
gzipFilterConfig.withShouldGzip((BiFunction<Http.RequestHeader, Result, Object>) (req, res) -> |
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.
GzipFilterConfig
has two withShouldGzip
, both of which equate to SAM types. The 2.12 compiler can't distinguish, so we need an explicit cast here.
It might be a better idea to remove one of these methods or move the methods out to different classes altogether for Java API / Scala API.
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.
Yeah, it's a shame we have to support Scala 2.11 too.
Maybe for Play 2.6 we should rename the Java one to something like withShouldGzipJava
, then we can remove it when we drop support for 2.11. Most Java users should be able to upgrade to Scala 2.12 pretty easily so they'll be able to use the Scala function version.
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.
what about creating two source folders one for 2.11 and one for 2.12 and keep the old version as is and the new version for 2.12 won't have two functions?
💯 👍 😄 |
Is this going to be released soon? Would be totally awesome! :) |
@gmethvin is the backport going to happen? Or, what's holding it back? |
@RookieMaus Play 2.6.x is scheduled for Q1 2017 -- see https://docs.google.com/document/d/11sVi1-REAIDFVHvwBrfRt1uXkBzROHQYgmcZNGJtDnA/edit# @rethab Getting 2.6.x out the door is the priority now. |
With regards to backporting to 2.5, I can't see anything about this PR that is not binary compatible, or can't be made to be binary compatible. The only change to public API is that There are several upgrades to libraries that may be binary incompatible, but that's easy to deal with in sbt where you can control the version pulled in based on the Scala version. There don't seem to be any changes that are dependent on those upgrades. Nearly all the changes in this PR are related to testing and docs, and so should be innocuous to backport. |
Well to bring 2.12 to 2.5 we would eat least need to have a version of twirl and play-doc that is binary compatible, or is there a way to change sbt plugins based on scala version? |
Sets up a Play version that works against 2.12.0 by default and does a cross-build to 2.11.8.
All the dependencies have been worked through, so if this builds, we should be good.