6

I have multiple executables in one of my Stack projects:

executable m1
  hs-source-dirs:      src
  main-is:             Main1.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5

executable m2
  hs-source-dirs:      src
  main-is:             Main2.hs
  default-language:    Haskell2010
  build-depends:       base >= 4.7 && < 5

I would like to build only one of them at a time. From the documentation and this other question, it would seem that the following command should work:

stack build :m2

but what actually happens is that both executables, m1 and m2, are always built regardless of whether I include the package name, the package type, etc.

What could be causing this?

Community
  • 1
  • 1
rityzmon
  • 1,945
  • 16
  • 26
  • 1
    Have you tried `project:m1` or `project:exe:m1`? – epsilonhalbe Jul 02 '16 at 22:26
  • 1
    @epsilonhalbe Yes. All variations of the target end up building all executables. I wonder if its a bug. The version of Stack I'm using is Version 1.1.0 x86_64 hpack-0.13.0. – rityzmon Jul 02 '16 at 22:39
  • Does this answer your question? [Haskell Stack build specific executable](https://stackoverflow.com/questions/36137310/haskell-stack-build-specific-executable) – manews Nov 25 '22 at 19:20

1 Answers1

4

It's not possible at the moment. See https://github.com/commercialhaskell/stack/issues/1406

phadej
  • 11,947
  • 41
  • 78