Skip to content

Commit

Permalink
Rollback 2.9 for logback SMTP mailer issues
Browse files Browse the repository at this point in the history
Revert "Update to Play 2.9.5 and Scala 2.13"
Revert "Add in temp fix for updating subproject assets."
Revert "Update version to (arbitrary) 3.0.0"
Revert "Tweak dependencies for mailing, particularly SMTP log appender"
More undoing of 2.9 changes
  • Loading branch information
mikesname committed Aug 28, 2024
1 parent 52e83db commit a3112df
Show file tree
Hide file tree
Showing 86 changed files with 232 additions and 1,058 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: scala
scala:
- 2.13.14
- 2.12.12

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

val projectScalaVersion = "2.13.14"
val projectScalaVersion = "2.12.12"
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 All @@ -48,10 +42,7 @@ val backendDependencies = Seq(
"org.apache.jena" % "jena-iri" % "3.9.0",

// Ontology
"eu.ehri-project" % "ehri-definitions" % backendVersion,

// JavaX Mail for logback SMTP appender
"javax.mail" % "javax.mail-api" % "1.5.6",
"eu.ehri-project" % "ehri-definitions" % backendVersion
)

val coreDependencies = backendDependencies ++ Seq(
Expand All @@ -61,9 +52,6 @@ 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 @@ -94,8 +82,8 @@ val coreDependencies = backendDependencies ++ Seq(
"org.jsoup" % "jsoup" % "1.11.3",

// Mailer...
"com.typesafe.play" %% "play-mailer" % "9.0.0",
"com.typesafe.play" %% "play-mailer-guice" % "9.0.0",
"com.typesafe.play" %% "play-mailer" % "8.0.1",
"com.typesafe.play" %% "play-mailer-guice" % "8.0.1",

// Time formatting library
"org.ocpsoft.prettytime" % "prettytime" % "3.2.7.Final",
Expand All @@ -105,6 +93,10 @@ 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 @@ -137,16 +129,18 @@ val testDependencies = Seq(
"com.typesafe.akka" %% "akka-stream-testkit" % akkaVersion % Test
)

val additionalResolvers = Resolver.sonatypeOssRepos("releases") ++ Seq(
val additionalResolvers = 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")

val commonSettings = Seq(
lazy val commonSettings = Seq(

ThisBuild / scalaVersion := projectScalaVersion,

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

resolvers ++= additionalResolvers,

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

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

publishArtifact in (Compile, packageDoc) := 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 +193,7 @@ val webAppSettings = Seq(
import java.io.FileInputStream
import java.text.MessageFormat
import java.util.Properties
import scala.jdk.CollectionConverters._
import scala.collection.JavaConverters._
val properties: Properties = new Properties()
val fis = new FileInputStream(messageFile)
try {
Expand Down Expand Up @@ -271,12 +271,12 @@ val resourceSettings = Seq(
(Compile / PlayKeys.playExternalizedResources) += file("modules/xquery/src/main/resources/xtra.xqm") -> "xtra.xqm",

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

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

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

// Saxon for XSLT transformation
"net.sf.saxon" % "Saxon-HE" % "10.2",
Expand All @@ -363,14 +363,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" % "2.0.13",
"ch.qos.logback" % "logback-classic" % "1.5.6",
"org.slf4j" % "slf4j-api" % "1.7.32",
"ch.qos.logback" % "logback-classic" % "1.2.5",

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

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

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

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

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

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

Expand Down Expand Up @@ -49,7 +51,6 @@
<!-- 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

0 comments on commit a3112df

Please sign in to comment.