-
Notifications
You must be signed in to change notification settings - Fork 441
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
Add the ability to copy content of directory into the installation directory #159
Conversation
…rectory. It only works for universal:stage task.
Hi @ivanfrain, Thank you for your contribution! We really value the time you've taken to put this together. Before we proceed with reviewing this pull request, please sign the Typesafe Contributors License Agreement: |
Hey @ivanfrain Thanks for trying to improve the packager! A few notes:
mappings in Universal ++= allFilesRelativeTo(file("/foo/bar") would be much better. Finally, anything in Thanks!
|
// copy files | ||
IO.copy(files) | ||
//copy directories with there full content | ||
directories.map {case (f, p) => IO.copyDirectory(f, p, overwrite = true)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens with executable files inside these directories? I think a recursive call to stageFilesAndDirectories
would be better here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About your note number 1, yes, I know that it fixes only stage element and it does not have any action on the generation of the zip file. I thought it was better than nothing for the moment. I need to dive a little bit more in sbt and sbt-native-packager comprehesion in order to propose something relevant for all the scopes you mentionned MSI/DEB/RPM ...
About note 2 , I am ok with your proposal:
mappings in Universal ++= allFilesRelativeTo(file("/foo/bar")
I will give it a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
About executables files that are inside the directory, as far as I understand the IO.copy looses the executable property. So, yes I guess I might need to go recursively through the directory hierarchy and set the flag accordingly, I guess. What do you think ?
First of all, thanks for you quick reply. If you think this is interesting with some more work on the patch, it could be interesting to add an issue for that purpose and specify a little bit what could be done. If you are ok with that idea, I will write a first sketch of the specifications, we could iterate on it and I will implement it in a near future. What do you think ? |
@ivanfrain thanks. I think note #2 is the way to go. It fits more with the way i'd like things to be. "mappings" should be complete so the myriad of consumers can be ignorant about how to use it (no special semantics). That means helper methods for users to generate it. @muuki88 The sbt Path/PathFinder API is both mysterious and based on Ant. If you haven't learned it yet, I think we may need to revisit that inside sbt itself. |
@ivanfrain I like the idea of a human-readable helper method. I think this points at sbt's path finder API to be limited. E.g. see http://www.scala-sbt.org/release/docs/Detailed-Topics/Mapping-Files.html That's meant to be the canonical "sbt" way. If it's too obtuse, I'd like to alter the canonical way and use that in our plugin. |
@jsuereth A human readable method looks good to me. I'll have a look at the 2014-02-07 Josh Suereth notifications@github.com:
Ivan Frain |
@jsuereth My opinion is that we should close this pull request since it was not really well defined nor implemented and we should open an appropriate issue as you mentioned above: "Add a human readable helper method to add directory mappings" ; this issue describing how to use the helper method and explaining its expected behavior. If you agree, I will open the issue ... |
That's a good idea. I started with some documentation for the sbt pathfinder syntax. This could be starting point for human readable helper methods in sbt-native-packager. Looking forward to the next pull requeust :) |
I have tried to make a simple fix to allow copying the content of a directory using the mappings setting.
It only works for universal:stage task.
It solves what I described in stackoverflow couple of days ago: http://stackoverflow.com/questions/21551854/add-specific-directory-and-its-content-to-universal-target