Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What means "xs @ _*" in PathList of SBT assembly-plugin?

What these phrases mean:

xs @ _*

ps @ _*

Copied from documentation:

assemblyMergeStrategy in assembly := {
  case PathList("javax", "servlet", xs @ _*)         => MergeStrategy.first
  case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
  case "application.conf"                            => MergeStrategy.concat
  case "unwanted.txt"                                => MergeStrategy.discard
  case x =>
    val oldStrategy = (assemblyMergeStrategy in assembly).value
    oldStrategy(x)
}
like image 879
Aleks Ya Avatar asked Mar 14 '17 13:03

Aleks Ya


2 Answers

In your example _* means everything, @ for matching

xs @ _* is case pattern means pick every thing that matched for first case /javax/servlet/*

ps @ _* means pick up all that match as /* and with html extension

like image 62
FaigB Avatar answered Oct 21 '22 01:10

FaigB


'@' operator is used to bind to variables in pattern matching.

<somevar> : _* is used to unpack varargs as sequence of appropriate type.

In this example ps @ _* tells pattern matching to retrieve varargs from PathList as Sequence of paths.

like image 41
Jakub Bartczuk Avatar answered Oct 21 '22 01:10

Jakub Bartczuk