Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix duplicate application.ini mappings when both BASH and BAT plugins are used #1056

Merged
merged 1 commit into from
Oct 29, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,25 @@ trait ApplicationIniGenerator {
val pathMapping = cleanApplicationIniPath(location)
//Do not use writeLines here because of issue #637
IO.write(configFile, ("# options from build" +: javaOptions).mkString("\n"))
val hasConflict = universalMappings.exists {
case (file, path) => file != configFile && path == pathMapping
}
// Warn the user if he tries to specify options
if (hasConflict) {
log.warn("--------!!! JVM Options are defined twice !!!-----------")
log.warn(
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
)
val filteredMappings = universalMappings.filter {
case (`configFile`, `pathMapping`) =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting implementation. I didn't get at first what was happening here. The second call to the method
will filter the already created config file.

// ignore duplicate application.ini mappings with identical contents
// for example when using both the BASH and BAT plugin
false

case (_, `pathMapping`) =>
// specified a custom application.ini file *and* JVM options
// TODO: merge JVM options into the existing application.ini?
log.warn("--------!!! JVM Options are defined twice !!!-----------")
log.warn(
"application.ini is already present in output package. Will be overridden by 'javaOptions in Universal'"
)
false

case _ =>
true
}
(configFile -> pathMapping) +: universalMappings
(configFile -> pathMapping) +: filteredMappings

}
.getOrElse(universalMappings)
Expand Down