cabal build --help
和其他人在类似的句子中提到组件
Build one or more targets from within the project. The available targets are
the packages in the project as well as individual components within those
packages, including libraries, executables, test-suites or benchmarks. Targets
can be specified by name or location. If no target is specified then the
default is to build the package in the current directory.
来自cabal user guide在 9 中也提到了它们。 Setup.hs 命令
,以及
给出两个前缀 exe:
和 lib:
来选择它们。还有更多这些前缀吗?
最佳答案
组件是节后面的任何东西,具有自己的一组依赖项等。因此它可以是多个子库、多个可执行文件、测试套件等。
你是对的,这是没有充分记录的!在源代码中我们可以看到以下内容( https://github.com/haskell/cabal/blob/00a2351789a460700a2567eb5ecc42cca0af913f/Cabal/src/Distribution/Simple/BuildTarget.hs#L569 )
matchComponentKind :: String -> Match ComponentKind
matchComponentKind s
| s `elem` ["lib", "library"] = return' LibKind
| s `elem` ["flib", "foreign-lib", "foreign-library"] = return' FLibKind
| s `elem` ["exe", "executable"] = return' ExeKind
| s `elem` ["tst", "test", "test-suite"] = return' TestKind
| s `elem` ["bench", "benchmark"] = return' BenchKind
| otherwise = matchErrorExpected "component kind" s
where
return' ck = increaseConfidence >> return ck
这就是完整列表!
关于haskell - 什么是 Cabal 组件以及如何使用它们?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62994278/