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

Another try at updating to Play 2.9 #1516

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
language: scala
scala:
- 2.12.12
- 2.13.15

jdk:
openjdk8
semeru11

sudo: required

Expand Down
61 changes: 29 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ logBuffered := false
logLevel := Level.Info
ThisBuild / organization := "eu.ehri-project"

val projectScalaVersion = "2.12.12"
val projectScalaVersion = "2.13.15"
val appName = "docview"

val backendVersion = "0.15.1"
val dataConverterVersion = "1.1.15"
val alpakkaVersion = "3.0.4"

// This prevents a library version incompatibility error between
// scala-xml 1.3.0 and 2.2.0 (which are in fact binary compatible.)
ThisBuild / libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always
)

val backendDependencies = Seq(
// Play stuff
ws,
Expand Down Expand Up @@ -52,6 +58,9 @@ val coreDependencies = backendDependencies ++ Seq(
filters,
openId,

// Force Scala XML version
"org.scala-lang.modules" %% "scala-xml" % "2.2.0",

// Force Akka HTTP version
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-xml" % akkaHttpVersion,
Expand Down Expand Up @@ -82,8 +91,8 @@ val coreDependencies = backendDependencies ++ Seq(
"org.jsoup" % "jsoup" % "1.11.3",

// Mailer...
"com.typesafe.play" %% "play-mailer" % "8.0.1",
"com.typesafe.play" %% "play-mailer-guice" % "8.0.1",
"org.playframework" %% "play-mailer" % "11.0.0-M1",
"org.playframework" %% "play-mailer-guice" % "11.0.0-M1",

// Time formatting library
"org.ocpsoft.prettytime" % "prettytime" % "3.2.7.Final",
Expand All @@ -93,10 +102,6 @@ val coreDependencies = backendDependencies ++ Seq(
)

val portalDependencies = Seq(
// Library for the silencer compiler plugin, only needed
// at compile time.
"com.github.ghik" %% "silencer-lib" % "1.3.1" % Compile,

// Helper for making thumbnails...
"net.coobird" % "thumbnailator" % "[0.4, 0.5)",

Expand Down Expand Up @@ -129,18 +134,16 @@ val testDependencies = Seq(
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test
)

val additionalResolvers = Seq(
val additionalResolvers = Resolver.sonatypeOssRepos("releases") ++ Seq(
Resolver.mavenLocal,
Resolver.sonatypeRepo("releases"),

// EHRI repositories
"EHRI Releases" at "https://dev.ehri-project.eu/artifactory/libs-release-local",
)

val validateMessages = TaskKey[Unit]("validate-messages", "Validate messages")

lazy val commonSettings = Seq(

val commonSettings = Seq(
ThisBuild / scalaVersion := projectScalaVersion,

// Increase the JVM heap to avoid running
Expand All @@ -158,26 +161,20 @@ lazy val commonSettings = Seq(
"-encoding", "UTF-8",
"-Ywarn-unused:imports",
"-unchecked",
"-deprecation"
"-deprecation",
"-Wconf:cat=unused-imports&site=.*views.html.*:s", // Silence import warnings in Play html files
),

resolvers ++= additionalResolvers,

skip in publish := true,
publish / skip := true,

// Disable documentation generation
sources in (Compile, doc) := Seq.empty,

publishArtifact in (Compile, packageDoc) := false
Compile / doc / sources := Seq.empty,
Compile/ packageDoc / publishArtifact := false
)

val webAppSettings = Seq(
// Add silencer plugin...
addCompilerPlugin("com.github.ghik" %% "silencer-plugin" % "1.3.1"),

// ... and silence all warnings on autogenerated files
scalacOptions += "-P:silencer:pathFilters=target/.*",

// Allow SBT to tell Scaladoc where to find external
// api docs if dependencies provide that metadata
autoAPIMappings := true,
Expand All @@ -193,7 +190,7 @@ val webAppSettings = Seq(
import java.io.FileInputStream
import java.text.MessageFormat
import java.util.Properties
import scala.collection.JavaConverters._
import scala.jdk.CollectionConverters._
val properties: Properties = new Properties()
val fis = new FileInputStream(messageFile)
try {
Expand Down Expand Up @@ -271,12 +268,12 @@ val resourceSettings = Seq(
(Compile / PlayKeys.playExternalizedResources) += file("modules/xquery/src/main/resources/xtra.xqm") -> "xtra.xqm",

// Filter out excluded resources from packaging
mappings in Universal := (mappings in Universal).value.filterNot { case (f, s) =>
Universal / mappings := (Universal / mappings).value.filterNot { case (f, s) =>
excludedResources contains f.getName
},

// Filter out excluded resources from jar generation (even though not used)
mappings in (Compile, packageBin) := (mappings in (Compile, packageBin)).value.filterNot { case (f, s) =>
Compile / packageBin / mappings := (Compile / packageBin / mappings).value.filterNot { case (f, s) =>
excludedResources contains f.getName
},
)
Expand Down Expand Up @@ -346,10 +343,10 @@ lazy val xslt = Project(appName + "-xslt", file("modules/xslt"))
.settings(commonSettings: _*)
.settings(libraryDependencies ++= Seq(
"javax.inject" % "javax.inject" % "1",
"org.slf4j" % "slf4j-api" % "1.7.32",
"org.slf4j" % "slf4j-api" % "2.0.13",

// We need JSON here...
"com.typesafe.play" %% "play-json" % "2.8.1",
"com.typesafe.play" %% "play-json" % "2.10.0",

// Saxon for XSLT transformation
"net.sf.saxon" % "Saxon-HE" % "10.2",
Expand All @@ -363,14 +360,14 @@ lazy val xquery = Project(appName + "-xquery", file("modules/xquery"))
.settings(resolvers += "BaseX repository" at "https://files.basex.org/maven/")
.settings(libraryDependencies ++= Seq(
"javax.inject" % "javax.inject" % "1",
"org.slf4j" % "slf4j-api" % "1.7.32",
"ch.qos.logback" % "logback-classic" % "1.2.5",
"org.slf4j" % "slf4j-api" % "2.0.13",
"ch.qos.logback" % "logback-classic" % "1.5.6",

// EAD transformation...
"org.basex" % "basex" % "8.5",

// Command line parsing
"com.github.scopt" %% "scopt" % "4.0.1",
"com.github.scopt" %% "scopt" % "4.1.0",

specs2 % Test,
))
Expand Down Expand Up @@ -439,10 +436,10 @@ lazy val main = Project(appName, file("."))
.settings(libraryDependencies ++= coreDependencies ++ testDependencies)
.settings(commonSettings ++ webAppSettings ++ resourceSettings)
.settings(
skip in publish := false,
publish / skip := false,

// Tell sbt that we only want a tgz, not a zip
makeDeploymentSettings(Universal, packageBin in Universal, "tgz"),
makeDeploymentSettings(Universal, Universal / packageBin, "tgz"),

// Remove top-level directory from package zip
topLevelDirectory := None,
Expand Down
5 changes: 2 additions & 3 deletions conf/logback-play-dev.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
-->
<configuration>

<conversionRule conversionWord="coloredLevel" converterClass="play.api.libs.logback.ColoredLevel" />

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>${application.home}/logs/application.log</file>
<encoder>
Expand All @@ -23,7 +21,7 @@
</filter>

<encoder>
<pattern>%coloredLevel %logger{15} - %message%n%xException{5}</pattern>
<pattern>%highlight(%-5level) %logger{15} - %message%n%xException{5}</pattern>
</encoder>
</appender>

Expand Down Expand Up @@ -51,6 +49,7 @@
<!-- Turn down the default level of some classes that log with each
application restart -->
<logger name="com.zaxxer.hikari" level="ERROR" />
<logger name="play.api.http.HttpErrorHandlerExceptions" level="WARN" />
<logger name="play.api.db.HikariCPConnectionPool" level="WARN" />
<logger name="play.api.libs.concurrent.ActorSystemProvider" level="ERROR" />

Expand Down
Loading
Loading