Skip to content

Commit

Permalink
chore: use SystemProperties.isSystemPropertyPropagated
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed Dec 18, 2024
1 parent 32a1fcb commit 6ff6fdb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ githubPath := "gatling/gatling-sbt-plugin"

libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.19" % Test,
"io.gatling" % "gatling-enterprise-plugin-commons" % "1.11.0",
"io.gatling" % "gatling-enterprise-plugin-commons" % "1.12.0",
"io.gatling" % "gatling-shared-cli" % "0.0.5"
)

Expand Down
12 changes: 2 additions & 10 deletions src/main/scala/io/gatling/sbt/settings/BaseSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package io.gatling.sbt.settings
import scala.jdk.CollectionConverters._

import io.gatling.plugin.GatlingConstants
import io.gatling.plugin.util.SystemProperties
import io.gatling.sbt.GatlingPlugin.gatlingTestFramework
import io.gatling.sbt.settings.gatling._

Expand All @@ -31,20 +32,11 @@ object BaseSettings {
// the JVM gives precedence to the rightmost values
propagatedSystemProperties ++ GatlingConstants.DEFAULT_JVM_OPTIONS_GATLING.asScala ++ javaOptions

private val unPropagatedPropertiesRoots =
List("java.", "sun.", "jline.", "file.", "awt.", "os.", "user.")

private def isPropagatedSystemProperty(name: String) =
!(unPropagatedPropertiesRoots.exists(name.startsWith) ||
name == "line.separator" ||
name == "path.separator" ||
name == "gopherProxySet")

private def property(key: String, value: String) = s"-D$key=$value"

private def propagatedSystemProperties: Seq[String] =
sys.props
.filterKeys(isPropagatedSystemProperty)
.filterKeys(SystemProperties.isSystemPropertyPropagated)
.map { case (key, value) => property(key, value) }
.toSeq

Expand Down

0 comments on commit 6ff6fdb

Please sign in to comment.