From e309a255f02701f27e9d6b9c035f584e11dfcc43 Mon Sep 17 00:00:00 2001 From: xuwei-k <6b656e6a69@gmail.com> Date: Tue, 8 Oct 2024 07:29:49 +0900 Subject: [PATCH] deprecate g8ScriptedCompat --- .../scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala | 2 ++ plugin/src/main/scala/Giter8Plugin.scala | 14 +++++++++----- plugin/src/sbt-test/giter8/simple/build.sbt | 2 +- plugin/src/sbt-test/giter8/without-name/build.sbt | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/plugin/src/main/scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala b/plugin/src/main/scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala index dc1a840f..12bc0d18 100644 --- a/plugin/src/main/scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala +++ b/plugin/src/main/scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala @@ -18,8 +18,10 @@ package sbt package sbtgiter8 +@deprecated("will be removed") object SBTCompat extends ScriptedCompat +@deprecated("will be removed") trait ScriptedCompat { val finalScriptName = "test.script" val scriptedSettings = sbt.ScriptedPlugin.projectSettings diff --git a/plugin/src/main/scala/Giter8Plugin.scala b/plugin/src/main/scala/Giter8Plugin.scala index 32ecccae..8efddb31 100644 --- a/plugin/src/main/scala/Giter8Plugin.scala +++ b/plugin/src/main/scala/Giter8Plugin.scala @@ -19,8 +19,11 @@ package giter8 import sbt._ import sbt.Path.relativeTo -import sbt.sbtgiter8.{SBTCompat, ScriptedCompat} -import sbt.sbtgiter8.SBTCompat._ +import sbt.sbtgiter8.ScriptedCompat +import sbt.ScriptedPlugin.autoImport.scriptedBufferLog +import sbt.ScriptedPlugin.autoImport.scriptedLaunchOpts +import sbt.ScriptedPlugin.autoImport.scriptedDependencies +import sbt.ScriptedPlugin.autoImport.sbtTestDirectory object Giter8Plugin extends sbt.AutoPlugin { override val requires = sbt.plugins.JvmPlugin @@ -29,6 +32,7 @@ object Giter8Plugin extends sbt.AutoPlugin { import Keys._ object autoImport { + @deprecated("will be removed") object g8ScriptedCompat extends ScriptedCompat lazy val g8 = taskKey[Seq[File]]("Apply default parameters to input templates and write to output.") @@ -102,9 +106,9 @@ object Giter8Plugin extends sbt.AutoPlugin { } ) - lazy val giter8TestSettings: Seq[Def.Setting[?]] = SBTCompat.scriptedSettings ++ + lazy val giter8TestSettings: Seq[Def.Setting[?]] = ScriptedPlugin.projectSettings ++ Seq( - Test / g8Test := { scriptedTask.evaluated }, + Test / g8Test := { ScriptedPlugin.autoImport.scripted.evaluated }, Test / g8Test / aggregate := false, scriptedDependencies := { val x = (Test / g8).value @@ -130,7 +134,7 @@ object Giter8Plugin extends sbt.AutoPlugin { // copy test script or generate one // the final script should always be called "test.script" // no matter how it was originally called by user - val script = new File(out, finalScriptName) + val script = new File(out, "test.script") if (ts.exists) IO.copyFile(ts, script) else IO.write(script, """>test""") diff --git a/plugin/src/sbt-test/giter8/simple/build.sbt b/plugin/src/sbt-test/giter8/simple/build.sbt index d6a0ef1d..8d592e39 100644 --- a/plugin/src/sbt-test/giter8/simple/build.sbt +++ b/plugin/src/sbt-test/giter8/simple/build.sbt @@ -7,4 +7,4 @@ val javaVmArgs: List[String] = { java.lang.management.ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList } -g8ScriptedCompat.scriptedLaunchOpts ++= javaVmArgs.filter(a => Seq("-Xmx", "-Xms", "-XX").exists(a.startsWith)) +scriptedLaunchOpts ++= javaVmArgs.filter(a => Seq("-Xmx", "-Xms", "-XX").exists(a.startsWith)) diff --git a/plugin/src/sbt-test/giter8/without-name/build.sbt b/plugin/src/sbt-test/giter8/without-name/build.sbt index c9f01996..67f58d9e 100644 --- a/plugin/src/sbt-test/giter8/without-name/build.sbt +++ b/plugin/src/sbt-test/giter8/without-name/build.sbt @@ -3,4 +3,4 @@ val javaVmArgs: List[String] = { java.lang.management.ManagementFactory.getRuntimeMXBean.getInputArguments.asScala.toList } -g8ScriptedCompat.scriptedLaunchOpts ++= javaVmArgs.filter(a => Seq("-Xmx", "-Xms", "-XX").exists(a.startsWith)) +scriptedLaunchOpts ++= javaVmArgs.filter(a => Seq("-Xmx", "-Xms", "-XX").exists(a.startsWith))