Skip to content

Commit c6baceb

Browse files
authored
Upgrade to Play 2.7.0-RC9 (#239)
1 parent e4c5e78 commit c6baceb

10 files changed

Lines changed: 60 additions & 70 deletions

File tree

.travis.yml

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,19 @@
1+
language: scala
2+
scala: 2.12.8
3+
jdk: oraclejdk8
14

2-
# http://www.scala-sbt.org/0.13/docs/Travis-CI-with-sbt.html#%28Experimental%29+Reusing+Ivy+cache
3-
# Use container-based infrastructure
4-
sudo: false
5+
before_script:
6+
- mysql -uroot -e 'create database playunittest; create database test;'
7+
# Clone generated docs so that we can run some integration tests
8+
- git clone https://github.com/playframework/play-generated-docs.git $PWD/data/generated
9+
10+
script: sbt test
511

6-
# These directories are cached to S3 at the end of the build
712
cache:
813
directories:
914
- $HOME/.ivy2/cache
10-
- $HOME/.sbt/boot/
15+
- $HOME/.sbt
1116

1217
before_cache:
13-
# Tricks to avoid unnecessary cache updates
1418
- find $HOME/.ivy2 -name "ivydata-*.properties" -delete
15-
- find $HOME/.sbt -name "*.lock" -delete
16-
17-
language: scala
18-
19-
scala:
20-
- 2.11.8
21-
22-
jdk: oraclejdk8
23-
24-
script:
25-
- sbt test
26-
27-
before_script:
28-
- mysql -uroot -e 'create database playunittest; create database test;'
29-
# Clone generated docs so that we can run some integration tests
30-
- git clone https://github.com/playframework/play-generated-docs.git $PWD/data/generated
19+
- find $HOME/.sbt -name "*.lock" -delete

app/actors/Actors.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import com.google.inject.AbstractModule
66
import com.typesafe.config.Config
77
import javax.inject.{Inject, Provider, Singleton}
88
import models.documentation._
9+
import org.slf4j.LoggerFactory
910
import play.api._
1011
import play.api.i18n.Lang
1112
import play.api.libs.concurrent.AkkaGuiceSupport
1213

1314
class ActorsModule extends AbstractModule with AkkaGuiceSupport {
14-
def configure() = {
15+
override def configure() = {
1516
bindActor[DocumentationActor]("documentation-actor")
1617
bindActorFactory[DocumentationPollingActor, DocumentationPollingActor.Factory]
1718
bind(classOf[DocumentationConfig]).toProvider(classOf[DocumentationConfigProvider])
@@ -33,6 +34,7 @@ class DocumentationRedirectsProvider @Inject()(configuration: Configuration) ext
3334

3435
@Singleton
3536
class DocumentationConfigProvider @Inject() (environment: Environment, configuration: Configuration) extends Provider[DocumentationConfig] {
37+
private val log = LoggerFactory.getLogger(classOf[DocumentationConfigProvider])
3638

3739
lazy val get: DocumentationConfig = loadConfig.getOrElse(DocumentationConfig(
3840
TranslationConfig(Lang("en"), environment.rootPath, None, "origin", None, None), Nil))
@@ -86,7 +88,8 @@ class DocumentationConfigProvider @Inject() (environment: Environment, configura
8688
if (translationPath.exists()) {
8789
true
8890
} else {
89-
Logger.warn("Not loading translation: " + name + " because its configured repo " + translationPath.getCanonicalPath + " doesn't exist")
91+
val path = translationPath.getCanonicalPath
92+
log.warn(s"Not loading translation: $name because its configured repo $path doesn't exist")
9093
false
9194
}
9295
}

app/actors/DocumentationPollingActor.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package actors
33
import javax.inject.Inject
44

55
import actors.DocumentationActor.{DocumentationGitRepo, DocumentationGitRepos, UpdateDocumentation}
6-
import akka.actor.{Actor, ActorRef}
6+
import akka.actor.{Actor, ActorLogging, ActorRef}
77
import com.google.inject.assistedinject.Assisted
88
import models.documentation._
99
import org.apache.commons.io.IOUtils
1010
import org.eclipse.jgit.lib.ObjectId
1111
import org.eclipse.jgit.util.Base64
12-
import play.api.Logger
1312
import play.api.i18n.{Lang, MessagesApi}
1413
import play.doc.{PageIndex, PlayDoc, TranslatedPlayDocTemplates}
1514
import utils.{AggregateFileRepository, PlayGitRepository}
@@ -33,7 +32,9 @@ object DocumentationPollingActor {
3332
* documentation.
3433
*/
3534
class DocumentationPollingActor @Inject() (messages: MessagesApi, @Assisted repos: DocumentationGitRepos,
36-
@Assisted documentationActor: ActorRef) extends Actor {
35+
@Assisted documentationActor: ActorRef) extends Actor
36+
with ActorLogging
37+
{
3738

3839
import DocumentationPollingActor._
3940
import context.dispatcher
@@ -108,7 +109,7 @@ class DocumentationPollingActor @Inject() (messages: MessagesApi, @Assisted repo
108109
implicit val lang = repos.default.config.lang
109110

110111
if (old.isDefined) {
111-
Logger.info(s"Updating default documentation for $version: $cacheId")
112+
log.info("Updating default documentation for {}: {}", version, cacheId)
112113
}
113114

114115
val playDoc = new PlayDoc(

app/models/documentation/Documentation.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package models.documentation
22

33
import java.util.Locale
44

5-
import play.api.Logger
5+
import org.slf4j.LoggerFactory
66
import play.api.i18n.Lang
77
import play.doc.PlayDoc
88
import utils.{ExtendedFileRepository, PlayGitRepository}
@@ -101,6 +101,7 @@ case class Version(name: String, era: Int, major: Int, minor: Int, patch: Int, v
101101
}
102102

103103
object Version {
104+
private val log = LoggerFactory.getLogger(classOf[Version])
104105

105106
def findMostRecentDevelopment(versions: Seq[Version], currentStable: Version): Seq[Version] = {
106107
versions.filter(!_.versionType.isStable).filter(_ > currentStable).take(2)
@@ -179,7 +180,7 @@ object Version {
179180
}
180181
} catch {
181182
case NonFatal(e) =>
182-
Logger.warn("Error encountered while trying to parse version: " + name, e)
183+
log.warn("Error encountered while trying to parse version: " + name, e)
183184
None
184185
}
185186
}

app/services/github/ContributorsSummariser.scala

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import javax.inject.{Singleton, Inject}
55
import akka.actor.ActorSystem
66
import com.google.inject.name.Named
77
import models.github._
8-
import play.api.Logger
8+
import org.slf4j.LoggerFactory
99

1010
import scala.concurrent.{ExecutionContext, Future}
1111
import scala.concurrent.duration._
@@ -37,7 +37,7 @@ class DefaultContributorsSummariser @Inject() (gitHub: GitHub, config: GitHubCon
3737
private def fetchAllContributors(repos: Seq[Repository]): Future[Seq[GitHubUser]] = {
3838
val contributorRepos = repos.filterNot(_.fork)
3939
for {
40-
contributors <- Future.sequence(contributorRepos.map(gitHub.fetchRepoContributors))
40+
contributors <- Future.traverse(contributorRepos)(gitHub.fetchRepoContributors)
4141
} yield {
4242

4343
// All contributors and the number of contributions.
@@ -46,7 +46,7 @@ class DefaultContributorsSummariser @Inject() (gitHub: GitHub, config: GitHubCon
4646
val contributorContributions: Seq[(GitHubUser, Int)] = contributors
4747
.flatten
4848
.groupBy(_._1.id)
49-
.map {
49+
.collect {
5050
case ((_, contributions @ ((user, _) :: _))) =>
5151
user -> contributions.map(_._2).sum
5252
}.toSeq
@@ -86,15 +86,17 @@ class DefaultContributorsSummariser @Inject() (gitHub: GitHub, config: GitHubCon
8686
@Singleton
8787
class CachingContributorsSummariser @Inject() (actorSystem: ActorSystem,
8888
@Named("gitHubContributorsSummariser") delegate: ContributorsSummariser)(implicit ec: ExecutionContext) extends ContributorsSummariser {
89+
private val log = LoggerFactory.getLogger(classOf[CachingContributorsSummariser])
90+
8991
@volatile private var contributors: Contributors = FallbackContributors.contributors
9092

9193
actorSystem.scheduler.schedule(0.seconds, 24.hours) {
9294
delegate.fetchContributors.onComplete {
93-
case Failure(t) => Logger.error("Unable to load contributors from GitHub", t)
95+
case Failure(t) => log.error("Unable to load contributors from GitHub", t)
9496
case Success(cs) =>
9597
if (contributors != cs) {
9698
val count = contributors.committers.size + contributors.playOrganisation.size + contributors.contributors.size
97-
Logger.info("Loaded " + count + " contributors for GitHub")
99+
log.info("Loaded {} contributors for GitHub", count)
98100
}
99101
contributors = cs
100102
}

app/services/github/GitHubModule.scala

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package services.github
22

3-
import play.api.{Logger, Configuration, Environment}
3+
import org.slf4j.LoggerFactory
4+
import play.api.{Configuration, Environment}
45
import play.api.inject.Module
56

67
class GitHubModule extends Module {
8+
private val log = LoggerFactory.getLogger(classOf[GitHubModule])
79

810
def bindings(environment: Environment, configuration: Configuration) = {
911
import scala.collection.JavaConverters._
@@ -20,9 +22,9 @@ class GitHubModule extends Module {
2022
bind[ContributorsSummariser].to[CachingContributorsSummariser]
2123
)
2224
case None =>
23-
Logger.info("No GitHub access token yet, using fallback contributors")
25+
log.info("No GitHub access token yet, using fallback contributors")
2426
Seq(bind[ContributorsSummariser].to[OfflineContributorsSummariser])
2527
}
2628

2729
}
28-
}
30+
}

build.sbt

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,40 @@
1-
2-
3-
JsEngineKeys.engineType := JsEngineKeys.EngineType.Node
4-
51
name := "playframework"
62
version := "1.0-SNAPSHOT"
73

8-
lazy val root = (project in file(".")).enablePlugins(PlayScala, NewRelic)
4+
enablePlugins(PlayScala, NewRelic)
5+
6+
scalacOptions ++= List("-encoding", "utf8", "-deprecation", "-feature", "-unchecked")
97

108
libraryDependencies ++= Seq(
11-
"com.typesafe.play" %% "play-doc" % "1.8.2",
12-
"org.eclipse.jgit" % "org.eclipse.jgit" % "3.0.0.201306101825-r",
13-
"mysql" % "mysql-connector-java" % "5.1.47",
14-
"com.damnhandy" % "handy-uri-templates" % "2.1.7",
15-
"org.webjars" % "jquery" % "1.8.3",
16-
"org.webjars" % "html5shiv" % "3.7.3",
17-
"org.webjars" % "prettify" % "4-Mar-2013-1",
18-
"org.webjars" % "clipboard.js" % "1.5.5",
19-
"org.playframework.anorm" %% "anorm" % "2.6.2",
9+
"com.typesafe.play" %% "play-doc" % "1.8.2",
10+
"org.eclipse.jgit" % "org.eclipse.jgit" % "3.0.0.201306101825-r",
11+
"mysql" % "mysql-connector-java" % "5.1.47",
12+
"com.damnhandy" % "handy-uri-templates" % "2.1.7",
13+
"org.webjars" % "jquery" % "1.8.3",
14+
"org.webjars" % "html5shiv" % "3.7.3",
15+
"org.webjars" % "prettify" % "4-Mar-2013-1",
16+
"org.webjars" % "clipboard.js" % "1.5.5",
17+
"org.playframework.anorm" %% "anorm" % "2.6.2",
2018
guice,
2119
jdbc,
2220
ehcache,
2321
evolutions,
2422
filters,
2523
ws,
26-
specs2 % "test"
27-
)
28-
29-
scalaVersion := "2.12.8"
30-
31-
scalacOptions ++= Seq(
32-
"-feature",
33-
"-deprecation"
24+
specs2 % Test
3425
)
3526

3627
routesGenerator := InjectedRoutesGenerator
3728

29+
JsEngineKeys.engineType := JsEngineKeys.EngineType.Node
30+
3831
StylusKeys.useNib in Assets := true
3932
StylusKeys.compress in Assets := true
4033

4134
pipelineStages := Seq(digest, gzip)
4235

4336
sourceGenerators in Compile += Def.task {
37+
import scala.sys.process._
4438
val siteVersionFile = crossTarget.value / "version" / "SiteVersion.scala"
4539
val gitHash = "git rev-parse HEAD".!!.trim
4640
if (!siteVersionFile.exists || !IO.read(siteVersionFile).contains(gitHash)) {
@@ -59,6 +53,5 @@ managedSourceDirectories in Compile += crossTarget.value / "version"
5953
sources in (Compile, doc) := Seq.empty
6054
publishArtifact in (Compile, packageDoc) := false
6155

62-
// NewRelic settings
6356
newrelicVersion := "4.9.0"
6457
newrelicAppName := "playframework.com"

conf/application.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ play {
1111

1212
http {
1313
requestHandler = play.api.http.DefaultHttpRequestHandler
14-
secret.key = changeme
14+
secret.key = a-long-secret-to-calm-the-rage-of-the-entropy-gods
1515
}
1616

1717
i18n.langs = [en, ja, tr, fr, bg]

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.17
1+
sbt.version=1.2.8

project/plugins.sbt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
2-
3-
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.6.21")
4-
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.2")
5-
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.1")
6-
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.0.3")
7-
addSbtPlugin("com.gilt.sbt" % "sbt-newrelic" % "0.3.3")
1+
addSbtPlugin("com.dwijnand" % "sbt-travisci" % "1.1.3")
2+
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.7.0-RC9")
3+
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.4")
4+
addSbtPlugin("com.typesafe.sbt" % "sbt-gzip" % "1.0.2")
5+
addSbtPlugin("com.typesafe.sbt" % "sbt-stylus" % "1.1.0")
6+
addSbtPlugin("com.gilt.sbt" % "sbt-newrelic" % "0.3.3")

0 commit comments

Comments
 (0)