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

Add the ability to copy content of directory into the installation directory #159

Closed
wants to merge 1 commit into from

Conversation

ivanfrain
Copy link
Contributor

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

…rectory.

It only works for universal:stage task.
@lightbend-cla-validator
Copy link

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:

http://typesafe.com/contribute/cla

@jsuereth
Copy link
Member

jsuereth commented Feb 7, 2014

Hey @ivanfrain Thanks for trying to improve the packager!

A few notes:

  1. This only fixes the "stage" task, but no actually creating zip files or any of hte translations to MSI/DEB/RPM.
  2. Mappings should always be hte complete set of files/directories. If you'd like to include all files insdie a directory something more akin to:
mappings in Universal ++= allFilesRelativeTo(file("/foo/bar")

would be much better.

Finally, anything in src/universal directory is actually included in the universal mappings, if that helps in the interim.

Thanks!

  • Josh

// copy files
IO.copy(files)
//copy directories with there full content
directories.map {case (f, p) => IO.copyDirectory(f, p, overwrite = true)}
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jsuereth

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@muuki88

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 ?

@ivanfrain
Copy link
Contributor Author

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 ?

@jsuereth
Copy link
Member

jsuereth commented Feb 7, 2014

@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.

@jsuereth
Copy link
Member

jsuereth commented Feb 7, 2014

@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.

@ivanfrain
Copy link
Contributor Author

@jsuereth A human readable method looks good to me. I'll have a look at the
sbt web page, thanks.

2014-02-07 Josh Suereth notifications@github.com:

@ivanfrain https://github.com/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.

Reply to this email directly or view it on GitHubhttps://github.com//pull/159#issuecomment-34498795
.

Ivan Frain
11, route de Grenade
31530 Saint-Paul-sur-Save
mobile: +33 (0)6 52 52 47 07

@ivanfrain
Copy link
Contributor Author

@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 ...

@muuki88
Copy link
Contributor

muuki88 commented Feb 10, 2014

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 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants