creswick / cabal-dev

A wrapper program around cabal and cabal-install that maintains sandboxed build environments.
BSD 3-Clause "New" or "Revised" License
150 stars 24 forks source link

add-source-file command #44

Closed gregwebs closed 12 years ago

gregwebs commented 12 years ago

This isn't just to add multiple sources at once- it is for keeping a list of sources in a file so they are easy to re-add.

jtdaugherty commented 12 years ago

When I first read the name of this command, I thought it did something entirely different. Since "add-source" adds source code, I expected "add-source-file" to add a single file's worth of source code. Can we rename it to something like "add-source-list" to reduce confusion?

jtdaugherty commented 12 years ago

(Otherwise, though, this sounds like a good change. On more complex projects I'm constantly invoking add-source several times just to do a rebuild.)

gregwebs commented 12 years ago

ok, I will change to add-source-list

I am adding a test case and some code to account for relativeness of the source-list & file paths

On Wed, Nov 23, 2011 at 12:20 PM, Jonathan Daugherty < reply@reply.github.com

wrote:

(Otherwise, though, this sounds like a good change. On more complex projects I'm constantly invoking add-source several times just to do a rebuild.)


Reply to this email directly or view it on GitHub: https://github.com/creswick/cabal-dev/pull/44#issuecomment-2852516

gregwebs commented 12 years ago

changed to add-source-list now, test case added, and I tried it out on my computer.

gregwebs commented 12 years ago

Let me know what I can do to help get this merged in. I am re-doing Yesod install instructions and this command will play an important role.

jtdaugherty commented 12 years ago

Sorry for the delay on getting to this! I talked to the other maintainers about this, and it turns out that there is a better workflow than using repeated applications of add-source. Cabal-install has a relatively new feature (since the original implementation of cabal-dev) which allows you to 'cabal install' multiple directories in one command. The primary benefit of this approach is that Cabal does dependency resolution on the packages as a group rather than doing resolution on each in isolation. Please see the README section entitled "Building multiple packages together."

https://github.com/creswick/cabal-dev/blob/master/README.md

gregwebs commented 12 years ago

ok, it is good to know that cabal-dev install is preferred over cabal-dev add-source. I still need this functionality- would you like me to change it to the command cabal-dev install-list

jtdaugherty commented 12 years ago

A shell script automating the 'cabal-dev add-source' commands ought to do the trick, right?

gregwebs commented 12 years ago

I thought I am supposed to use cabal-dev install, not cabal-dev add-source

So yes, this would be similar functionality to cat FILE | xargs cabal-dev install. However, I do have a longer term vision for adding things like git repos to the list of sources. Perhaps I need to have my own wrapper on top of cabal/cabal-dev.

jtdaugherty commented 12 years ago

I think a wrapper is appropriate; that way you can make your own policy decisions about where to get your sources, how stable they need to be, etc., without modifying cabal/cabal-dev.

creswick commented 12 years ago

@gregwebs we've (jtdaughterty, j3h, myself...) about some sort of higher-level project description file, but we haven't had time to identify a format, or to figure out where it would best fit in the Haskell ecosystem of build tools. It is something we run into though -- we have occasionally run into problems here when installing complex sets of packages with different required configure/build flags for each package, for example.

One of the hesitations I have with starting from a list of files is that I feel fairly strongly that some format should be identified up front that will accommodate many additional build details as the concept matures. I am certainly interested in pursuing the idea, though.

I think the best solution /right now/ is to use a more general purpose build tool (or scripting language) to manage building multiple cabalized projects.

gregwebs commented 12 years ago

I usually try to start things in an overly-simplistic way rather than worry up front about the need to re-write later.

We have a build script for yesod [1] that is used to install multiple packages at once to a user's package database. A file where each line contains a package, directory, or url would give us adequate information. Note that referencing a package would be because of a weakness in cabal not finding the correct package that is a dependency not listed in the cabal files.

For usage of cabal-dev for applications the situation is similar. I will probably first start this project by making the Yesod installer install to a cabal-dev application.

[1] https://github.com/yesodweb/scripts/blob/master/install

On Tue, Dec 6, 2011 at 7:27 PM, Rogan Creswick < reply@reply.github.com

wrote:

@gregwebs we've (jtdaughterty, j3h, myself...) about some sort of higher-level project description file, but we haven't had time to identify a format, or to figure out where it would best fit in the Haskell ecosystem of build tools. It is something we run into though -- we have occasionally run into problems here when installing complex sets of packages with different required configure/build flags for each package, for example.

One of the hesitations I have with starting from a list of files is that I feel fairly strongly that some format should be identified up front that will accommodate many additional build details as the concept matures. I am certainly interested in pursuing the idea, though.

I think the best solution /right now/ is to use a more general purpose build tool (or scripting language) to manage building multiple cabalized projects.


Reply to this email directly or view it on GitHub: https://github.com/creswick/cabal-dev/pull/44#issuecomment-3039933

gregwebs commented 12 years ago

I can definitely see how the need for different build flags for different packages would not work with this setup. However, if we disregard that, wouldn't it be better to instead of adding a new project description format to instead allow a directory to be specified directly in the build-depends section of the cabal file for each dependency?

gregwebs commented 12 years ago

I finally created the tool that allows an external sources file that specifies to build multiple packages at once: https://github.com/yesodweb/cabal-meta

cabal-dev will be supported soon