Why does sbt-native-packager generate a hardcoded top-level parent directory in distribution packages?

StackOverflow https://stackoverflow.com/questions/20133164

  •  03-08-2022
  •  | 
  •  

Question

For example, in Archives.scala:

def makeZip(target: File, name: String, mappings: Seq[(File, String)]): File = {
  ...
  val m2 = mappings map { case (f, p) => f -> (name +"/"+p) }

def makeTarball(compressor: File => File, ext: String)(target: File, name: String, mappings: Seq[(File, String)]): File = {
  ...
  val m2 = mappings map { case (f, p) => f -> (rdir / name / p) }

I'm trying to understand the reason why this additional directory "name" must be hardcoded inside these functions. In the old distribution packages (prior to sbt-native-packager), I don't believe this extra directory level was there. We're trying to use sbt-native-packager to create some distribution zip/tgz's which do not have this, and for the moment have copied and hacked the code inside Archives.scala so that the mappings: Seq[(File, String)] correspond directly to the structure inside the distribution packages rather than with having the additional "name" directory, but obviously this is not ideal. Perhaps someone familiar with this domain could shed some light on this? (@jsuereth, I'm looking at you :))

Was it helpful?

Solution

This is more due to expections on my end than anything. You should open a ticket to enhance the project so this behavior is configurable via a flag.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top