diff --git a/api/shared/src/main/scala/play/twirl/api/BaseScalaTemplate.scala b/api/shared/src/main/scala/play/twirl/api/BaseScalaTemplate.scala index 60685755..70718d2b 100644 --- a/api/shared/src/main/scala/play/twirl/api/BaseScalaTemplate.scala +++ b/api/shared/src/main/scala/play/twirl/api/BaseScalaTemplate.scala @@ -10,7 +10,6 @@ import scala.collection.JavaConverters import scala.reflect.ClassTag case class BaseScalaTemplate[T <: Appendable[T], F <: Format[T]](format: F) { - // The overloaded methods are here for speed. The compiled templates // can take advantage of them for a 12% performance boost def _display_(x: AnyVal): T = format.escape(x.toString) diff --git a/api/shared/src/main/scala/play/twirl/api/Content.scala b/api/shared/src/main/scala/play/twirl/api/Content.scala index 19c06d53..590b768a 100644 --- a/api/shared/src/main/scala/play/twirl/api/Content.scala +++ b/api/shared/src/main/scala/play/twirl/api/Content.scala @@ -19,7 +19,6 @@ trait Content { * The default Content type to use for this content. */ def contentType: String - } /** @@ -67,5 +66,4 @@ abstract class BufferedContent[A <: BufferedContent[A]]( } override def hashCode(): Int = this.getClass.hashCode() + body.hashCode() - } diff --git a/api/shared/src/main/scala/play/twirl/api/Formats.scala b/api/shared/src/main/scala/play/twirl/api/Formats.scala index 6c3cc6b5..a3407412 100644 --- a/api/shared/src/main/scala/play/twirl/api/Formats.scala +++ b/api/shared/src/main/scala/play/twirl/api/Formats.scala @@ -114,7 +114,6 @@ object HtmlFormat extends Format[Html] { * Create an HTML Fragment that holds other fragments. */ def fill(elements: immutable.Seq[Html]): Html = new Html(elements) - } /** @@ -141,7 +140,6 @@ object Txt { def apply(text: String): Txt = { new Txt(text) } - } /** @@ -168,7 +166,6 @@ object TxtFormat extends Format[Txt] { * Create an Txt Fragment that holds other fragments. */ def fill(elements: immutable.Seq[Txt]): Txt = new Txt(elements) - } /** @@ -195,7 +192,6 @@ object Xml { def apply(text: String): Xml = { new Xml(text) } - } /** @@ -222,7 +218,6 @@ object XmlFormat extends Format[Xml] { * Create an XML Fragment that holds other fragments. */ def fill(elements: immutable.Seq[Xml]): Xml = new Xml(elements) - } /** @@ -278,5 +273,4 @@ object JavaScriptFormat extends Format[JavaScript] { * Create an JavaScript Fragment that holds other fragments. */ def fill(elements: immutable.Seq[JavaScript]): JavaScript = new JavaScript(elements) - } diff --git a/api/shared/src/main/scala/play/twirl/api/TemplateMagic.scala b/api/shared/src/main/scala/play/twirl/api/TemplateMagic.scala index 3bbe71ed..66089d77 100644 --- a/api/shared/src/main/scala/play/twirl/api/TemplateMagic.scala +++ b/api/shared/src/main/scala/play/twirl/api/TemplateMagic.scala @@ -7,7 +7,6 @@ import scala.language.implicitConversions @deprecated("Use TwirlDefaultImports instead", "1.2.0") object TemplateMagic { - // --- UTILS def defining[T](t: T)(handler: T => Any) = { @@ -47,11 +46,9 @@ object TemplateMagic { // --- DATE class RichDate(date: java.util.Date) { - def format(pattern: String) = { new java.text.SimpleDateFormat(pattern).format(date) } - } implicit def richDate(date: java.util.Date) = new RichDate(date) @@ -59,16 +56,13 @@ object TemplateMagic { // --- STRING class RichString(string: String) { - def when(predicate: => Boolean) = { predicate match { case true => string case false => "" } } - } implicit def richString(string: String) = new RichString(string) - } diff --git a/api/shared/src/main/scala/play/twirl/api/TwirlHelperImports.scala b/api/shared/src/main/scala/play/twirl/api/TwirlHelperImports.scala index bdee1c68..8153e12f 100644 --- a/api/shared/src/main/scala/play/twirl/api/TwirlHelperImports.scala +++ b/api/shared/src/main/scala/play/twirl/api/TwirlHelperImports.scala @@ -18,23 +18,18 @@ object TwirlHelperImports { /** Allows inline formatting of java.util.Date */ implicit class TwirlRichDate(date: java.util.Date) { - def format(pattern: String): String = { new java.text.SimpleDateFormat(pattern).format(date) } - } /** Adds a when method to Strings to control when they are rendered. */ implicit class TwirlRichString(string: String) { - def when(predicate: => Boolean): String = { predicate match { case true => string case false => "" } } - } - } diff --git a/api/shared/src/main/scala/play/twirl/api/package.scala b/api/shared/src/main/scala/play/twirl/api/package.scala index 89212565..044ae606 100644 --- a/api/shared/src/main/scala/play/twirl/api/package.scala +++ b/api/shared/src/main/scala/play/twirl/api/package.scala @@ -22,7 +22,6 @@ package object api { * Three interpolators are available: `html`, `xml` and `js`. */ implicit class StringInterpolation(val sc: StringContext) extends AnyVal { - def html(args: Any*): Html = interpolate(args, HtmlFormat) def xml(args: Any*): Xml = interpolate(args, XmlFormat) @@ -43,7 +42,5 @@ package object api { } new BaseScalaTemplate[A, Format[A]](format)._display_(array) } - } - } diff --git a/api/shared/src/main/scala/play/twirl/api/utils/StringEscapeUtils.scala b/api/shared/src/main/scala/play/twirl/api/utils/StringEscapeUtils.scala index 1ad4f157..9ab24122 100644 --- a/api/shared/src/main/scala/play/twirl/api/utils/StringEscapeUtils.scala +++ b/api/shared/src/main/scala/play/twirl/api/utils/StringEscapeUtils.scala @@ -4,7 +4,6 @@ package play.twirl.api.utils object StringEscapeUtils { - def escapeEcmaScript(input: String): String = { val s = new StringBuilder() val len = input.length @@ -57,5 +56,4 @@ object StringEscapeUtils { s.toString() } - } diff --git a/api/shared/src/test/scala/play/twirl/api/test/BufferedContentSpec.scala b/api/shared/src/test/scala/play/twirl/api/test/BufferedContentSpec.scala index 44e9dc7b..8986c912 100644 --- a/api/shared/src/test/scala/play/twirl/api/test/BufferedContentSpec.scala +++ b/api/shared/src/test/scala/play/twirl/api/test/BufferedContentSpec.scala @@ -12,7 +12,6 @@ import org.scalatest.wordspec.AnyWordSpec class BufferedContentSpec extends AnyWordSpec with Matchers { "equality checking" should { - "return false for BufferedContents with the same body but different implementations" in { Html("hello") must not be Xml("hello") Html("hello") must not be Txt("hello") @@ -54,7 +53,5 @@ class BufferedContentSpec extends AnyWordSpec with Matchers { Txt("hello") mustEqual Txt("hello") Xml("hello") mustEqual Xml("hello") } - } - } diff --git a/api/shared/src/test/scala/play/twirl/api/test/FormatSpec.scala b/api/shared/src/test/scala/play/twirl/api/test/FormatSpec.scala index 49afdf63..5380811e 100644 --- a/api/shared/src/test/scala/play/twirl/api/test/FormatSpec.scala +++ b/api/shared/src/test/scala/play/twirl/api/test/FormatSpec.scala @@ -50,5 +50,4 @@ class FormatSpec extends AnyWordSpec with Matchers { JavaScriptFormat.escape("""foo ' bar " baz \""").body must be("""foo \' bar \" baz \\""") } } - } diff --git a/api/shared/src/test/scala/play/twirl/api/test/StringInterpolationSpec.scala b/api/shared/src/test/scala/play/twirl/api/test/StringInterpolationSpec.scala index bdc32cde..56c16afd 100644 --- a/api/shared/src/test/scala/play/twirl/api/test/StringInterpolationSpec.scala +++ b/api/shared/src/test/scala/play/twirl/api/test/StringInterpolationSpec.scala @@ -38,5 +38,4 @@ class StringInterpolationSpec extends AnyWordSpec with Matchers { html"${javaList}".body mustBe "ab" } } - } diff --git a/build.sbt b/build.sbt index 017e9bb3..a0fb4098 100644 --- a/build.sbt +++ b/build.sbt @@ -3,18 +3,13 @@ import sbtcrossproject.crossProject import org.scalajs.jsenv.nodejs.NodeJSEnv // Binary compatibility is this version -val previousVersion: Option[String] = None +val previousVersion: Option[String] = Some("1.5.0") val ScalaTestVersion = "3.1.0" -def binaryCompatibilitySettings(org: String, moduleName: String, scalaBinVersion: String): Set[ModuleID] = { - if (scalaBinVersion.equals(scala213)) Set.empty - else - previousVersion match { - case None => Set.empty - case Some(pv) => Set(org % s"${moduleName}_${scalaBinVersion}" % pv) - } -} +val mimaSettings = Seq( + mimaPreviousArtifacts := previousVersion.map(organization.value %% name.value % _).toSet +) val javacParameters = Seq( "-source", @@ -88,17 +83,13 @@ lazy val api = crossProject(JVMPlatform, JSPlatform) .in(file("api")) .enablePlugins(PlayLibrary, Playdoc) .configs(Docs) - .settings(commonSettings) .settings( + commonSettings, + mimaSettings, name := "twirl-api", jsEnv := nodeJs, libraryDependencies ++= scalaXml.value, libraryDependencies += "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test", - mimaPreviousArtifacts := binaryCompatibilitySettings( - organization.value, - moduleName.value, - scalaBinaryVersion.value - ), ) lazy val apiJvm = api.jvm @@ -107,39 +98,35 @@ lazy val apiJs = api.js lazy val parser = project .in(file("parser")) .enablePlugins(PlayLibrary) - .settings(commonSettings) .settings( + commonSettings, + mimaSettings, name := "twirl-parser", libraryDependencies ++= scalaParserCombinators(scalaVersion.value), libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test", libraryDependencies += "org.scalatest" %%% "scalatest" % ScalaTestVersion % "test", - mimaPreviousArtifacts := binaryCompatibilitySettings(organization.value, moduleName.value, scalaBinaryVersion.value) ) lazy val compiler = project .in(file("compiler")) .enablePlugins(PlayLibrary) .dependsOn(apiJvm, parser % "compile;test->test") - .settings(commonSettings) .settings( + commonSettings, + mimaSettings, name := "twirl-compiler", libraryDependencies += scalaCompiler(scalaVersion.value), libraryDependencies ++= scalaParserCombinators(scalaVersion.value), fork in run := true, - mimaPreviousArtifacts := binaryCompatibilitySettings( - organization.value, - moduleName.value, - scalaBinaryVersion.value - ), ) lazy val plugin = project .in(file("sbt-twirl")) .enablePlugins(PlaySbtPlugin, SbtPlugin) .dependsOn(compiler) - .settings(javaCompilerSettings) - .settings(headerSettings) .settings( + javaCompilerSettings, + headerSettings, name := "sbt-twirl", organization := "com.typesafe.sbt", scalaVersion := scala212, diff --git a/compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala b/compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala index d455c317..bfadc746 100644 --- a/compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala +++ b/compiler/src/main/scala/play/twirl/compiler/TwirlCompiler.scala @@ -13,7 +13,6 @@ import play.twirl.parser.TwirlIO import play.twirl.parser.TwirlParser object Hash { - def apply(bytes: Array[Byte], imports: collection.Seq[String]): String = { import java.security.MessageDigest val digest = MessageDigest.getInstance("SHA-1") @@ -22,14 +21,12 @@ object Hash { imports.foreach(i => digest.update(i.getBytes("utf-8"))) digest.digest().map(0xFF & _).map { "%02x".format(_) }.foldLeft("") { _ + _ } } - } case class TemplateCompilationError(source: File, message: String, line: Int, column: Int) extends RuntimeException(message) object MaybeGeneratedSource { - def unapply(source: File): Option[GeneratedSource] = apply(source, TwirlIO.defaultCodec) def apply(source: File, codec: Codec): Option[GeneratedSource] = { @@ -40,7 +37,6 @@ object MaybeGeneratedSource { None } } - } sealed trait AbstractGeneratedSource { @@ -117,7 +113,6 @@ sealed trait AbstractGeneratedSource { } case class GeneratedSource(file: File, codec: Codec = TwirlIO.defaultCodec) extends AbstractGeneratedSource { - def content = TwirlIO.readFileAsString(file, codec) def needRecompilation(imports: collection.Seq[String]): Boolean = @@ -150,7 +145,6 @@ case class GeneratedSource(file: File, codec: Codec = TwirlIO.defaultCodec) exte file.delete() } } - } case class GeneratedSourceVirtual(path: String) extends AbstractGeneratedSource { @@ -162,7 +156,6 @@ case class GeneratedSourceVirtual(path: String) extends AbstractGeneratedSource } object TwirlCompiler { - val DefaultImports = Seq( "_root_.play.twirl.api.TwirlFeatureImports._", "_root_.play.twirl.api.TwirlHelperImports._", @@ -395,7 +388,6 @@ object TwirlCompiler { } def templateCode(template: Template, resultType: String): collection.Seq[Any] = { - val defs = (template.sub ++ template.defs).map { case t: Template if t.name.toString == "" => templateCode(t, resultType) case t: Template => { @@ -490,7 +482,6 @@ package """ :+ packageName :+ """ } object TemplateAsFunctionCompiler { - // Note, the presentation compiler is not thread safe, all access to it must be synchronized. If access to it // is not synchronized, then weird things happen like FreshRunReq exceptions are thrown when multiple sub projects // are compiled (done in parallel by default by SBT). So if adding any new methods to this object, make sure you @@ -521,7 +512,6 @@ package """ :+ packageName :+ """ private val Timeout = 10000 def getFunctionMapping(signature: String, returnType: String): (String, String, String) = synchronized { - def filterType(t: String) = t.replace("_root_.scala.", "Array") .replace("", "") @@ -619,11 +609,9 @@ package """ :+ packageName :+ """ } class CompilerInstance { - def additionalClassPathEntry: Option[String] = None lazy val compiler = { - val settings = new Settings val scalaPredefSource = Class.forName("scala.Predef").getProtectionDomain.getCodeSource @@ -664,7 +652,6 @@ package """ :+ packageName :+ """ } trait TreeCreationMethods { - val global: scala.tools.nsc.interactive.Global val randomFileName = { @@ -688,7 +675,6 @@ package """ :+ packageName :+ """ throw error } } - } object CompilerInstance extends CompilerInstance @@ -700,9 +686,7 @@ package """ :+ packageName :+ """ global.askShutdown() } } - } - } /* ------- */ @@ -714,7 +698,6 @@ import scala.util.parsing.input.NoPosition case class Source(code: String, pos: Position = NoPosition) object Source { - import scala.collection.mutable.ListBuffer def finalSource( @@ -758,7 +741,6 @@ object Source { case s: collection.Seq[any] => serialize(s, source, positions, lines) } } - } /** @@ -786,5 +768,4 @@ object StringGrouper { parts._1 :: apply(parts._2, n) } } - } diff --git a/compiler/src/test/scala/play/twirl/compiler/test/Benchmark.scala b/compiler/src/test/scala/play/twirl/compiler/test/Benchmark.scala index a61480b3..a8bf58e7 100644 --- a/compiler/src/test/scala/play/twirl/compiler/test/Benchmark.scala +++ b/compiler/src/test/scala/play/twirl/compiler/test/Benchmark.scala @@ -14,7 +14,6 @@ import play.twirl.parser.TwirlIO * sbt "compiler/test:runMain play.twirl.compiler.test.Benchmark" */ object Benchmark extends App { - val sourceDir = new File("src/test/resources") val generatedDir = new File("target/test/benchmark-templates") val generatedClasses = new File("target/test/benchmark-classes") @@ -50,5 +49,4 @@ object Benchmark extends App { template(text, input)(4).body } println("Second run: " + (System.currentTimeMillis() - start2) + "ms") - } diff --git a/compiler/src/test/scala/play/twirl/compiler/test/CompilerSpec.scala b/compiler/src/test/scala/play/twirl/compiler/test/CompilerSpec.scala index 9b7fe566..e31342d6 100644 --- a/compiler/src/test/scala/play/twirl/compiler/test/CompilerSpec.scala +++ b/compiler/src/test/scala/play/twirl/compiler/test/CompilerSpec.scala @@ -30,7 +30,6 @@ class CompilerSpec extends AnyWordSpec with Matchers { } testName should { - "compile successfully (real)" in { val helper = newCompilerHelper val tmpl = helper @@ -192,7 +191,6 @@ class CompilerSpec extends AnyWordSpec with Matchers { } "support injectable templates" when { - "plain injected template" in { val helper = newCompilerHelper val template = helper.compile[String => Html]("inject.scala.html", "html.inject").inject("Hello", 10) @@ -219,7 +217,6 @@ class CompilerSpec extends AnyWordSpec with Matchers { helper.compile[String => Html]("injectComments.scala.html", "html.injectComments").inject("Hello", 10) template("world").body.trim mustBe "Hello 10 world" } - } } @@ -293,15 +290,12 @@ class CompilerSpec extends AnyWordSpec with Matchers { ) hello.static(args).toString.trim must be("the-key => the-value") } - } object Helper { - case class CompilationError(message: String, line: Int, column: Int) extends RuntimeException(message) class CompilerHelper(sourceDir: File, generatedDir: File, generatedClasses: File) { - import java.net._ import scala.collection.mutable @@ -321,7 +315,6 @@ object Helper { val compileErrors = new mutable.ListBuffer[CompilationError] val compiler = { - def additionalClassPathEntry: Option[String] = Some( Class @@ -360,7 +353,6 @@ object Helper { } class CompiledTemplate[T](className: String) { - private def getF(template: Any) = { template.getClass.getMethod("f").invoke(template).asInstanceOf[T] } @@ -409,6 +401,5 @@ object Helper { new CompiledTemplate[T](className) } - } } diff --git a/compiler/src/test/scala/play/twirl/compiler/test/TemplateUtilsSpec.scala b/compiler/src/test/scala/play/twirl/compiler/test/TemplateUtilsSpec.scala index f145c625..5b242cf9 100644 --- a/compiler/src/test/scala/play/twirl/compiler/test/TemplateUtilsSpec.scala +++ b/compiler/src/test/scala/play/twirl/compiler/test/TemplateUtilsSpec.scala @@ -13,15 +13,12 @@ import org.scalatest.wordspec.AnyWordSpec class TemplateUtilsSpec extends AnyWordSpec with Matchers { "Templates" should { - "provide a HASH util" in { Hash("itShouldWork".getBytes, Nil) must be("31c0c4e0e142fe9b605fff44528fedb3dd8ae254") } "provide a Format API" when { - "HTML for example" in { - case class Html(_text: String) extends BufferedContent[Html](Nil, _text) { val contentType = "text/html" } @@ -39,7 +36,6 @@ class TemplateUtilsSpec extends AnyWordSpec with Matchers { } "Text for example" in { - case class Text(_text: String) extends BufferedContent[Text](Nil, _text) { val contentType = "text/plain" } @@ -54,7 +50,6 @@ class TemplateUtilsSpec extends AnyWordSpec with Matchers { val text = TextFormat.raw("

").body + TextFormat.escape("Hello ").body + TextFormat.raw("

").body text must be("

Hello

") - } } } diff --git a/parser/src/main/scala/play/twirl/parser/TwirlIO.scala b/parser/src/main/scala/play/twirl/parser/TwirlIO.scala index ba12aa8b..df2c3ddb 100644 --- a/parser/src/main/scala/play/twirl/parser/TwirlIO.scala +++ b/parser/src/main/scala/play/twirl/parser/TwirlIO.scala @@ -13,7 +13,6 @@ import java.net.URL * This is intentionally not public API. */ private[twirl] object TwirlIO { - val defaultEncoding = scala.util.Properties.sourceEncoding val defaultCodec = Codec(defaultEncoding) diff --git a/parser/src/main/scala/play/twirl/parser/TwirlParser.scala b/parser/src/main/scala/play/twirl/parser/TwirlParser.scala index 663613e8..9663d901 100644 --- a/parser/src/main/scala/play/twirl/parser/TwirlParser.scala +++ b/parser/src/main/scala/play/twirl/parser/TwirlParser.scala @@ -89,7 +89,6 @@ import scala.util.parsing.input.OffsetPosition * - Invalid ("alone") '@' symbols. */ class TwirlParser(val shouldParseInclusiveDot: Boolean) { - import play.twirl.parser.TreeNodes._ import scala.util.parsing.input.Positional @@ -983,7 +982,6 @@ class TwirlParser(val shouldParseInclusiveDot: Boolean) { Success(template, input) else Error(template, input, errorStack.toList) - } def mkRegressionStatisticsString(): Unit = { diff --git a/parser/src/test/scala/play/twirl/parser/test/ParserSpec.scala b/parser/src/test/scala/play/twirl/parser/test/ParserSpec.scala index 9597daed..73e84414 100644 --- a/parser/src/test/scala/play/twirl/parser/test/ParserSpec.scala +++ b/parser/src/test/scala/play/twirl/parser/test/ParserSpec.scala @@ -56,9 +56,7 @@ class ParserSpec extends AnyWordSpec with Matchers with Inside { } "New twirl parser" should { - "succeed for" when { - "static.scala.html" in { parseSuccess("static.scala.html") } @@ -169,7 +167,6 @@ class ParserSpec extends AnyWordSpec with Matchers with Inside { } "handle string literals within parentheses" when { - "with left parenthesis" in { parseStringSuccess("""@foo("(")""") } @@ -177,7 +174,6 @@ class ParserSpec extends AnyWordSpec with Matchers with Inside { "with right parenthesis and '@'" in { parseStringSuccess("""@foo(")@")""") } - } "handle escaped closing curly braces" in { @@ -185,7 +181,6 @@ class ParserSpec extends AnyWordSpec with Matchers with Inside { } "fail for" when { - "unclosedBracket.scala.html" in { parseFailure("unclosedBracket.scala.html", "Expected '}' but found 'EOF'", 12, 6) } @@ -197,9 +192,6 @@ class ParserSpec extends AnyWordSpec with Matchers with Inside { "invalidAt.scala.html" in { parseFailure("invalidAt.scala.html", "Invalid '@' symbol", 5, 5) } - } - } - } diff --git a/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateCompilerErrorHandler.scala b/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateCompilerErrorHandler.scala index 2ee7e27d..60de0e1c 100644 --- a/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateCompilerErrorHandler.scala +++ b/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateCompilerErrorHandler.scala @@ -10,7 +10,6 @@ import sbt.internal.inc.LoggedReporter import scala.io.Codec trait TemplateCompilerErrorHandler { - def handleError(log: Logger, codec: Codec): PartialFunction[Throwable, Nothing] = { case TemplateCompilationError(source, message, line, column) => val exception = TemplateProblem.exception(source, codec, message, line, column) diff --git a/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateProblem.scala b/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateProblem.scala index 4efd4be1..8bdece07 100644 --- a/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateProblem.scala +++ b/sbt-twirl/src/main/scala-sbt-1.0/play/twirl/sbt/TemplateProblem.scala @@ -15,7 +15,6 @@ import xsbti.Severity import scala.io.Codec object TemplateProblem { - def positionMapper(codec: Codec): Position => Option[Position] = position => { toScala(position.sourceFile).flatMap(f => MaybeGeneratedSource(f, codec)).map { generated => TemplatePosition(generated, position) diff --git a/sbt-twirl/src/main/scala/play/twirl/sbt/SbtTwirl.scala b/sbt-twirl/src/main/scala/play/twirl/sbt/SbtTwirl.scala index af1df5cb..ba41a033 100644 --- a/sbt-twirl/src/main/scala/play/twirl/sbt/SbtTwirl.scala +++ b/sbt-twirl/src/main/scala/play/twirl/sbt/SbtTwirl.scala @@ -28,7 +28,6 @@ object Import { } object SbtTwirl extends AutoPlugin { - import Import.TwirlKeys._ val autoImport = Import diff --git a/sbt-twirl/src/main/scala/play/twirl/sbt/TemplateCompiler.scala b/sbt-twirl/src/main/scala/play/twirl/sbt/TemplateCompiler.scala index 33ec45dc..f9c32d4c 100644 --- a/sbt-twirl/src/main/scala/play/twirl/sbt/TemplateCompiler.scala +++ b/sbt-twirl/src/main/scala/play/twirl/sbt/TemplateCompiler.scala @@ -43,7 +43,6 @@ object TemplateCompiler extends TemplateCompilerErrorHandler { codec: Codec, log: Logger ): Seq[File] = { - try { syncGenerated(targetDirectory, codec) val templates = collectTemplates(sourceDirectories, templateFormats, includeFilter, excludeFilter) diff --git a/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplateMappingSpec.scala b/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplateMappingSpec.scala index 1dd57b06..dd092015 100644 --- a/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplateMappingSpec.scala +++ b/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplateMappingSpec.scala @@ -13,7 +13,6 @@ import org.scalatest.wordspec.AnyWordSpec class TemplateMappingSpec extends AnyWordSpec with Matchers with Inspectors { "TemplateMapping" should { - "handle empty templates" in { val mapping = TemplateMapping(Seq.empty) diff --git a/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplatePositionSpec.scala b/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplatePositionSpec.scala index 80954d64..5e222505 100644 --- a/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplatePositionSpec.scala +++ b/sbt-twirl/src/test/scala/play/twirl/sbt/test/TemplatePositionSpec.scala @@ -14,9 +14,7 @@ import org.scalatest.wordspec.AnyWordSpec class TemplatePositionSpec extends AnyWordSpec with Matchers with Inspectors { "TemplatePosition" should { - "toString" should { - "have the source path" in { val file = new File("/some/path/file.scala.html") val location = TemplateMapping.Location(line = 10, column = 2, offset = 22, content = "some content") @@ -71,5 +69,4 @@ class TemplatePositionSpec extends AnyWordSpec with Matchers with Inspectors { } } } - }