本文介绍了如何减少 .cabal 文件的 build-depends 字段中的重复?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个 .cabal 文件:
Here's a .cabal file:
Name: myprogram
Version: 0.1
-- blah blah blah
Cabal-version: >=1.9.2
Executable myprogram
HS-source-dirs: src
Main-is: Main.hs
Build-depends: attoparsec == 0.10.*,
base == 4.3.*,
-- long long list of packages
Test-Suite test
HS-source-dirs: test, src
Type: exitcode-stdio-1.0
Main-is: Main.hs
Build-depends: attoparsec == 0.10.*,
base == 4.3.*,
-- long long list of packages
QuickCheck == 2.4.*
有什么办法可以用与可执行文件相同,加上 QuickCheck"替换测试套件的一长串依赖于构建的包?
Is there any way I can replace the long list of build-depends packages for the test suite with "same as for the executable, plus QuickCheck"?
版本信息.
- cabal-dev 0.9
- cabal 安装 0.10.2
- Cabal 库 1.10.2.0
- GHC 7.0.4
- Haskell 平台 2011.4.0.0
推荐答案
自 2.2 版 Cabal 支持通用节以来,删除构建信息字段:https://cabal.readthedocs.io/en/latest/developing-packages.html#common-stanzas
Since version 2.2 Cabal supports common stanzas, to dedup build info fields:https://cabal.readthedocs.io/en/latest/developing-packages.html#common-stanzas
cabal-version: 2.2
name: myprogram
version: 0.1
-- blah blah blah
common deps
build-depends: base ^>= 4.11,
-- long long list of packages
ghc-options: -Wall
library
import: deps
exposed-modules: Foo
test-suite tests
import: deps
type: exitcode-stdio-1.0
main-is: Tests.hs
build-depends: foo
这篇关于如何减少 .cabal 文件的 build-depends 字段中的重复?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!