Skip to content

Commit

Permalink
Forward -Dsbt.ivy.home property in scripted tests if set
Browse files Browse the repository at this point in the history
  • Loading branch information
timaliberdov committed Jul 5, 2023
1 parent 30b4505 commit d49ebda
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 1 addition & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
lazy val sbtKotlinPlugin = project.in(file("."))
.enablePlugins(SbtPlugin)
.settings(Scripted.settings)
.settings(Publishing.settings)
.settings(
name := "sbt-kotlin-plugin",
Expand All @@ -9,6 +10,4 @@ lazy val sbtKotlinPlugin = project.in(file("."))
scalaVersion := "2.12.17",
scalacOptions ++= Seq("-deprecation", "-feature", "-Werror", "-Xlint", "-release", "8"),
javacOptions ++= Seq("--release", "8"),

scriptedLaunchOpts += "-Dplugin.version=" + version.value,
)
19 changes: 19 additions & 0 deletions project/Scripted.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import sbt.Def
import sbt.Keys.version
import sbt.ScriptedPlugin.autoImport.scriptedLaunchOpts

object Scripted {
private val SbtIvyHome = "sbt.ivy.home"

private val passPluginVersion =
scriptedLaunchOpts += "-Dplugin.version=" + version.value

private val forwardIvyHomeProperty =
scriptedLaunchOpts ++= sys.props.get(SbtIvyHome)
.map(ivyHome => s"-D$SbtIvyHome=$ivyHome")

val settings: Seq[Def.Setting[?]] = Seq(
passPluginVersion,
forwardIvyHomeProperty,
)
}

0 comments on commit d49ebda

Please sign in to comment.