一个阴谋集团文件中的两个可执行文件;堆栈构建无法识别它们



我正在尝试制作两个可执行文件"project"。这个问题的所有重复都对我没有帮助——他们的答案并不能解决我的问题。我有这样的.cab文件:

name:                int-tests
version:             0.1.0.0
synopsis:            Integration Tests Suite
description:         Integration Tests Suite
license:             AllRightsReserved
author:              Author name here
maintainer:          example@example.com
copyright:           2018 Author name here
build-type:          Custom
extra-source-files:  README.md
cabal-version:       >=1.10
library
hs-source-dirs:      common
exposed-modules:     Common
build-depends:       base
, text
, aeson
, network-uri
default-language:    Haskell2010
ghc-options:         -Wall -Werror
executable api-tests-exe
hs-source-dirs:      api
main-is:             Main.hs
ghc-options:         -threaded -rtsopts -with-rtsopts=-N -Wall -Werror
build-depends:       base
, hspec
, QuickCheck
default-language:    Haskell2010
executable e2e-tests-exe
hs-source-dirs:      e2e
main-is:             Main.hs
ghc-options:         -threaded -rtsopts -with-rtsopts=-N -Wall -Werror
build-depends:       base
, hspec
, QuickCheck
default-language:    Haskell2010

当我呼叫CCD_ 1时,我看不到这两个目标。因此,stack build api-testsstack build e2e-tests也不起作用。

如何为堆栈创建2个目标的项目?我也试过package.yaml,但结果是一样的。堆栈版本为1.9.1。我有文件夹树像:

api/
...
e2e/
...

Main.hs文件的内容如下:

module Main (main) where
main :: IO ()
main = print "Hello"

我还尝试了-main-is Main选项,但没有成功。错误看起来像:

Error: While constructing the build plan, the following exceptions were encountered:
Unknown package: api-tests

AFAIK,stack build始终构建所有目标。但是,如果只想运行一个可执行文件,则需要包含-exe的全名。因此,stack exec api-tests-exestack exec e2e-tests-exe

但您真正想做的是制定以下测试目标:https://www.haskell.org/cabal/users-guide/developing-packages.html#test-套房

问题出现在stack.yaml文件中,我不得不添加"."文件夹到"软件包:"部分。

最新更新