From d1b5c2527527098a88e88bef90dcc7c25c85579b Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Mon, 7 Oct 2024 07:40:45 +0900 Subject: [PATCH] use new slash syntax in test --- bak/play-twirl/test.sbt | 4 ++-- .../auto-detection-end-year/test.sbt | 4 ++-- .../sbt-header/auto-detection/test.sbt | 4 ++-- .../sbt-header/custom-license/test.sbt | 4 ++-- src/sbt-test/sbt-header/excludes/test.sbt | 22 +++++++++---------- src/sbt-test/sbt-header/header-style/test.sbt | 4 ++-- src/sbt-test/sbt-header/incremental/test.sbt | 10 ++++----- .../sbt-header/no-file-extensions/test.sbt | 4 ++-- .../override-default-mappings/test.sbt | 4 ++-- src/sbt-test/sbt-header/simple/test.sbt | 12 +++++----- src/sbt-test/sbt-header/xml/test.sbt | 4 ++-- 11 files changed, 38 insertions(+), 38 deletions(-) diff --git a/bak/play-twirl/test.sbt b/bak/play-twirl/test.sbt index 4866183..33e8701 100644 --- a/bak/play-twirl/test.sbt +++ b/bak/play-twirl/test.sbt @@ -11,8 +11,8 @@ checkFileContents := { checkFile("views/main.scala.html") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (scalaSource.in(Compile).value / (name + "_expected")).toString + val actualPath = (Compile / scalaSource).value / name).toString + val expectedPath = (Compile / scalaSource).value / (name + "_expected")).toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt b/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt index a2de471..76fbebb 100644 --- a/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt +++ b/src/sbt-test/sbt-header/auto-detection-end-year/test.sbt @@ -9,8 +9,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/auto-detection/test.sbt b/src/sbt-test/sbt-header/auto-detection/test.sbt index cbfa2a6..ffd30c2 100644 --- a/src/sbt-test/sbt-header/auto-detection/test.sbt +++ b/src/sbt-test/sbt-header/auto-detection/test.sbt @@ -8,8 +8,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/custom-license/test.sbt b/src/sbt-test/sbt-header/custom-license/test.sbt index 61768c2..aa2c444 100644 --- a/src/sbt-test/sbt-header/custom-license/test.sbt +++ b/src/sbt-test/sbt-header/custom-license/test.sbt @@ -14,8 +14,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/excludes/test.sbt b/src/sbt-test/sbt-header/excludes/test.sbt index 6782d70..60639ef 100644 --- a/src/sbt-test/sbt-header/excludes/test.sbt +++ b/src/sbt-test/sbt-header/excludes/test.sbt @@ -1,25 +1,25 @@ headerLicense := Some(HeaderLicense.ALv2("2015", "Heiko Seeberger")) -excludeFilter.in(headerSources) := HiddenFileFilter || "*Excluded.scala" +headerSources / excludeFilter := HiddenFileFilter || "*Excluded.scala" val checkFiles = taskKey[Unit]("Verify files match expected files") checkFiles := { val includeFiles = Seq( - (scalaSource.in(Compile).value / "Included.scala").toString, - (scalaSource.in(Compile).value / "de/heikoseeberger/allincluded/Included.scala").toString, - (scalaSource.in(Compile).value / "de/heikoseeberger/mixed/Included.scala").toString + ((Compile / scalaSource).value / "Included.scala").toString, + ((Compile / scalaSource).value / "de/heikoseeberger/allincluded/Included.scala").toString, + ((Compile / scalaSource).value / "de/heikoseeberger/mixed/Included.scala").toString ) val excludeFiles = Seq( - (scalaSource.in(Compile).value / "Excluded.scala").toString, - (scalaSource.in(Compile).value / "de/heikoseeberger/allexcluded/Excluded.scala").toString, - (scalaSource.in(Compile).value / "de/heikoseeberger/mixed/Excluded.scala").toString + ((Compile / scalaSource).value / "Excluded.scala").toString, + ((Compile / scalaSource).value / "de/heikoseeberger/allexcluded/Excluded.scala").toString, + ((Compile / scalaSource).value / "de/heikoseeberger/mixed/Excluded.scala").toString ) // Check list of source files to process - val nonHeaderCreateSources = unmanagedSources.in(Compile).value - val headerCreateSources = headerSources.in(Compile).value + val nonHeaderCreateSources = (Compile / unmanagedSources).value + val headerCreateSources = (Compile / headerSources).value def assertPathSetEquality(a: Seq[File], b: Seq[File], failureMessage: String): Unit = { val aSet = a.map(_.getCanonicalPath).toSet @@ -51,9 +51,9 @@ checkFiles := { // Check contents of files val expectedExcludedFile = - (resourceDirectory.in(Compile).value / "Excluded.scala_expected").toString + ((Compile / resourceDirectory).value / "Excluded.scala_expected").toString val expectedIncludedFile = - (resourceDirectory.in(Compile).value / "Included.scala_expected").toString + ((Compile / resourceDirectory).value / "Included.scala_expected").toString checkFileContents(excludeFiles, expectedExcludedFile) checkFileContents(includeFiles, expectedIncludedFile) diff --git a/src/sbt-test/sbt-header/header-style/test.sbt b/src/sbt-test/sbt-header/header-style/test.sbt index 7bcaf2f..a294957 100644 --- a/src/sbt-test/sbt-header/header-style/test.sbt +++ b/src/sbt-test/sbt-header/header-style/test.sbt @@ -8,8 +8,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/incremental/test.sbt b/src/sbt-test/sbt-header/incremental/test.sbt index 02be859..edcded8 100644 --- a/src/sbt-test/sbt-header/incremental/test.sbt +++ b/src/sbt-test/sbt-header/incremental/test.sbt @@ -11,8 +11,8 @@ stripHeader := { stripHeader("HasHeader.scala") def stripHeader(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val headerDropped = (resourceDirectory.in(Compile).value / s"${name}_headerdropped").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val headerDropped = ((Compile / resourceDirectory).value / s"${name}_headerdropped").toString Files.delete(file(actualPath).toPath) Files.copy(file(headerDropped).toPath, file(actualPath).toPath) @@ -24,8 +24,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString @@ -41,6 +41,6 @@ checkFileContents := { } removeFile := { - val actualPath = scalaSource.in(Compile).value / "HasNoHeader.scala" + val actualPath = (Compile / scalaSource).value / "HasNoHeader.scala" Files.delete(actualPath.toPath) } diff --git a/src/sbt-test/sbt-header/no-file-extensions/test.sbt b/src/sbt-test/sbt-header/no-file-extensions/test.sbt index f68b6df..a0867e5 100644 --- a/src/sbt-test/sbt-header/no-file-extensions/test.sbt +++ b/src/sbt-test/sbt-header/no-file-extensions/test.sbt @@ -19,8 +19,8 @@ checkFileContents := { checkFile(".routes") def checkFile(name: String) = { - val actualPath = (resourceDirectory.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / resourceDirectory).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/override-default-mappings/test.sbt b/src/sbt-test/sbt-header/override-default-mappings/test.sbt index 8f46b57..6f24ca8 100644 --- a/src/sbt-test/sbt-header/override-default-mappings/test.sbt +++ b/src/sbt-test/sbt-header/override-default-mappings/test.sbt @@ -8,8 +8,8 @@ checkFileContents := { checkFile("HasNoHeader.scala") def checkFile(name: String) = { - val actualPath = (scalaSource.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / scalaSource).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/simple/test.sbt b/src/sbt-test/sbt-header/simple/test.sbt index d15bcd6..dfaa693 100644 --- a/src/sbt-test/sbt-header/simple/test.sbt +++ b/src/sbt-test/sbt-header/simple/test.sbt @@ -10,15 +10,15 @@ unmanagedResources / excludeFilter := (_ => false) val checkFileContents = taskKey[Unit]("Verify file contents match expected contents") checkFileContents := { - checkFile("HasHeader.scala", scalaSource.in(Compile).value) - checkFile("HasNoHeader.scala", scalaSource.in(Compile).value) - checkFile("routes", resourceDirectory.in(Compile).value) - checkFile(".routes", resourceDirectory.in(Compile).value) // does not have extension, file name is only ".routes" - checkFile(".some.routes", resourceDirectory.in(Compile).value) // hidden file with extension .routes + checkFile("HasHeader.scala", (Compile / scalaSource).value) + checkFile("HasNoHeader.scala", (Compile / scalaSource).value) + checkFile("routes", (Compile / resourceDirectory).value) + checkFile(".routes", (Compile / resourceDirectory).value) // does not have extension, file name is only ".routes" + checkFile(".some.routes", (Compile / resourceDirectory).value) // hidden file with extension .routes def checkFile(name: String, sourceDir: sbt.File) = { val actualPath = (sourceDir / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString diff --git a/src/sbt-test/sbt-header/xml/test.sbt b/src/sbt-test/sbt-header/xml/test.sbt index b5110ba..31b0c59 100644 --- a/src/sbt-test/sbt-header/xml/test.sbt +++ b/src/sbt-test/sbt-header/xml/test.sbt @@ -11,8 +11,8 @@ checkFileContents := { checkFile("order-no-header-no-xmldeclaration.xml") def checkFile(name: String) = { - val actualPath = (resourceDirectory.in(Compile).value / name).toString - val expectedPath = (resourceDirectory.in(Compile).value / s"${name}_expected").toString + val actualPath = ((Compile / resourceDirectory).value / name).toString + val expectedPath = ((Compile / resourceDirectory).value / s"${name}_expected").toString val actual = scala.io.Source.fromFile(actualPath).mkString val expected = scala.io.Source.fromFile(expectedPath).mkString