Skip to content

Commit

Permalink
Merge pull request #916 from xuwei-k/g8ScriptedCompat
Browse files Browse the repository at this point in the history
deprecate g8ScriptedCompat
  • Loading branch information
eed3si9n authored Oct 7, 2024
2 parents 1d65115 + e309a25 commit b7a7d0c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions plugin/src/main/scala-sbt-1.0/sbt/sbtgiter8/SBTCompat.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions plugin/src/main/scala/Giter8Plugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.")
Expand Down Expand Up @@ -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
Expand All @@ -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""")

Expand Down
2 changes: 1 addition & 1 deletion plugin/src/sbt-test/giter8/simple/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
2 changes: 1 addition & 1 deletion plugin/src/sbt-test/giter8/without-name/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit b7a7d0c

Please sign in to comment.