mirror of https://github.com/sbt/sbt.git
Adding env vars at ScalaMainClass creation time
This commit is contained in:
parent
970ce22aca
commit
75a5135417
|
|
@ -503,7 +503,10 @@ object BuildServerProtocol {
|
|||
ErrorCodes.ParseError,
|
||||
e.getMessage
|
||||
)
|
||||
case Success(value) => value
|
||||
case Success(value) =>
|
||||
value.withEnvironmentVariables(
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector ++ value.environmentVariables
|
||||
)
|
||||
}
|
||||
|
||||
case Some(dataKind) =>
|
||||
|
|
@ -522,7 +525,7 @@ object BuildServerProtocol {
|
|||
),
|
||||
runParams.arguments,
|
||||
defaultJvmOptions.toVector,
|
||||
Vector.empty
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -588,7 +591,7 @@ object BuildServerProtocol {
|
|||
workingDirectory = Some(baseDirectory.value),
|
||||
runJVMOptions = mainClass.jvmOptions,
|
||||
connectInput = connectInput.value,
|
||||
envVars = envVars.value ++ mainClass.environmentVariables
|
||||
envVars = mainClass.environmentVariables
|
||||
.flatMap(_.split("=", 2).toList match {
|
||||
case key :: value :: Nil => Some(key -> value)
|
||||
case _ => None
|
||||
|
|
@ -655,7 +658,12 @@ object BuildServerProtocol {
|
|||
private def scalaMainClassesTask: Initialize[Task[ScalaMainClassesItem]] = Def.task {
|
||||
val jvmOptions = Keys.javaOptions.value.toVector
|
||||
val mainClasses = Keys.discoveredMainClasses.value.map(
|
||||
ScalaMainClass(_, Vector(), jvmOptions, Vector.empty)
|
||||
ScalaMainClass(
|
||||
_,
|
||||
Vector(),
|
||||
jvmOptions,
|
||||
envVars.value.map { case (k, v) => s"$k=$v" }.toVector
|
||||
)
|
||||
)
|
||||
ScalaMainClassesItem(
|
||||
bspTargetIdentifier.value,
|
||||
|
|
|
|||
Loading…
Reference in New Issue