Skip to content

Commit

Permalink
fix: Bundle should package configuration files, close #4409
Browse files Browse the repository at this point in the history
  • Loading branch information
slandelle committed May 7, 2023
1 parent f7214a3 commit b1d87ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ object CommandArguments {
extraJavaOptionsCompile = Nil,
extraJavaOptionsRun = Nil,
binariesDirectory = CommandHelper.DefaultBinariesDirectory,
resourcesDirectory = CommandHelper.DefaultResourcesDirectory
resourcesDirectory = CommandHelper.DefaultResourcesDirectory,
confDirectory = CommandHelper.ConfDirectory
)

sealed abstract class RunMode(val value: String)
Expand Down Expand Up @@ -69,5 +70,6 @@ final case class CommandArguments(
extraJavaOptionsCompile: List[String],
extraJavaOptionsRun: List[String],
binariesDirectory: Path,
resourcesDirectory: Path
resourcesDirectory: Path,
confDirectory: Path
)
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,15 @@ private[bundle] object CommandHelper {
val DefaultResourcesDirectory: Path = GatlingHome.resolve("user-files").resolve("resources")
val TargetDirectory: Path = GatlingHome.resolve("target")
val DefaultBinariesDirectory: Path = TargetDirectory.resolve("test-classes")
val ConfDirectory: Path = optionEnv("GATLING_CONF").map(Paths.get(_).toAbsolutePath).getOrElse(GatlingHome.resolve("conf"))

val GatlingLibs: List[String] = {
val libDirectory: Path = GatlingHome.resolve("lib")
listFiles(libDirectory)
}

val UserLibs: List[String] = listFiles(UserLibDirectory)
val GatlingConfFiles: List[String] = {
val gatlingConfDirectory: Path = optionEnv("GATLING_CONF").map(Paths.get(_).toAbsolutePath).getOrElse(GatlingHome.resolve("conf"))
gatlingConfDirectory.toString +: listFiles(gatlingConfDirectory)
}
val GatlingConfFiles: List[String] = ConfDirectory.toString +: listFiles(ConfDirectory)

private def optionEnv(env: String): Option[String] =
sys.env.get(env).map(_.trim).filter(_.nonEmpty)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ private[bundle] final class EnterprisePackageCommand(config: CommandArguments, a
addManifest(writeEntry)
addJarEntries(config.binariesDirectory, writeEntry)
addJarEntries(config.resourcesDirectory, writeEntry)
addJarEntries(config.confDirectory, writeEntry)
addJarsContents(UserLibDirectory, writeEntry)

println("Package created")
Expand Down

0 comments on commit b1d87ea

Please sign in to comment.