commercialhaskell / commercialhaskell/stack

The option --copy-bins is applied after cabal's register step

Open
#3,614 5 comments 0 reactions 0 assignees View on GitHub
component: build type: enhancement
Dominant language
Haskell
Stars
4.1k
Forks
850
Avg merge
10h 37m
Merged PRs (30d)
4

Description

### General summary/comments
I'd expect `stack build --copy-bins` to copy the binaries in the copy step, but the copying is done only after cabal's register step.

### Steps to reproduce
1. `stack new copy simple`
2. Use the following`Setup.hs`:
```haskell
{-# Language OverloadedStrings #-}
import Distribution.Simple
import Shelly

main = defaultMainWithHooks simpleUserHooks { postCopy = \_ _ _ _ -> print =<< shelly (ls ".") }
```
and the following .cabal file (`copy.cabal`):
```haskell
name: copy
version: 0.1.0.0
build-type: Custom
cabal-version: >=1.10

custom-setup
setup-depends: base, Cabal, shelly

executable copy
hs-source-dirs: src
main-is: Main.hs
default-language: Haskell2010
build-depends: base >= 4.7 && < 5
```
3. run `stack build --copy-bins --local-bin-path .`

### Expected

To see the file `copy` in the output from the `postCopy` hook.

### Actual

```bash
copy-0.1.0.0: copy/register
Installing executable(s) in ...
[FilePath "./.stack-work",FilePath "./copy",FilePath "./copy.cabal",FilePath "./LICENSE",FilePath "./README.md",FilePath "./Setup.hs",FilePath "./src",FilePath "./stack.yaml"]
Copying from ... to ./copy
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.