edsko / stack2cabal

BSD 3-Clause "New" or "Revised" License
14 stars 4 forks source link

Support for cabal 2.4's native remote vcs repo dependencies #5

Open hvr opened 6 years ago

hvr commented 6 years ago

besides the current mode which invokes git clone for you, stack2cabal ought to support mapping remote git repo deps in stack2yaml to cabal's new native support for them;

Current syntax looks like so

source-repository-package
    type: git
    location: https://github.com/well-typed/cborg
    tag: 3d274c14ca3077c3a081ba7ad57c5182da65c8c1
    subdir: cborg

source-repository-package
    type: git
    location: https://github.com/serokell/time-units.git
    tag: 6c3747c1ac794f952de996dd7ba8a2f6d63bf132

cabal 2.4 probably won't be able to support specifying multiple subdirs in a single source-repository-package stanza yet.

edsko commented 6 years ago

Note that even if we don't do the check out, we'll still need to get the .cabal file from the repo, as we need that .cabal file to figure out things like the project name, which we'll need to figure out if we need to override something in the LTS.

hvr commented 6 years ago

Ok... that's tricky... you could use a 2-pass schema, where you'd let cabal pre-fetch the git repos (e.g. via cabal new-build --dry --allow-newer=*:*, and then inspect the plan.json file from which you could easily read off the remote git repo packages and their respective pkg-ids. Maybe cabal new-fetch could provide something tooling like stack2cabal could hook into